-
Notifications
You must be signed in to change notification settings - Fork 38
Replace REST cache with Azure Cache2 #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@jordwalke @ulrikstrid this seems to be ready. I fixed a related issue where Build times are (don't take last build into account as I removed a string from the cache key string which invalidated it). |
- powershell: esy.cmd import-dependencies | ||
continueOnError: true | ||
condition: and(eq(variables['AGENT.OS'], 'Windows_NT'), and(eq(variables['Build.Reason'], 'PullRequest'), and(succeeded(), ne(variables['Build.SourceBranch'], variables['System.PullRequest.TargetBranch'])))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stuff was important (esy import-dependencies). Is it moved somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened was Azure changed the location of where our cache directory was on the physical file system, and so artifacts broke in future builds because the artifacts had hard coded paths in them. So I made sure that we actually ran esy export-dependencies
and esy import-dependencies
which fixes that issue.
(We can also use the REST API locally from laptops to pull down those caches and warm up our local development).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jordwalke Hm... I didn't realize this was added because of that. The path issue does not seem to be happening now (e.g. https://dev.azure.com/esy-ocaml/esy-ocaml/_build/results?buildId=421). Do you remember if this issue happened in specific situations or how could we repro it?
Also, did it happen in all platforms? I was wondering if maybe the recent upgrade you did to Windows_2019 vm would have fixed that problem.
We can also use the REST API locally from laptops to pull down those caches and warm up our local development
This is definitely a regression. I wonder if there is a way to expose the cache in the release artifacts? Reintroducing the REST API based flow would mean we would have to own again the issues with permissions, source and target branch handling etc which was one of the nice upsides of using Azure cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize this was added because of that. The path issue does not seem to be happening now (e.g. https://dev.azure.com/esy-ocaml/esy-ocaml/_build/results?buildId=421). Do you remember if this issue happened in specific situations or how could we repro it?
Some of the paths unexpectedly changed (the user directory where we have the esy cache for example). I don't believe they make any promises that it will not change unexpectedly. So I put the esy import/export in there because it guards against it ever changing in the future - as well as enabling the ability for us to use the cache to pull down artifacts from CI to warm up our laptops (it can't be done without first esy export-dependencies)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also use the REST API locally from laptops to pull down those caches and warm up our local development
This is definitely a regression. I wonder if there is a way to expose the cache in the release artifacts? Reintroducing the REST API based flow would mean we would have to own again the issues with permissions, source and target branch handling etc which was one of the nice upsides of using Azure cache.
I think I might not have been clear. What I was saying was that if the cache is in esy export-dependencies form, then it is trivial for local development machines (laptops) to have simple bash scripts that use the REST API and pull them down and magically speed up their local builds. (This is most important for Windows).
I wasn't suggesting that the only way to get the caches in esy export-dependencies form is to use the REST API. It's just that the .ci configurations have diverged and since the new Azure cache started being prototyped outside of this repo, I had already improved some of the steps in this repo's CI config, and then they got out of sync in terms of their features. So I'm asking if this PR can be updated to include the features that I added in this repo, before we merge?
Using esy import-dependencies
and esy export-dependencies
were the two that I could think of (I also added a couple of custom steps for windows which delete the package ocamlfind
from the imported build cache (which we need until my PR for esy lands)).
I had to configure the esy import-dependencies
a specific way (note my previous config which calls esy.cmd
). It wouldn't work otherwise.
continueOnError: true | ||
condition: and(eq(variables['AGENT.OS'], 'Windows_NT'), and(eq(variables['Build.Reason'], 'PullRequest'), and(succeeded(), ne(variables['Build.SourceBranch'], variables['System.PullRequest.TargetBranch'])))) | ||
displayName: "Print env in powershell" | ||
# Needed so that the mingw tar doesn't shadow the system tar. See |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also note that this here was required when running export-dependencies
and import-dependencies
because we can't have mingw tar shadowing the windows tar that we need.
… is not installed" otherwise)
@jordwalke I tried to re-add the I am getting two sorts of errors:
They happen with different libraries: rely, pastel, console in particular.
The latest build includes both cases. Something I realized is that the |
It's supposed to remove ocamlfind after importing. There's a problem with importing ocamlfind that my (now merged) PR fixes. We might want to see if esy nightlies fix it (https://www.npmjs.com/package/@esy-nightly/esy) now that my PR is merged. With my PR, we don't need to delete ocamlfind (though I haven't tried yet). I could look at it next weekend if you don't get to it. |
@jchavarri I was just reading about Cache@2 docs. This PR looks really cool, and I'm happy to help. Let me know |
It seems Azure
Cache
tasks are out of beta, starting from v2:This PR updates the template to use them, plus updates esy to 0.5.8.