-
Notifications
You must be signed in to change notification settings - Fork 226
Add EC checks for StepActions #1640
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,19 +11,33 @@ metadata: | |
| spec: | ||
| description: >- | ||
| This task can be used to run enterprise contract checks | ||
| stepTemplate: | ||
| securityContext: | ||
| # runAsUser is needed because the different images used in this Task run as different users. Ideally, | ||
| # we'd let OpenShift do its thing and set a random UID with a common group ID for *all* containers | ||
| # in the namespace, but that is currently disabled so it's wild west. | ||
| runAsUser: 0 | ||
| env: | ||
| - name: HOME | ||
| value: /tekton/home | ||
| steps: | ||
| - name: gather-tasks | ||
| image: quay.io/konflux-ci/appstudio-utils:48c311af02858e2422d6229600e9959e496ddef1@sha256:91ddd999271f65d8ec8487b10f3dd378f81aa894e11b9af4d10639fd52bba7e8 | ||
| # per https://kubernetes.io/docs/concepts/containers/images/#imagepullpolicy-defaulting | ||
| # the cluster will set imagePullPolicy to IfNotPresent | ||
| workingDir: $(workspaces.source.path)/source | ||
| script: | | ||
|
Contributor
Author
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. Extra changes needed to make checkton happy. |
||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| source hack/ec-checks.sh | ||
| $(build_tasks_dir build_tasks-ec) | ||
| $(all_tasks_dir all_tasks-ec) | ||
|
|
||
| build_tasks_dir build_tasks-ec | ||
| all_tasks_dir all_tasks-ec | ||
| stepactions_dir stepactions-ec | ||
| - name: validate-all-tasks | ||
| workingDir: "$(workspaces.source.path)/source" | ||
| image: quay.io/enterprise-contract/ec-cli:snapshot@sha256:ccbf00aee7d4af1f78ba66aa04b0899b7e770dea44f6df0a1aa0a9a12529e9fe | ||
| image: quay.io/enterprise-contract/ec-cli:snapshot@sha256:46fae4d356d678383a926de8a68f79177d7e685d5497675acf41c9d3425aaacc | ||
| script: | | ||
| set -euo pipefail | ||
|
|
||
|
|
@@ -37,7 +51,7 @@ spec: | |
| ec validate input --policy "${policy}" --output yaml --strict=true ${args[*]} | ||
| - name: validate-build-tasks | ||
| workingDir: "$(workspaces.source.path)/source" | ||
| image: quay.io/enterprise-contract/ec-cli:snapshot@sha256:ccbf00aee7d4af1f78ba66aa04b0899b7e770dea44f6df0a1aa0a9a12529e9fe | ||
| image: quay.io/enterprise-contract/ec-cli:snapshot@sha256:46fae4d356d678383a926de8a68f79177d7e685d5497675acf41c9d3425aaacc | ||
| script: | | ||
| set -euo pipefail | ||
|
|
||
|
|
@@ -49,5 +63,20 @@ spec: | |
| policy='./policies/build-tasks.yaml' | ||
|
|
||
| ec validate input --policy "${policy}" --output yaml --strict=true ${args[*]} | ||
| - name: validate-step-actions | ||
| workingDir: "$(workspaces.source.path)/source" | ||
| image: quay.io/enterprise-contract/ec-cli:snapshot@sha256:46fae4d356d678383a926de8a68f79177d7e685d5497675acf41c9d3425aaacc | ||
| script: | | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| # Generate array of file parameters, e.g. --file=foo.yaml --file=bar.yaml | ||
| files=( stepactions-ec/*.yaml ) | ||
| readarray -t args < <(printf -- '--file=%s\n' "${files[@]}") | ||
| echo "[DEBUG] Files parameter: ${args[*]}" | ||
|
|
||
| policy='./policies/step-actions.yaml' | ||
| ec validate input --show-successes --policy "${policy}" --output yaml --strict=true "${args[@]}" | ||
|
|
||
| workspaces: | ||
| - name: source | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| # These policies are meant to be applied to all of the Tasks in this repo. | ||
| sources: | ||
| - policy: | ||
| - github.com/enterprise-contract/ec-policies//policy/lib | ||
| - github.com/enterprise-contract/ec-policies//policy/stepaction | ||
| data: | ||
| - oci::quay.io/konflux-ci/tekton-catalog/data-acceptable-bundles:latest | ||
| - github.com/release-engineering/rhtap-ec-policy//data | ||
| config: | ||
| include: | ||
| - stepaction.image | ||
| - stepaction.kind | ||
| # Support legacy matchers for now | ||
| - image | ||
| - kind |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 needed so EC finds the authfile 🤷
And it also, for some reason, makes
runAsUserrequired. Quite odd.