-
Notifications
You must be signed in to change notification settings - Fork 169
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
Woodpecker CI cache fixes #1309
Conversation
.woodpecker.yml
Outdated
mount: | ||
- ".gradle" | ||
secrets: | ||
[MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET] | ||
when: | ||
- path: | ||
include: ["app/build.gradle.kts"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be kept? I had added this, because I only want to save the new caches if something had changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that anyone can change the file in a PR, and then potentially get access to secrets to mess with the cache. Maybe a better option would be a cronjob which automatically rebuilds the cache every night or so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah the events are OR not AND ;/
I guess it will have to be like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this wouldn't prevent that at all. Anyone can edit this workflow, set whatever event they want and trigger a pr that updates the caches / Access the secrets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Github you can probably do a "hack" where you can set a secret only available (in Environment) if the file hasn't changed and another environment that allows only access to the same secret if approved by a required reviewer.
In Woodpecker it doesn't seem possible to do something similar. https://woodpecker-ci.org/docs/usage/secrets#use-in-pull-requests-events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats true. Ive changed it back now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is deemed too much of a security hazard, the caching can be removed, we don't gain that much from it. The biggest improvement was already made by setting the .gradle as ENV. This allowed it to reuse the gradle cache between steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its mostly a theoretical problem, at least so far it hasnt been abused in practice. And we would probably notice if someone opened a malicious PR.
Any idea why the build is failing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems it failed to download a depency, network issues prob, try again by pushing a commit
Same as LemmyNet/lemmy#4276:
Also change cache rebuild to run only on main branch, to prevent random attackers from writing into the cache from a PR.