Repository navigation
132 lines (108 loc) · 4.63 KB
/
Copy pathreusable-e2e.yaml
File metadata and controls
132 lines (108 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Reusable workflow example
'on':
workflow_call:
inputs:
pipelines-release:
required: true
type: string
k8s-version:
required: true
type: string
defaults:
run:
shell: bash
working-directory: ./
jobs:
e2e-test:
name: e2e test
runs-on: ubuntu-22.04
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: 'on'
GOFLAGS: -ldflags=-s -ldflags=-w
KO_DOCKER_REPO: registry.local:5000/knative
# registry.local:5000 is a plain-HTTP KinD registry; tell ko to skip TLS
# so that both image pushes and SBOM writes (ko >=v0.19) use plain HTTP.
KO_FLAGS: --insecure-registry
KOCACHE: ~/ko
SIGSTORE_SCAFFOLDING_RELEASE_VERSION: "v0.7.31"
TEKTON_PIPELINES_RELEASE: "https://infra.tekton.dev/tekton-releases/pipeline/${{ inputs.pipelines-release == 'latest' && 'latest' || format('previous/{0}', inputs.pipelines-release) }}/release.yaml"
# Note that we do not include the v prefix here so we can use it in all
# the places this is used.
SKIP_INITIALIZE: true
steps:
- name: Check out our repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: "go.mod"
- uses: ko-build/setup-ko@61b4d1d396f5b2e7d6bb6fefdce3dc38d1a13445 # v0.10
- name: Install mirror, kind, knative + sigstore
uses: sigstore/scaffolding/actions/setup@c9e7cb4a331fad6ff917e0f912a37035487f6d55 # v0.7.41
with:
k8s-version: ${{ inputs.k8s-version }}
version: ${{ env.SIGSTORE_SCAFFOLDING_RELEASE_VERSION }}
knative-version: 1.9.0
- name: Install Tekton pipelines
run: |
while ! kubectl apply --filename ${TEKTON_PIPELINES_RELEASE}
do
echo "waiting for tekton pipelines to get installed"
sleep 2
done
# Restart so picks up the changes.
kubectl -n tekton-pipelines delete po -l app=tekton-pipelines-controller
- name: Run integration tests
run: |
./test/presubmit-tests.sh --integration-tests
- name: Run tutorial taskrun
run: |
kubectl patch configmap/chains-config \
--namespace tekton-chains \
--type merge \
--patch '{"data":{"artifacts.oci.format": "simplesigning", "artifacts.oci.storage": "oci", "artifacts.taskrun.format": "in-toto", "signers.x509.fulcio.address": "http://fulcio.fulcio-system.svc", "signers.x509.fulcio.enabled": "true", "transparency.enabled": "true", "transparency.url": "http://rekor.rekor-system.svc"}}'
# Restart chains controller so picks up the changes.
kubectl -n tekton-chains delete po -l app=tekton-chains-controller
# Wait for chains controller to be ready again
echo "Waiting for chains controller to be ready"
kubectl wait --for=condition=ready --timeout=2m -n tekton-chains pod -l app=tekton-chains-controller
# Give chains a moment to reload the configuration
sleep 5
kubectl create -f https://raw.githubusercontent.com/tektoncd/chains/main/examples/taskruns/task-output-image.yaml
# Sleep so the taskrun shows up.
sleep 2
echo "Waiting for the taskrun to complete..."
kubectl wait --timeout 3m --for=condition=Succeeded taskruns --all || kubectl get taskruns -o yaml
echo "Waiting for Chains to do it's thing"
for i in {1..10}
do
tkn tr describe --last -o jsonpath="{.metadata.annotations.chains\.tekton\.dev/transparency}" > tektonentry
if [ -s ./tektonentry ]; then
if grep --quiet rekor.rekor-system.svc ./tektonentry ; then
echo "Found rekor transparency entry:"
cat ./tektonentry
kubectl get taskruns -oyaml
exit 0
else
echo "Did not find expected rekor transparency entry"
sleep 2
fi
else
echo "Did not find rekor transparency entry in the annotations"
sleep 2
fi
done
# Did not find entry, fail
echo "Failed to find rekor transparency entry after 10 attempts"
kubectl get taskruns -oyaml
kubectl logs -n tekton-chains -l app=tekton-chains-controller --tail=100
exit 1
- name: Collect diagnostics
if: ${{ failure() }}
uses: chainguard-dev/actions/kind-diag@d496b2ab65497cac13d77ccd5038b8aae7e8c43b # v1.8.2
with:
cluster-resources: nodes
namespace-resources: pods,taskruns,jobs