forked from sigstore/cosign
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attestations + policy in cip. (sigstore#1772)
* Modify types, introduce name defaults, codegen. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Start refactoring and adding verify-attestation pieces. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Sort of works e2e. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * E2E tests. Plumb rekor through for key-ful signing too. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * bad rebase. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * more bad rebases. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * regen keys. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * at the right place. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * forgot one rekor-url. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Lint. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * remove these manually. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Cleanups, do not unnecessarily eval empty json bytes for attestation policy. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Add name to attestations for easier referencing from cip policy. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Do not return empty PolicyResult when errors. Start adding UT for ValidatePolicy. Getting ready for rebase. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * fix: cue policy missing double-quotes Signed-off-by: hectorj2f <hectorf@vmware.com> * Add start of unit tests for policy validation stuff. Add start of UT for ValidatePolicy. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Refactor policy eval code. Remove the attestation CIP from normal CIP tests, will follow up with those. Add validation for attestations in CIPs Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * loving yaml, thanks validation! Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Starting to break apart the attestation tests. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * checkpoint Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * Remove unused keychain from the Validate* calls and use one from the remoteopts instead consistently. Address PR feedback. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> * lint. Signed-off-by: Ville Aikas <vaikas@chainguard.dev> Co-authored-by: hectorj2f <hectorf@vmware.com>
- Loading branch information
1 parent
66ee73f
commit 2f6fc54
Showing
26 changed files
with
1,955 additions
and
139 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
.github/workflows/kind-cluster-image-policy-with-attestations.yaml
This file contains 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,97 @@ | ||
# Copyright 2022 The Sigstore Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: Test cosigned with ClusterImagePolicy with attestations | ||
|
||
on: | ||
pull_request: | ||
branches: [ 'main', 'release-*' ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
cip-test: | ||
name: ClusterImagePolicy e2e tests | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
k8s-version: | ||
- v1.21.x | ||
- v1.22.x | ||
# Try without this one now, might have problems with job restartings | ||
# may require upstream changes. | ||
- v1.23.x | ||
|
||
env: | ||
KNATIVE_VERSION: "1.1.0" | ||
KO_DOCKER_REPO: "registry.local:5000/cosigned" | ||
SCAFFOLDING_RELEASE_VERSION: "v0.2.8" | ||
GO111MODULE: on | ||
GOFLAGS: -ldflags=-s -ldflags=-w | ||
KOCACHE: ~/ko | ||
COSIGN_EXPERIMENTAL: true | ||
|
||
steps: | ||
- uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v2.4.0 | ||
- uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v2.2.0 | ||
with: | ||
go-version: '1.17.x' | ||
|
||
# will use the latest release available for ko | ||
- uses: imjasonh/setup-ko@2c3450ca27f6e6f2b02e72a40f2163c281a1f675 # v0.4 | ||
|
||
- uses: imranismail/setup-kustomize@8fa954828ed3cfa7a487a2ba9f7104899bb48b2f # v1.6.1 | ||
|
||
- name: Install yq | ||
uses: mikefarah/yq@ed5b811f37384d92f62898492ddd81b6dc3af38f # v4.16.2 | ||
|
||
- name: Setup mirror | ||
uses: chainguard-dev/actions/setup-mirror@main | ||
with: | ||
mirror: mirror.gcr.io | ||
|
||
- name: build cosign | ||
run: | | ||
make cosign | ||
- name: Install cluster + cosign | ||
uses: sigstore/scaffolding/actions/setup@main | ||
|
||
- name: Install cosigned | ||
env: | ||
GIT_HASH: ${{ github.sha }} | ||
GIT_VERSION: ci | ||
LDFLAGS: "" | ||
COSIGNED_YAML: cosigned-e2e.yaml | ||
KO_PREFIX: registry.local:5000/cosigned | ||
COSIGNED_ARCHS: linux/amd64 | ||
run: | | ||
make ko-cosigned | ||
kubectl apply -f cosigned-e2e.yaml | ||
# Wait for the webhook to come up and become Ready | ||
kubectl rollout status --timeout 5m --namespace cosign-system deployments/webhook | ||
- name: Run Cluster Image Policy Tests with attestations | ||
run: | | ||
./test/e2e_test_cluster_image_policy_with_attestations.sh | ||
- name: Collect diagnostics | ||
if: ${{ failure() }} | ||
uses: chainguard-dev/actions/kind-diag@84c993eaf02da1c325854fb272a4df9184bd80fc # main |
This file contains 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 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 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
Oops, something went wrong.