Skip to content

Commit 1ab8019

Browse files
Merge pull request #832 from securesign/e2e
Add sigstore-e2e test execution
2 parents 02415fd + 1fe1805 commit 1ab8019

File tree

2 files changed

+204
-130
lines changed

2 files changed

+204
-130
lines changed
+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: 'Install and configure Kind cluster'
2+
description: 'Customized Kind-action'
3+
4+
inputs:
5+
config:
6+
description: 'Kind config'
7+
required: true
8+
olm:
9+
description: 'install olm'
10+
required: true
11+
default: 'false'
12+
keycloak:
13+
description: 'install keycloak'
14+
required: true
15+
default: 'false'
16+
prometheus:
17+
description: 'install prometheus'
18+
required: true
19+
default: 'false'
20+
21+
outputs:
22+
oidc_url:
23+
value: keycloak_url
24+
description: 'Keycloak OIDC url'
25+
26+
runs:
27+
using: 'composite'
28+
steps:
29+
- name: Install Cluster
30+
uses: container-tools/[email protected]
31+
with:
32+
version: v0.20.0
33+
node_image: kindest/node:v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb
34+
cpu: 3
35+
registry: false
36+
config: ${{ inputs.config }}
37+
38+
- name: Configure ingress
39+
shell: bash
40+
run: |
41+
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
42+
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s
43+
- name: Install prometheus
44+
if: ${{ inputs.prometheus == 'true'}}
45+
shell: bash
46+
run: |
47+
#install Prometheus
48+
LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)
49+
curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -
50+
kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default
51+
52+
- name: Install olm
53+
if: ${{ inputs.olm == 'true'}}
54+
shell: bash
55+
run: |
56+
#install OLM
57+
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/crds.yaml
58+
# wait for a while to be sure CRDs are installed
59+
sleep 1
60+
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/olm.yaml
61+
62+
- name: Install keycloak
63+
if: ${{ inputs.keycloak == 'true'}}
64+
shell: bash
65+
run: |
66+
kubectl create --kustomize ci/keycloak/operator/overlay/kind
67+
until [ ! -z "$(kubectl get pod -l name=keycloak-operator -n keycloak-system 2>/dev/null)" ]
68+
do
69+
echo "Waiting for keycloak operator. Pods in keycloak-system namespace:"
70+
kubectl get pods -n keycloak-system
71+
sleep 10
72+
done
73+
kubectl create --kustomize ci/keycloak/resources/overlay/kind
74+
until [[ $( kubectl get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]]
75+
do
76+
printf "Waiting for keycloak deployment. \n Keycloak ready: %s\n" $(kubectl get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system)
77+
sleep 10
78+
done
79+
80+
# HACK - expose keycloak under the same name as the internal SVC has so it will be accessible:
81+
# - within the cluster (where the localhost does not work)
82+
# - outside the cluster (resolved from /etc/hosts and redirect to the localhost)
83+
kubectl create -n keycloak-system -f - <<EOF
84+
apiVersion: networking.k8s.io/v1
85+
kind: Ingress
86+
metadata:
87+
name: keycloak
88+
spec:
89+
rules:
90+
- host: keycloak-internal.keycloak-system.svc
91+
http:
92+
paths:
93+
- backend:
94+
service:
95+
name: keycloak-internal
96+
port:
97+
number: 80
98+
path: /
99+
pathType: Prefix
100+
EOF
101+
102+
echo "keycloak_url=https://keycloak-internal.keycloak-system.svc" >> $GITHUB_OUTPUT

.github/workflows/main.yml

+102-130
Original file line numberDiff line numberDiff line change
@@ -205,24 +205,12 @@ jobs:
205205
run: podman load -i /tmp/operator-oci.tar
206206

207207
- name: Install Cluster
208-
uses: container-tools/kind-[email protected]
208+
uses: ./.github/actions/kind-cluster
209209
with:
210-
version: v0.24.0
211-
node_image: kindest/node:v1.27.17@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe
212-
cpu: 3
213-
registry: false
214210
config: ./ci/config.yaml
215-
216-
- name: Install Ingress
217-
run: |
218-
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
219-
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s
220-
221-
- name: Install prometheus
222-
run: |
223-
LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)
224-
curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -
225-
kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default
211+
prometheus: 'true'
212+
keycloak: 'true'
213+
olm: 'true'
226214

227215
- name: Deploy operator container
228216
env:
@@ -233,51 +221,6 @@ jobs:
233221
run: |
234222
kubectl wait --for=condition=available deployment/rhtas-operator-controller-manager --timeout=120s -n openshift-rhtas-operator
235223
236-
- name: Install Keycloak
237-
run: |
238-
#install OLM
239-
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/crds.yaml
240-
# wait for a while to be sure CRDs are installed
241-
sleep 1
242-
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/olm.yaml
243-
244-
kubectl create --kustomize ci/keycloak/operator/overlay/kind
245-
until [ ! -z "$(kubectl get pod -l name=keycloak-operator -n keycloak-system 2>/dev/null)" ]
246-
do
247-
echo "Waiting for keycloak operator. Pods in keycloak-system namespace:"
248-
kubectl get pods -n keycloak-system
249-
sleep 10
250-
done
251-
kubectl create --kustomize ci/keycloak/resources/overlay/kind
252-
until [[ $( oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]]
253-
do
254-
printf "Waiting for keycloak deployment. \n Keycloak ready: %s\n" $(oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system)
255-
sleep 10
256-
done
257-
258-
# HACK - expose keycloak under the same name as the internal SVC has so it will be accessible:
259-
# - within the cluster (where the localhost does not work)
260-
# - outside the cluster (resolved from /etc/hosts and redirect to the localhost)
261-
kubectl create -n keycloak-system -f - <<EOF
262-
apiVersion: networking.k8s.io/v1
263-
kind: Ingress
264-
metadata:
265-
name: keycloak
266-
spec:
267-
rules:
268-
- host: keycloak-internal.keycloak-system.svc
269-
http:
270-
paths:
271-
- backend:
272-
service:
273-
name: keycloak-internal
274-
port:
275-
number: 80
276-
path: /
277-
pathType: Prefix
278-
EOF
279-
shell: bash
280-
281224
- name: Add service hosts to /etc/hosts
282225
run: |
283226
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local keycloak-internal.keycloak-system.svc rekor-search-ui.local cli-server.local tsa-server.local" | sudo tee -a /etc/hosts
@@ -343,66 +286,12 @@ jobs:
343286
podman load -i /tmp/catalog-oci.tar
344287
345288
- name: Install Cluster
346-
uses: container-tools/kind-[email protected]
289+
uses: ./.github/actions/kind-cluster
347290
with:
348-
version: v0.20.0
349-
node_image: kindest/node:v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb
350-
cpu: 3
351-
registry: false
352291
config: ./ci/config.yaml
353-
354-
- name: Configure cluster
355-
run: |
356-
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
357-
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s
358-
359-
#install Prometheus
360-
LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)
361-
curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -
362-
kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default
363-
364-
#install OLM
365-
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/crds.yaml
366-
# wait for a while to be sure CRDs are installed
367-
sleep 1
368-
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/olm.yaml
369-
370-
kubectl create --kustomize ci/keycloak/operator/overlay/kind
371-
until [ ! -z "$(kubectl get pod -l name=keycloak-operator -n keycloak-system 2>/dev/null)" ]
372-
do
373-
echo "Waiting for keycloak operator. Pods in keycloak-system namespace:"
374-
kubectl get pods -n keycloak-system
375-
sleep 10
376-
done
377-
kubectl create --kustomize ci/keycloak/resources/overlay/kind
378-
until [[ $( oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]]
379-
do
380-
printf "Waiting for keycloak deployment. \n Keycloak ready: %s\n" $(oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system)
381-
sleep 10
382-
done
383-
384-
# HACK - expose keycloak under the same name as the internal SVC has so it will be accessible:
385-
# - within the cluster (where the localhost does not work)
386-
# - outside the cluster (resolved from /etc/hosts and redirect to the localhost)
387-
kubectl create -n keycloak-system -f - <<EOF
388-
apiVersion: networking.k8s.io/v1
389-
kind: Ingress
390-
metadata:
391-
name: keycloak
392-
spec:
393-
rules:
394-
- host: keycloak-internal.keycloak-system.svc
395-
http:
396-
paths:
397-
- backend:
398-
service:
399-
name: keycloak-internal
400-
port:
401-
number: 80
402-
path: /
403-
pathType: Prefix
404-
EOF
405-
shell: bash
292+
prometheus: 'true'
293+
keycloak: 'true'
294+
olm: 'true'
406295

407296
- name: Add service hosts to /etc/hosts
408297
run: |
@@ -467,20 +356,10 @@ jobs:
467356
run: podman load -i /tmp/operator-oci.tar
468357

469358
- name: Install Cluster
470-
uses: container-tools/kind-[email protected]
359+
uses: ./.github/actions/kind-cluster
471360
with:
472-
version: v0.20.0
473-
node_image: kindest/node:v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb
474-
cpu: 3
475-
registry: false
476361
config: ./ci/config.yaml
477362

478-
- name: Configure cluster
479-
run: |
480-
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
481-
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s
482-
shell: bash
483-
484363
- name: Add service hosts to /etc/hosts
485364
run: |
486365
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local rekor-search-ui.local cli-server.local" | sudo tee -a /etc/hosts
@@ -501,6 +380,99 @@ jobs:
501380
name: test-custom-install
502381
path: test/**/k8s-dump-*.tar.gz
503382

383+
test-e2e:
384+
name: Execute securesign/sigstore-e2e
385+
runs-on: ubuntu-24.04
386+
needs:
387+
- build-operator
388+
env:
389+
TEST_NAMESPACE: test
390+
steps:
391+
- name: Checkout source
392+
uses: actions/checkout@v4
393+
- name: Checkout test source repository
394+
uses: actions/checkout@v4
395+
with:
396+
repository: "securesign/sigstore-e2e"
397+
path: e2e
398+
399+
- name: Install Go
400+
uses: actions/setup-go@v5
401+
with:
402+
go-version: ${{ env.GO_VERSION }}
403+
404+
- name: Log in to registry.redhat.io
405+
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
406+
with:
407+
username: ${{ secrets.REGISTRY_USER }}
408+
password: ${{ secrets.REGISTRY_PASSWORD }}
409+
registry: registry.redhat.io
410+
auth_file_path: /tmp/config.json
411+
412+
- name: Image prune
413+
run: podman image prune -af
414+
415+
- name: Download artifact
416+
uses: actions/download-artifact@v4
417+
with:
418+
pattern: "*-image"
419+
merge-multiple: true
420+
path: /tmp
421+
422+
- name: Load images
423+
run: |
424+
podman load -i /tmp/operator-oci.tar
425+
426+
- name: Install Cluster
427+
id: kind
428+
uses: ./.github/actions/kind-cluster
429+
with:
430+
config: ./ci/config.yaml
431+
keycloak: 'true'
432+
olm: 'true'
433+
prometheus: 'true'
434+
435+
- name: Add service hosts to /etc/hosts
436+
run: |
437+
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local rekor-search-ui.local cli-server.local" | sudo tee -a /etc/hosts
438+
439+
- name: Deploy operator container
440+
env:
441+
OPENSHIFT: false
442+
run: make deploy
443+
444+
- name: Wait for operator to be ready
445+
run: |
446+
kubectl wait --for=condition=available deployment/rhtas-operator-controller-manager --timeout=120s -n openshift-rhtas-operator
447+
448+
- name: Install securesign
449+
run: |
450+
sed -i 's#https://your-oidc-issuer-url#${{ steps.kind.outputs.oidc_url }}#' config/samples/rhtas_v1alpha1_securesign.yaml
451+
sed -i 's#rhtas.redhat.com/metrics: "true"#rhtas.redhat.com/metrics: "false"#' config/samples/rhtas_v1alpha1_securesign.yaml
452+
kubectl create ns ${{ env.TEST_NAMESPACE }}
453+
kubectl create -f config/samples/rhtas_v1alpha1_securesign.yaml -n ${{ env.TEST_NAMESPACE }}
454+
sleep 1
455+
kubectl wait --for=condition=Ready securesign/securesign-sample -n ${{ env.TEST_NAMESPACE }}
456+
457+
- name: Run tests
458+
run: |
459+
export SIGSTORE_OIDC_ISSUER=${{ steps.kind.outputs.oidc_url }}
460+
export FULCIO_URL=$(kubectl get securesign -o jsonpath='{.items[0].status.fulcio.url}' -n ${{ env.TEST_NAMESPACE }})
461+
export REKOR_URL=$(kubectl get securesign -o jsonpath='{.items[0].status.rekor.url}' -n ${{ env.TEST_NAMESPACE }})
462+
export TUF_URL=$(kubectl get securesign -o jsonpath='{.items[0].status.tuf.url}' -n ${{ env.TEST_NAMESPACE }})
463+
export TSA_URL=$(kubectl get securesign -o jsonpath='{.items[0].status.tsa.url}' -n ${{ env.TEST_NAMESPACE }})
464+
465+
export CLI_STRATEGY=cli_server
466+
export CLI_SERVER_URL="http://cli-server.local"
467+
468+
cd e2e
469+
go test -v ./test/...
470+
471+
- name: dump the logs of the operator
472+
run: |
473+
kubectl logs -n openshift-rhtas-operator deployment/rhtas-operator-controller-manager
474+
if: failure()
475+
504476
test-eks:
505477
name: Test EKS deployment
506478
runs-on: ubuntu-20.04

0 commit comments

Comments
 (0)