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

ci: Fix per commit CI #1277

Merged

Conversation

NickeZ
Copy link
Collaborator

@NickeZ NickeZ commented Aug 18, 2024

A new version that also works in my fork and hopefully works in the common repo as well.

Benefits

You see small icons next to the appropriate commit because we use the github api to set statuses.

image

Drawbacks

It is easier to by mistake introduce code that leaks github secrets. Currently we don't use github secrets in any job. But the idea is that we use github secrets in the push event so that we can authenticate with docker hub and do docker push.

It also requires the repository to give write access to github actions.

Alternatives

It is possible to implement without pull_request_target by simply not setting the statuses on the commits. This means that you will have to look at the commit hash in the build job name to figure out where it failed.

image

@NickeZ NickeZ requested a review from benma August 18, 2024 21:50
@NickeZ NickeZ self-assigned this Aug 18, 2024
Copy link
Collaborator

@benma benma left a comment

Choose a reason for hiding this comment

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

Drawbacks

It is easier to by mistake introduce code that leaks github secrets.

Can you post an example how that would happen for clarity?

Does the alternative you prevent that not have this problem? If so, imho we should go with that. I think the commit hash in the title to identify the commit is not too bad 🤷

@NickeZ
Copy link
Collaborator Author

NickeZ commented Aug 19, 2024

Can you post an example how that would happen for clarity?

https://nathandavison.com/blog/github-actions-and-the-threat-of-malicious-pull-requests

Does the alternative you prevent that not have this problem? If so, imho we should go with that. I think the commit hash in the title to identify the commit is not too bad 🤷

I was afraid you'd say that :P. I'll make a quick fix.

Btw, you should disable write access to the repo for actions.

@NickeZ NickeZ force-pushed the nickez/ci-for-every-commit-permissions branch 2 times, most recently from ca37148 to 8db8eb7 Compare August 20, 2024 07:07
The pull request event does not have write access to the repo, so it
cannot dispatch jobs.
@NickeZ NickeZ force-pushed the nickez/ci-for-every-commit-permissions branch 2 times, most recently from b41e935 to 44f6dba Compare August 20, 2024 07:31
@NickeZ NickeZ requested a review from benma August 20, 2024 07:31
@NickeZ
Copy link
Collaborator Author

NickeZ commented Aug 20, 2024

ready for review again

Copy link
Collaborator

@benma benma left a comment

Choose a reason for hiding this comment

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

lgtm

@NickeZ NickeZ merged commit 66b3438 into BitBoxSwiss:master Aug 20, 2024
3 checks passed
@NickeZ NickeZ deleted the nickez/ci-for-every-commit-permissions branch August 20, 2024 07:40
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

Successfully merging this pull request may close these issues.

2 participants