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

Handle external pull requests wrt. OCI image build + push well #947

Closed
amotl opened this issue May 30, 2023 · 6 comments
Closed

Handle external pull requests wrt. OCI image build + push well #947

amotl opened this issue May 30, 2023 · 6 comments

Comments

@amotl
Copy link
Member

amotl commented May 30, 2023

Hi there,

at #945 (comment), @neumann-nico is reporting upon a minor but not unimportant quirk with the CI setup.

The problem is that external contributors, including Dependabot, does not have the permissions to push to GHCR, the OCI image registry of GitHub.

@gutzbenj @amotl Dependabot has not the rights to run all CI tests.

Release Docker Full/Standard are failing with:
Error: buildx failed with: ERROR: failed to solve: failed to push ghcr.io/earthobservations/wetterdienst-full:pr-945: unexpected status: 403 Forbidden

We could either

  1. Give him the rights
  2. Skip the docker pushing for dependabot
  3. Someone with the rights needs tor run the tests

Instead of discussing on a pull request, let's discuss here.

With kind regards,
Andreas.

@amotl
Copy link
Member Author

amotl commented May 30, 2023

Hi Nico,

Skip the "push" step for Dependabot.

I've tried it on two other spots already, but haven't been successful so far.

With kind regards,
Andreas.

@amotl
Copy link
Member Author

amotl commented May 30, 2023

@gutzbenj said at #945 (comment):

This is also effecting anyone who's not part of our organization and would open a PR from their fork e.g. max-mustermann/pr-to-wetterdienst. Ignoring would be fine but will have to figure the correct filter for PR branches.

@amotl
Copy link
Member Author

amotl commented May 30, 2023

It does not happen so often, but it's true. I wonder how others are handling this.

One idea: Build up an allow-list of contributors who have the corresponding permissions, and add a condition to the build+push workflow step to run only if the contribution is coming from someone who is member of this allow-list, and skip it for all others?

The good thing with our OCI building workflow recipes is that the build_and_test job will already cover the building of the image thoroughly, otherwise this operation would be complete nonsense at all.

@gutzbenj
Copy link
Member

I think the allow list wouldn't work because there's no way to leak our GCR secret to someone. This is simply not the idea organization secrets.

@amotl
Copy link
Member Author

amotl commented May 30, 2023

I think the allow list wouldn't work because there's no way to leak our GCR secret to someone. This is simply not the idea organization secrets.

I don't understand this comment about the GCR secret and the organization secrets. Can you clarify?

My proposal was to only run the build&upload job based on an allow-list, so that it would only run when the patch originates from some of us who have the permissions, and skip it for all others.

Do you have a different solution in mind? We can also ask GitHub support for help, if we can't discover how others are doing it.

@gutzbenj
Copy link
Member

Sorry for the late response: This was fixed with

if: ${{ ! startsWith(github.head_ref, '^dependabot/*') }} && ${{ ! github.event.pull_request.head.repo.fork }}

Same for the full version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants