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: test ts-api-guardian on windows #27205
Conversation
| command: "yarn install --frozen-lockfile --non-interactive --network-timeout 100000 && yarn bazel test //tools/ts-api-guardian:all" | ||
| plugins: | ||
| - https://github.com/filipesilva/docker-buildkite-plugin.git#1bd961d8601a26af69194ef21fd639df3840da5c: | ||
| image: "filipesilva/node-bazel-windows:0.0.2" |
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 docker image should be part of the Angular docker org.
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.
oh no. we just removed our custom docker image :-(
if we absolutely need a custom docker image, can we please minimize the number of dependencies installed via the docker image and instead install them directly as part of the CI and cache them?
The main reason why we dropped our custom docker image was that updating it took several steps, while updating dependencies installed from npm can be done in a single pull request.
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.
@IgorMinar there are no npm dependencies in this docker image. It has only the Bazel prerequisites: MSYS2 and Visual Studio 2015 redistributables. It uses as a base a nodejs+yarn image.
That's the Dockerfile also in this PR.
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.
@alexeagle isn't a docker image like this something that the bazel team should provide? we certainly can't be the only people that would want to run bazel in a windows docker image.
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 think we have to own it for now but maybe @laszlocsomor or @fweikert could chime in about governance for it
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.
@meteorcloudy probably knows more than I do
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.
@xingao267 Is the Windows docker image for Bazel available now?
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.
@meteorcloudy Unfortunately no, and we currently do not have a plan to offer one.
e5b250a
to
eabaae0
CachingBuildkite itself doesn't have any built-in cache mechanism. We'd have to add something custom. Some (incomplete) docs about sharing state can be found at buildkite/docs#239. They plan to include the node_modules usecase. buildkite/elastic-ci-stack-for-aws#352 shows a custom setup for sharing assets. There's also something about caching using docker layers: https://github.com/buildkite-plugins/docker-compose-buildkite-plugin#reusing-caches-from-images, buildkite/docs#263. Concurrent builds
|
83b1c63
to
d3ddd31
| command: "yarn install --frozen-lockfile --non-interactive --network-timeout 100000 && yarn bazel test //tools/ts-api-guardian:all" | ||
| plugins: | ||
| - https://github.com/filipesilva/docker-buildkite-plugin.git#1bd961d8601a26af69194ef21fd639df3840da5c: | ||
| image: "filipesilva/node-bazel-windows:0.0.2" |
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.
oh no. we just removed our custom docker image :-(
if we absolutely need a custom docker image, can we please minimize the number of dependencies installed via the docker image and instead install them directly as part of the CI and cache them?
The main reason why we dropped our custom docker image was that updating it took several steps, while updating dependencies installed from npm can be done in a single pull request.
tools/bazel_stamp_vars.js
Outdated
| // Note: git operations, especially git status, take a long time inside mounted docker volumes | ||
| // in Windows or OSX hosts (https://github.com/docker/for-win/issues/188). | ||
| // To bypass this script use `--workspace_status_command=`, in the command line or in a rc file. | ||
| const execSync = require('child_process').execSync; |
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.
have you considered using shelljs? we use it elsewhere in the repo - it makes the shell like js code much more readable.
but using external dependency would mean that we need to ensure that this dependency is installed via npm before we run bazel, but since we already install shelljs in package.json, that should not be a problem.
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.
No, didn't really think about it much. But I'd expect the workspace status command to also run in the bazel node install action, so I think it can't have 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.
Just confirmed that the workspace status command will also run on bazel run @nodejs//:yarn.
It can be deactivated by passing in --workspace_status_command= but that feels like just a nasty caveat.
Do you feel shelljs is such an improvement that we should special case the install command?
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.
Actually now that I revisit this suggestion, I realize that angular/angular does not actually run bazel run @nodejs//:yarn but rather just yarn, and uses Bazel from npm.
So at this point shelljs is already in the node_modules.
However, in light of the benchmarked on unit test performance, and the fact that the workspace status command runs on every command, I am wary to add non-native dependencies since loading them will take some extra time...
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.
sounds fair... let's keep it as is.
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.
well, we changed it now so that workspace status command no longer runs every time, but only for releases, does that change your mind here?
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.
Talked to Alex and it seems releases should be done from non-windows machines so it is not important for this change to be in this PR. Made https://github.com/angular/angular/pull/27431for it instead.
tools/bazel_stamp_vars.js
Outdated
| const BUILD_SCM_HASH = _exec(`git rev-parse HEAD`); | ||
| console.log(`BUILD_SCM_HASH ${BUILD_SCM_HASH}`); | ||
|
|
||
| if (_exec(`git rev-parse HEAD`) == '') { |
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.
Why not use BUILD_SCM_HASH?
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 don't know. I just converted the existing script, didn't really alter it.
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 is not right. it should be git tag - we are trying to detect if tags have been fetched for this git clone.
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 see now, I made a mistake copying the commands. Have changed it to git tag.
|
@filipesilva I spoke with @mgechev who is looking into having a global bazel cache which could solve the caching issues. |
tools/bazel_stamp_vars.js
Outdated
| const BUILD_SCM_HASH = _exec(`git rev-parse HEAD`); | ||
| console.log(`BUILD_SCM_HASH ${BUILD_SCM_HASH}`); | ||
|
|
||
| if (_exec(`git rev-parse HEAD`) == '') { |
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 is not right. it should be git tag - we are trying to detect if tags have been fetched for this git clone.
tools/bazel_stamp_vars.js
Outdated
| } | ||
|
|
||
| // Find out if there are any uncommitted local changes | ||
| // TODO(i): is it ok to use '--untracked-files=no' to ignore untracked files since they should not |
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.
you can remove this todo - it is ok for us to ignore untracked.
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.
Done
tools/bazel_stamp_vars.js
Outdated
| // Note: git operations, especially git status, take a long time inside mounted docker volumes | ||
| // in Windows or OSX hosts (https://github.com/docker/for-win/issues/188). | ||
| // To bypass this script use `--workspace_status_command=`, in the command line or in a rc file. | ||
| const execSync = require('child_process').execSync; |
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.
sounds fair... let's keep it as is.
move the workspace status command changes to a separate PR? it might need more revision and is no longer required for the buildkite setup
.bazelrc
Outdated
| @@ -35,7 +35,7 @@ test --nolegacy_external_runfiles | |||
| ############################### | |||
|
|
|||
| # Releases should always be stamped with version control info | |||
| build:release --workspace_status_command=./tools/bazel_stamp_vars.sh | |||
| build:release --workspace_status_command="node ./tools/bazel_stamp_vars.js" | |||
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.
add a link to bazelbuild/bazel#4802 (since this assumes node is on the path, and our "full-stack" story is that typically you don't need to install it)
.buildkite/Dockerfile
Outdated
| # The nanoserver image won't work because MSYS2 does not run in it https://github.com/Alexpux/MSYS2-packages/issues/1493 | ||
|
|
||
| # Before building this image, you must locally build node-windows:10.13.0-windowsservercore-1803. | ||
| # Clone https://github.com/StefanScherer/dockerfiles-windows/tree/master/node/10 and build using |
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.
could you pin this github URL to a SHA so it doesn't mysteriously fail next time?
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.
Done
.buildkite/README.md
Outdated
|
|
||
| We use [Google Cloud](https://cloud.google.com/) as our cloud provider, under the | ||
| [Angular project](https://console.cloud.google.com/home/dashboard?project=internal-200822). | ||
| To access this project you need to be authenticated with your angular.io account. |
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.
may need to be (Googlers typically have their google.com accounts here instead, per @IgorMinar attempt to avoid them needing to login twice). A bit hard to explain but a simple way is "need to be logged in with a Google account that's a member of team@angular.io. For googlers this may be your google.com account, for others it is an angular.io account
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.
Done
|
|
||
| To upload a new version of the docker image, follow any build instructions in `Dockerfile` and then | ||
| run `docker build -t angular/node-bazel-windows:NEW_VERSION`, followed by | ||
| `docker push angular/node-bazel-windows:NEW_VERSION`. |
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.
where does it push to? dockerhub, under your account?? Do you need to be authenticated to that as well?
If so, could we investigate switching to Google Container Registry?
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.
It pushes to dockerhub, but currently angular/node-bazel-windows does not exist. I assume you will create it later. For now I am using filipesilva/node-bazel-windows.
Will look into Google Container Registry.
.buildkite/pipeline.yml
Outdated
| - label: windows-test | ||
| commands: | ||
| - "yarn install --frozen-lockfile --non-interactive --network-timeout 100000" | ||
| - "yarn bazel test //tools/ts-api-guardian:all --noshow_progress --workspace_status_command=" |
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.
can remove the empty --workspace_status_command now
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.
Done
| command: "yarn install --frozen-lockfile --non-interactive --network-timeout 100000 && yarn bazel test //tools/ts-api-guardian:all" | ||
| plugins: | ||
| - https://github.com/filipesilva/docker-buildkite-plugin.git#1bd961d8601a26af69194ef21fd639df3840da5c: | ||
| image: "filipesilva/node-bazel-windows:0.0.2" |
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 think we have to own it for now but maybe @laszlocsomor or @fweikert could chime in about governance for it
tools/bazel_stamp_vars.js
Outdated
| // Note: git operations, especially git status, take a long time inside mounted docker volumes | ||
| // in Windows or OSX hosts (https://github.com/docker/for-win/issues/188). | ||
| // To bypass this script use `--workspace_status_command=`, in the command line or in a rc file. | ||
| const execSync = require('child_process').execSync; |
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.
well, we changed it now so that workspace status command no longer runs every time, but only for releases, does that change your mind here?
|
(not yet passing pull-approve, still has pending reviews) |
This reverts commit 24ebdbd. Buildkite is running out of space and causing PRs to go red: angular#27508
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |




PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
CI does not run on Windows.
What is the new behavior?
CI runs on Windows for a subset of tests.
Does this PR introduce a breaking change?
Other information
Builds can be seen at https://buildkite.com/angular/angular/builds while we are still setting up the GitHub checks.
The text was updated successfully, but these errors were encountered: