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

Check the repository owner in CI tasks #1280

Merged
merged 2 commits into from
Feb 3, 2025
Merged

Conversation

sauclovian-g
Copy link
Contributor

Comment on lines 60 to 63
if: runner.os == 'Linux'
if: runner.os == 'Linux' && github.repository_owner == 'GaloisInc'
uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:21.11
Copy link
Contributor

@RyanGlScott RyanGlScott Jan 30, 2025

Choose a reason for hiding this comment

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

I'm not entirely sure that it's correct to guard this entire step behind github.repository_owner == 'GaloisInc', as the remainder of the workflow depends on Nix being installed in order to work correctly. The only reason that we require a secret value in the first place is to fill out access-tokens, which is solely for the sake of avoiding rate limiting issues. As such, it is likely more correct just to leave out the extra_nix_config portion of this step if a fork is being used...

...but then again, even that might not be necessary. If I'm reading the docs correctly, then secrets.GITHUB_TOKEN is always defined, so I'm inclined to think that this part simply won't be an issue for forks. As such, I'm inclined not to change anything about the install-nix-action steps. (Please speak up if I've overlooked something, however.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was wondering about that. And I was wondering why it needed a token to get at Nix.

I don't know enough about the internal workings to second-guess you :-) so I'll remove these.

Copy link
Member

Choose a reason for hiding this comment

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

oof.. it's hard to find where this conversation happened because you force pushed. One of the reasons I dislike force pushes except in dire cases.

Ryan's info is correct though: nothing really to do with nix, we are just avoiding github's rather severe rate limiting using a token that is provided for this particular workflow run. Please feel free to add a comment to this effect to impede future confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I thought it was going to be force-push a minor adjustment then merge, but you got to it before I came back 😸. (Which is just as well because this way there doesn't need to be a whole additional pull request...)

Copy link
Contributor

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

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

LGTM, aside from one improvement.

Comment on lines 260 to +263
build-push-image:
runs-on: ubuntu-22.04
needs: [config]
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || needs.config.outputs.release == 'true'
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || needs.config.outputs.release == 'true') && github.repository_owner == 'GaloisInc'
Copy link
Contributor

Choose a reason for hiding this comment

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

The build-push-image job in crux-mir-build.yml should be guarded in a similar way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, not sure how I missed that. I've added it

This will prevent them from running and failing in forked repos.
Copy link
Member

@kquick kquick left a comment

Choose a reason for hiding this comment

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

See my comments in GaloisInc/cryptol#1792 (review)

@sauclovian-g
Copy link
Contributor Author

Looking in crux-mir-build.yml, I notice we have

      - name: Create binary artifact
        if: github.repository == 'GaloisInc/crucible'

and then immediately after it,

      - name: Sign binary artifact
        if: github.event.pull_request.head.repo.fork == false && github.repository_owner == 'GaloisInc'

which is one of the ones I updated.

For tidiness they should probably have the same check (since if we don't create the binary artefact, signing it will certainly fail)... which one do we prefer? I think the chances of ever renaming the crucible repo are 0 and that's probably the only functional difference.

@RyanGlScott
Copy link
Contributor

I'm fine with checking for github.repository_owner == 'GaloisInc'.

Also use the same conditional for building, signing, and uploading the
same artefacts.
@sauclovian-g sauclovian-g requested a review from kquick January 31, 2025 22:27
Copy link
Member

@kquick kquick left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@sauclovian-g sauclovian-g merged commit 25064ae into master Feb 3, 2025
32 checks passed
@sauclovian-g sauclovian-g deleted the tidy-ci-in-forks branch February 3, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants