Visitar URL original
ci: test ts-api-guardian on windows by filipesilva · Pull Request #27205 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20220123175532/https://github.com/angular/angular/pull/27205
Skip to content
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

Closed
wants to merge 1 commit into from
Closed

ci: test ts-api-guardian on windows #27205

wants to merge 1 commit into from

Conversation

@filipesilva
Copy link
Member

@filipesilva filipesilva commented Nov 21, 2018 •

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 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?

  • Yes
  • No

Other information

Builds can be seen at https://buildkite.com/angular/angular/builds while we are still setting up the GitHub checks.

.bazelrc Outdated Show resolved Hide resolved
.buildkite/pipeline.yml Outdated Show resolved Hide resolved
tools/ts-api-guardian/BUILD.bazel Outdated Show resolved Hide resolved
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"
Copy link
Member Author

@filipesilva filipesilva Nov 21, 2018

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.

Copy link
Contributor

@IgorMinar IgorMinar Nov 26, 2018

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.

Copy link
Member Author

@filipesilva filipesilva Nov 26, 2018

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.

Copy link
Contributor

@IgorMinar IgorMinar Nov 29, 2018

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.

Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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

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

Copy link
Contributor

@meteorcloudy meteorcloudy Dec 4, 2018

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?

Copy link
Contributor

@xingao267 xingao267 Dec 5, 2018

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.

.buildkite/pipeline.yml Outdated Show resolved Hide resolved
.buildkite/pipeline.yml Outdated Show resolved Hide resolved
@filipesilva filipesilva force-pushed the buildkite-testing branch 3 times, most recently from e5b250a to eabaae0 Nov 21, 2018
@filipesilva
Copy link
Member Author

@filipesilva filipesilva commented Nov 21, 2018 •

Caching

Buildkite 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

It looks like concurrent builds interfere with each other: buildkite-plugins/docker-buildkite-plugin#85
User error, fixed now.

@filipesilva filipesilva force-pushed the buildkite-testing branch 4 times, most recently from 83b1c63 to d3ddd31 Nov 22, 2018
@filipesilva filipesilva requested a review from alexeagle Nov 22, 2018
@filipesilva filipesilva force-pushed the buildkite-testing branch from d3ddd31 to e201a67 Nov 23, 2018
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"
Copy link
Contributor

@IgorMinar IgorMinar Nov 26, 2018

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.

// 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;
Copy link
Contributor

@IgorMinar IgorMinar Nov 26, 2018

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.

Copy link
Member Author

@filipesilva filipesilva Nov 26, 2018

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.

Copy link
Member Author

@filipesilva filipesilva Nov 27, 2018

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?

Copy link
Member Author

@filipesilva filipesilva Nov 29, 2018

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...

Copy link
Contributor

@IgorMinar IgorMinar Nov 29, 2018

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.

Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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?

Copy link
Member Author

@filipesilva filipesilva Dec 3, 2018

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.

const BUILD_SCM_HASH = _exec(`git rev-parse HEAD`);
console.log(`BUILD_SCM_HASH ${BUILD_SCM_HASH}`);

if (_exec(`git rev-parse HEAD`) == '') {
Copy link
Member

@gkalpak gkalpak Nov 29, 2018

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?

Copy link
Member Author

@filipesilva filipesilva Nov 29, 2018

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.

Copy link
Contributor

@IgorMinar IgorMinar Nov 29, 2018

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.

Copy link
Member Author

@filipesilva filipesilva Dec 3, 2018

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.

@IgorMinar
Copy link
Contributor

@IgorMinar IgorMinar commented Nov 29, 2018

@filipesilva I spoke with @mgechev who is looking into having a global bazel cache which could solve the caching issues.

const BUILD_SCM_HASH = _exec(`git rev-parse HEAD`);
console.log(`BUILD_SCM_HASH ${BUILD_SCM_HASH}`);

if (_exec(`git rev-parse HEAD`) == '') {
Copy link
Contributor

@IgorMinar IgorMinar Nov 29, 2018

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.

}

// 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
Copy link
Contributor

@IgorMinar IgorMinar Nov 29, 2018

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.

Copy link
Member Author

@filipesilva filipesilva Dec 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// 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;
Copy link
Contributor

@IgorMinar IgorMinar Nov 29, 2018

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.

@filipesilva filipesilva force-pushed the buildkite-testing branch from e201a67 to 4fd3402 Dec 3, 2018
Copy link
Contributor

@alexeagle alexeagle left a comment

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"
Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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)

# 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
Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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?

Copy link
Member Author

@filipesilva filipesilva Dec 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


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.
Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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

Copy link
Member Author

@filipesilva filipesilva Dec 3, 2018

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`.
Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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?

Copy link
Member Author

@filipesilva filipesilva Dec 3, 2018

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.

- 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="
Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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

Copy link
Member Author

@filipesilva filipesilva Dec 3, 2018

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"
Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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

// 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;
Copy link
Contributor

@alexeagle alexeagle Dec 3, 2018

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?

@filipesilva filipesilva force-pushed the buildkite-testing branch from 4fd3402 to edc294e Dec 3, 2018
@filipesilva filipesilva force-pushed the buildkite-testing branch from edc294e to 2f888b8 Dec 3, 2018
@ngbot
Copy link

@ngbot ngbot bot commented Dec 3, 2018

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "ci/circleci: test_aio" is failing
    pending missing required labels: PR target: *
    pending status "code-review/pullapprove" is pending
    pending status "continuous-integration/travis-ci/push" is pending
    pending status "continuous-integration/travis-ci/pr" is pending
    pending status "ci/circleci: integration_test" is pending

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@alxhub
Copy link
Contributor

@alxhub alxhub commented Dec 3, 2018

(not yet passing pull-approve, still has pending reviews)

@alexeagle alexeagle requested review from IgorMinar and removed request for IgorMinar Dec 4, 2018
@alexeagle alexeagle self-requested a review Dec 4, 2018
@ngbot
Copy link

@ngbot ngbot bot commented Dec 5, 2018

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "ci/circleci: test_aio" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

IgorMinar added a commit that referenced this issue Dec 5, 2018
@IgorMinar IgorMinar closed this in 24ebdbd Dec 5, 2018
@alexeagle alexeagle deleted the buildkite-testing branch Dec 5, 2018
IgorMinar added a commit that referenced this issue Dec 6, 2018
This reverts commit 24ebdbd.

Buildkite is running out of space and causing PRs to go red: #27508
IgorMinar added a commit that referenced this issue Dec 6, 2018
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this issue Jan 3, 2019
ngfelixl added a commit to ngfelixl/angular that referenced this issue Jan 28, 2019
ngfelixl added a commit to ngfelixl/angular that referenced this issue Jan 28, 2019
This reverts commit 24ebdbd.

Buildkite is running out of space and causing PRs to go red: angular#27508
ngfelixl added a commit to ngfelixl/angular that referenced this issue Jan 28, 2019
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Sep 14, 2019

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

9 participants