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 pull_request_target to start Jenkins #34707

Closed
wants to merge 1 commit into from

Conversation

mmarchini
Copy link
Contributor

@mmarchini mmarchini commented Aug 10, 2020

GitHub recently introduced a new Pull Request event for Actions with
access to Secrets and GITHUB_TOKEN with write access. Therefore, we
don't need to use the scheduler event to start Jenkins anymore.

Ref: https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

GitHub recently introduced a new Pull Request event for Actions with
access to Secrets and GITHUB_TOKEN with write access. Therefore, we
don't need to use the scheduler event to start Jenkins anymore.

Ref: https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/
@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label Aug 10, 2020
@mmarchini
Copy link
Contributor Author

mmarchini commented Aug 10, 2020

Not entirely sure this will work for existing PRs without rebase though. At least when I tested on node-auto-test I had to rebase for the PR to have proper access, might need to specify the base branch explicitly on checkout if that's the case. I'll run more tests on another repo before landing this.

Copy link
Member

@phillipj phillipj left a comment

Choose a reason for hiding this comment

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

LooksReallyGoodToMe!

@mmarchini
Copy link
Contributor Author

Ok, there's a huge downside with this approach: the Action will run on the base commit of the Pull Request, not the base Branch, therefore:

  1. If the Action is changed on the base branch but the PR was still pointing to an older version, the older version will run
  2. If an Action is added with this event, it will only work for new PRs (assuming the branch was created after the Action was added). For existing PRs, the PR needs to be rebased

Since we have 271 open PRs, rebasing everything every time we change an Action is unfeasible. Therefore we might not be able to use this event for most tasks.

@mmarchini mmarchini added the blocked PRs that are blocked by other issues or PRs. label Aug 10, 2020
@richardlau
Copy link
Member

Ok, there's a huge downside with this approach: the Action will run on the base commit of the Pull Request, not the base Branch, therefore:

  1. If the Action is changed on the base branch but the PR was still pointing to an older version, the older version will run
  2. If an Action is added with this event, it will only work for new PRs (assuming the branch was created after the Action was added). For existing PRs, the PR needs to be rebased

Since we have 271 open PRs, rebasing everything every time we change an Action is unfeasible. Therefore we might not be able to use this event for most tasks.

It won’t solve the already opened PR case, but could we do the rebasing we do in the Jenkins CI jobs? I guess we’d have to keep the action steps to a minimum and encapsulate the logic in e.g. shell scripts.

@mmarchini
Copy link
Contributor Author

The Action will not trigger on existing PRs.

@mmarchini
Copy link
Contributor Author

Seems like the issue_comment event does what we need: it has access to secrets and it always runs on the default branch. The difference is we would use a comment like /jenkins instead of adding a label. One advantage of this is that we can add other commands later (/jenkins v8, /jenkins citgm).

We could also keep both: label using the schedule event and comment using the issue_comment.

What do y'all like more:

  • 🚀 label
  • 😄 comment
  • ❤️ both
  • 😕 indifferent

@cjihrig
Copy link
Contributor

cjihrig commented Aug 10, 2020

Can we please avoid using comments since they trigger GitHub notifications.

@mmarchini
Copy link
Contributor Author

@cjihrig good point, but starting the CI generates a notification anyway, so in this case it's probably not a problem?

@mmarchini

This comment has been minimized.

@cjihrig
Copy link
Contributor

cjihrig commented Aug 10, 2020

but starting the CI generates a notification anyway, so in this case it's probably not a problem?

It makes the problem worse for people receiving emails. FWIW, I've asked in the past to make the bot less noisy as well.

@mmarchini
Copy link
Contributor Author

Closing for now then, will reopen once nodejs/github-bot#272 lands since that should workaround all the limitations we have with current pull_request and pull_request_target events.

@mmarchini mmarchini closed this Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked PRs that are blocked by other issues or PRs. meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants