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

build: use cross platform workspace_status_command #27431

Closed

Conversation

filipesilva
Copy link
Contributor

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?

The workspace_status_command is a .sh script and thus does not properly run on windows.

What is the new behavior?

The command is a node script instead. This is the workaround suggested in bazelbuild/bazel#4802.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

cc @alexeagle

// See https://github.com/bazelbuild/bazel/issues/5958
// 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

can remove this line, the workspace_status_command is opt-in now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// 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;
const _exec = (str => execSync(str).toString().trim());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: style guide in google3 is to prefer
function _exec() {}
over
const _exec = () => {}
since they are equivalent and the former was the previous idiom

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Wow, sounds like a bad guideline to me 😁

It is more verbose and not 100% equivalent 😞
Is the preference to also use functions and protypes instead of classes? 😛

console.error('Running', process.argv.join(' '));

function onError() {
console.log('Failed to execute:,', process.argv.join(' '));
Copy link
Contributor

Choose a reason for hiding this comment

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

should these be printed to stderr instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

console.log(`No git tags found, can't stamp the build.`);
console.log('Either fetch the tags:');
console.log(' git fetch git@github.com:angular/angular.git --tags');
console.log('or build without stamping by giving an empty workspace_status_command:');
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs an update since workspace_status_command is now opt-in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to just ask the user to fetch the tags.

@alexeagle alexeagle added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Dec 4, 2018
@filipesilva filipesilva force-pushed the windows-workspace-command branch 3 times, most recently from f918cac to 76a1b92 Compare December 5, 2018 11:35
@filipesilva filipesilva added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 9, 2019
@ngbot
Copy link

ngbot bot commented Jan 9, 2019

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "continuous-integration/travis-ci/pr" is failing
    pending missing required labels: PR target: *
    pending status "code-review/pullapprove" 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.

@filipesilva filipesilva added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Jan 9, 2019
@filipesilva filipesilva requested a review from a team as a code owner January 9, 2019 13:26
@filipesilva filipesilva added target: major This PR is targeted for the next major release and removed action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Jan 9, 2019
@filipesilva filipesilva added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note area: build & ci Related the build and CI infrastructure of the project labels Jan 9, 2019
@ngbot ngbot bot added this to the needsTriage milestone Jan 9, 2019
@ngbot
Copy link

ngbot bot commented Jan 9, 2019

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "ci/circleci: legacy-unit-tests-saucelabs" 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.

@angular-automatic-lock-bot
Copy link

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.
Labels
action: merge The PR is ready for merge by the caretaker area: build & ci Related the build and CI infrastructure of the project cla: yes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants