Visitar URL original
ci: share data between jobs using workspaces by filipesilva · Pull Request #28928 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20190322181104/https://github.com/angular/angular/pull/28928
Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
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

ci: share data between jobs using workspaces #28928

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
5 participants
@filipesilva
Copy link
Member

filipesilva commented Feb 22, 2019 •

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the new behavior?

This PR expands usage of the CircleCI workspaces feature to share artifacts between jobs of the same workflow.

The current mindset WRT to artifacts is that we cache some artifacts at the end of the build-npm-packages job, which is then restored on each job. This works well even for jobs prior to that specific cache because of partial cache hits.

With workspaces the mindset is slightly different. There is an initial job that creates a workspace from the cache, which other jobs use and might enhance.

The key difference is that subsequent jobs do not repeat setup, which can yield different results since part of setup is merging a PR with latest master. Another desirable characteristic of this setup is that it enables easier sharing of artifacts between jobs, and lessens repetition in the circleci configuration.

Here is a sample of comparison of workflows taken roughly at the same time. It's important to capture this comparison at similar times because CircleCI workload varies during the day:

Before: https://circleci.com/workflow-run/155fc8ea-2ea5-45ec-8f75-05f3297f4052
After: https://circleci.com/workflow-run/97e4f222-75f3-426c-bcdf-a583f1524045

Of these we can compare specific jobs:

The gains in individual job setup are lessened by the new common install step though. In https://circleci.com/gh/angular/angular/218899 we can see it took 1m58s.

Of these, 27s seem to be due to yarn behaviour where --frozen-lockfile with a cached directory can still fetch dependencies in some cases (yarnpkg/yarn#5840 (comment)). Updating the AIO lockfile should reduce it to ~2s.

The gain on correctness cannot be compared. Under the previous setup it was possible for individual jobs to run over different code.

Further additions to persisted workspace files can also improve performance of subsequent runs.

It's also important to note that this PR also adds caching of AIO node_modules, which wasn't done before.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@googlebot googlebot added the cla: yes label Feb 22, 2019

@filipesilva filipesilva force-pushed the filipesilva:circleci-workspace branch 8 times, most recently from d1acaa9 to b062782 Feb 22, 2019

@ngbot ngbot bot added this to the needsTriage milestone Feb 22, 2019

@filipesilva filipesilva force-pushed the filipesilva:circleci-workspace branch 3 times, most recently from 95cbb79 to aaf0362 Feb 22, 2019

@filipesilva filipesilva force-pushed the filipesilva:circleci-workspace branch from aaf0362 to 8fa57c9 Feb 22, 2019

@filipesilva filipesilva marked this pull request as ready for review Feb 22, 2019

@filipesilva filipesilva requested a review from angular/fw-dev-infra as a code owner Feb 22, 2019

@IgorMinar
Copy link
Member

IgorMinar left a comment

the rest looks great. we can rename the name in a follow up PR. I want this change now because it's so good ! :-)

version: 2
jobs:
lint:
install:

This comment has been minimized.

@IgorMinar

IgorMinar Feb 22, 2019

Member

is install the right name? how about init or setup or prepare? we do much more than just "install"

@IgorMinar

This comment has been minimized.

Copy link
Member

IgorMinar commented Feb 22, 2019

merge-assistance: if this fails to cherry-pick to patch and the conflict can't be easily resolved, please merge it to master-only and ask @filipesilva to send a separate PR for the patch branch. thanks!

@benlesh benlesh closed this in f0989b7 Feb 22, 2019

@filipesilva filipesilva deleted the filipesilva:circleci-workspace branch Feb 22, 2019

filipesilva added a commit to filipesilva/angular that referenced this pull request Feb 22, 2019

filipesilva added a commit to filipesilva/angular that referenced this pull request Feb 25, 2019

@filipesilva filipesilva referenced this pull request Feb 25, 2019

Closed

ci: add bazel_repository_cache to CircleCI workspace #28935

3 of 14 tasks complete
@gkalpak

This comment has been minimized.

Copy link
Member

gkalpak commented Feb 25, 2019

I think it would be a good idea to capture in the commit message (and PR description) why we did this change (and why "it is so good" 😛).
Also, how this affects total CI time (afaict, it increases the total time for certain jobs) and why the benefits justify any increase in total workflow duration.

@filipesilva

This comment has been minimized.

Copy link
Member Author

filipesilva commented Feb 25, 2019

@gkalpak I am a bit late to change the commits but added details and comparison to the PR message.

filipesilva added a commit to filipesilva/angular that referenced this pull request Feb 25, 2019

filipesilva added a commit to filipesilva/angular that referenced this pull request Feb 25, 2019

benlesh added a commit that referenced this pull request Feb 25, 2019

filipesilva added a commit to filipesilva/angular that referenced this pull request Feb 25, 2019

filipesilva added a commit to filipesilva/angular that referenced this pull request Feb 25, 2019

@filipesilva filipesilva referenced this pull request Feb 25, 2019

Closed

7.2.x workspaces #28965

2 of 14 tasks complete

benlesh added a commit that referenced this pull request Feb 25, 2019

benlesh added a commit that referenced this pull request Feb 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.