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

fix(ci): Skip GCP CI jobs on PRs from external contributors, let mergify test them after approval #7956

Merged
merged 17 commits into from
Nov 22, 2023

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Nov 17, 2023

Motivation

This is a quick fix for CI failures on PRs from external repositories.

We've asked the ZSA and ZSF teams to submit PRs, so let's make it a good experience for them.

Close #4529.

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?
For significant changes:
  • Is there a summary in the CHANGELOG?
  • Can these changes be split into multiple PRs?

If a checkbox isn't relevant to the PR, mark it as done.

This is a significant change for external developers, but we can add it to the changelog in another PR.

Specifications

GitHub context and the difference between ref and head_ref:
https://docs.github.com/en/actions/learn-github-actions/contexts#github-context

Skipping individual job steps:
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsif

Example PRs and branch names

Internal PR: rate-limit-getaddr #7955
Recent external PR: rex4539/typos #7865
Dependabot: dependabot/github_actions/devops-599883908b #7948
Mergify: mergify/merge-queue/d948c06290 #7954

Complex Code or Requirements

We need to skip external branches in the actual CI jobs, but only run on changed files.

Then we need to run on external branches in the patch jobs, or run on unchanged files. This requires two patch workflow files. (Conditions in the same workflow file are both required, but we want either condition.)

Solution

  • Skip GCP workflows on external PRs
  • Add patch workflows for GCP workflows that run dummy jobs on external PRs
  • Skip optional steps on external PRs because they are failing

Extra changes:

  • Document some workflows
  • Add a trivial Rust change so Rust GCP workflows run on this PR
  • Cleanup some unnecessary workflow conditions and timeouts

Testing

We can check this using this branch, which is from @teor2345's external repository. But it won't be fully tested until we merge it, and get a branch from someone who isn't a ZF GitHub org member.

Review

I'd like to get this merged quickly so external developers have a good experience, and sort out any non-blocking changes later.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

@teor2345 teor2345 added C-bug Category: This is a bug A-devops Area: Pipelines, CI/CD and Dockerfiles P-Medium ⚡ I-usability Zebra is hard to understand or use labels Nov 17, 2023
@teor2345 teor2345 self-assigned this Nov 17, 2023
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Nov 17, 2023
@teor2345 teor2345 marked this pull request as ready for review November 21, 2023 09:14
@teor2345 teor2345 requested a review from a team as a code owner November 21, 2023 09:14
@teor2345 teor2345 requested a review from a team as a code owner November 21, 2023 09:14
@teor2345 teor2345 requested review from upbqdn and removed request for a team November 21, 2023 09:14
Copy link
Member

@gustavovalverde gustavovalverde left a comment

Choose a reason for hiding this comment

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

This looks good to me, but I'd like to test it.

We have 2 options:

  • Create a dummy account to trigger this
  • Temporarily remove permission one of our members, and redo this PR.

Copy link
Member

@upbqdn upbqdn left a comment

Choose a reason for hiding this comment

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

[...] I'd like to test it.

This PR is from an external repository already, and the GCP jobs were skipped. We can test this on the upcoming PRs submitted by QEDIT.

@mergify mergify bot merged commit b5e16a6 into ZcashFoundation:main Nov 22, 2023
153 checks passed
@teor2345
Copy link
Contributor Author

I just checked after the merge, and we're still running GCP jobs on the main branch. So all we have to check now is another PR from a non-Zebra contributor.

@gustavovalverde
Copy link
Member

gustavovalverde commented Nov 23, 2023

This PR is from an external repository already

That's correct, but it wasn't from an external contributor (which is the trigger for the permission issue). I just didn't want to wait until an external contributor made a contribution to confirm it's working as expected.

@teor2345
Copy link
Contributor Author

This PR is from an external repository already

That's correct, but it wasn't from an external contributor (which is the trigger for the permission issue). I just didn't want to wait until an external contributor made a contribution to confirm it's working as expected.

I think there might have been some miscommunication here. We're expecting multiple PRs from the ZSA and sustainability fund teams over the next few weeks. The first one is #7978, which would have run CI, but it has merge conflicts.

@arya2 arya2 mentioned this pull request Nov 29, 2023
44 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles C-bug Category: This is a bug C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG I-usability Zebra is hard to understand or use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make PRs from external user repositories pass or skip CI jobs
4 participants