-
Notifications
You must be signed in to change notification settings - Fork 2.2k
aws-account-operator: Add prek validation to PROW CI #78697
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,14 @@ images: | |
| items: | ||
| - dockerfile_path: build/Dockerfile | ||
| to: aws-account-operator | ||
| - dockerfile_literal: | | ||
| FROM src | ||
| RUN PREK_VERSION="$(tr -d '[:space:]' < .prek-version 2>/dev/null || true)" \ | ||
| && PREK_VERSION="${PREK_VERSION:-v0.3.9}" \ | ||
| && curl -fsSL "https://github.com/j178/prek/releases/download/${PREK_VERSION}/prek-x86_64-unknown-linux-gnu.tar.gz" \ | ||
| | tar xzf - --strip-components=1 -C /usr/local/bin/ prek-x86_64-unknown-linux-gnu/prek | ||
|
Comment on lines
+9
to
+12
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Read the target YAML file to see the full context
cat -n ci-operator/config/openshift/aws-account-operator/openshift-aws-account-operator-master.yaml | head -100Repository: openshift/release Length of output: 3483 🏁 Script executed: # Check if .prek-version file exists in the repo
find . -name ".prek-version" -o -name "*prek*" | head -20Repository: openshift/release Length of output: 43 🏁 Script executed: # Search for other mentions of prek in the codebase
rg -i "prek" --type yaml --type sh --type mdRepository: openshift/release Length of output: 4240 🏁 Script executed: # Check if .prek-version exists in the aws-account-operator repo
# The config references the repo at /go/src/github.com/openshift/aws-account-operator
# Since we're in openshift/release repo, let's search for any reference to aws-account-operator content
rg -i "\.prek-version" --type yaml --type shRepository: openshift/release Length of output: 456 🏁 Script executed: # Search for PR `#975` or similar references in the repo
rg "975|prek" --type md | head -30Repository: openshift/release Length of output: 357 🏁 Script executed: # Check the prek project to understand if binary validation is expected
web_search
prek tool GitHub j178/prek releases binary verificationRepository: openshift/release Length of output: 155 🌐 Web query:
💡 Result: For j178/prek GitHub releases, the project provides SHA-256 checksums for prebuilt release assets (published alongside the binaries as *.sha256 files). The releases page lists assets with their SHA-256 digests. Additionally, starting around the v0.3.x timeframe, prek’s release process includes GitHub Artifact Attestations that you can verify with the GitHub CLI (this provides provenance/integrity attestation for the downloaded artifacts). How to verify a downloaded release binary (checksum): 1) Download the matching binary asset from https://github.com/j178/prek/releases (for your version/OS/arch). 2) Download the corresponding checksum file (typically named like the asset but with the extension .sha256). 3) Verify the binary against the checksum in that .sha256 file. How to verify GitHub Artifact Attestations (provenance/integrity): gh attestation verify --repo j178/prek You can also verify with a downloaded attestation bundle: gh attestation verify --bundle Citations:
🌐 Web query:
💡 Result: No pull request Citations:
Download and verify the prek binary before extraction. The code downloads a binary directly from GitHub without checksum or signature validation. The prek project provides SHA-256 checksums for releases—these should be downloaded and verified before extracting. Additionally, the Validate the release asset checksum (or use GitHub attestations) and consider requiring |
||
| from: src | ||
| to: prek-runner | ||
| resources: | ||
| '*': | ||
| limits: | ||
|
|
@@ -47,6 +55,19 @@ tests: | |
| container: | ||
| from: src | ||
| skip_if_only_changed: ^(?:\.tekton|\.github)|\.md$|^(?:\.gitignore|OWNERS|LICENSE)$ | ||
| - as: prek | ||
| commands: | | ||
| export PREK_HOME=/tmp/prek | ||
| git init | ||
| git add -A | ||
| if [ -x hack/ci.sh ]; then | ||
| ./hack/ci.sh | ||
| else | ||
| prek run --all-files | ||
| fi | ||
| container: | ||
| from: prek-runner | ||
| skip_if_only_changed: ^(?:\.tekton|\.github)|\.md$|^(?:\.gitignore|OWNERS|LICENSE)$ | ||
| - always_run: false | ||
| as: integration-test | ||
| cluster_claim: | ||
|
|
||
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.
Why not just include all this in the boilerplate image so we don't need per-repo config to handle running 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.
This is actually a really good point. Let me look into boilerplate.
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.
first goal is to show something that works and then generalize. if we can add to a central location and not break everyone, that works for me.
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.
Makes sense to me, just wanted to float the option to save some PRs and config drift possibilities.