-
Notifications
You must be signed in to change notification settings - Fork 8
135 lines (115 loc) · 5.26 KB
/
e2e_openssl.yml
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
133
134
135
name: E2E Test OpenSSL
on:
workflow_dispatch:
inputs:
use_release_cli:
description: Use a release version of the Nunki CLI
required: false
type: boolean
env:
container_registry: ghcr.io/edgelesssys
azure_resource_group: nunki-ci
jobs:
test:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install Nix
uses: cachix/install-nix-action@6004951b182f8860210c8d6f0d808ec5b1a33d28 # v25
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Use Nix Cache
uses: cachix/cachix-action@18cf96c7c98e048e10a83abd92116114cd8504be # v14
with:
name: edgelesssys
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
installCommand: nix profile install github:cachix/cachix/cd12acd9245ac9b7e010aa3acac49f37824fdad2 --accept-flake-config # remove on v14.1/v15
- name: Log in to ghcr.io Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Azure
uses: azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d # v1.6.1
with:
creds: ${{ secrets.NUNKI_CI_INFRA_AZURE }}
- name: Enter Nix development environment
uses: nicknovitski/nix-develop@a2060d116a50b36dfab02280af558e73ab52427d # v1.1.0
- name: Create justfile.env
run: |
cat <<EOF > justfile.env
container_registry=${{ env.container_registry }}
azure_resource_group=${{ env.azure_resource_group }}
EOF
- name: Get Credentials for CI Cluster
run: |
just get-credentials
- name: Download Nunki CLI
if: ${{ inputs.use_release_cli }}
shell: bash
run: |
curl -fLo nunki https://github.com/edgelesssys/nunki/releases/download/latest/nunki
- name: Build Nunki CLI
if: ${{ !inputs.use_release_cli }}
run: |
nix build .#cli
ln -s result-cli/bin/nunki nunki
- name: Build Containers and Template the Deployment
shell: bash
run: |
COORDINATOR_IMAGE=$(just coordinator | tail -1)
INITIALIZER_IMAGE=$(just initializer | tail -1)
OPENSSL_IMAGE=$(just openssl | tail -1)
yq eval -i "(select(document_index == 0) | .spec.template.spec.containers[0].image) = \"$COORDINATOR_IMAGE\"" e2e/openssl/deployment/coordinator.yml
# Unfortunately, yq doesn't allow us to update multiple files at once
yq eval -i "(select(document_index == 0) | .spec.template.spec.containers[0].image) = \"$OPENSSL_IMAGE\"" e2e/openssl/deployment/openssl-backend.yml
yq eval -i "(select(document_index == 0) | .spec.template.spec.initContainers[0].image) = \"$INITIALIZER_IMAGE\"" e2e/openssl/deployment/openssl-backend.yml
yq eval -i "(select(document_index == 0) | .spec.template.spec.containers[0].image) = \"$OPENSSL_IMAGE\"" e2e/openssl/deployment/openssl-frontend.yml
yq eval -i "(select(document_index == 0) | .spec.template.spec.initContainers[0].image) = \"$INITIALIZER_IMAGE\"" e2e/openssl/deployment/openssl-frontend.yml
yq eval -i "(select(document_index == 0) | .spec.template.spec.containers[0].image) = \"$OPENSSL_IMAGE\"" e2e/openssl/deployment/openssl-client.yml
yq eval -i "(select(document_index == 0) | .spec.template.spec.initContainers[0].image) = \"$INITIALIZER_IMAGE\"" e2e/openssl/deployment/openssl-client.yml
- name: Generate Policies
shell: bash
run: |
./nunki generate e2e/openssl/deployment/*.yml
- name: Deploy
shell: bash
run: |
kubectl apply -f e2e/openssl/deployment/ns.yml
kubectl apply -f e2e/openssl/deployment
- name: Set Manifest
shell: bash
run : |
nix run .#kubectl-wait-ready -- e2e-test coordinator
nix run .#kubectl-wait-ready -- e2e-test port-forwarder-coordinator
kubectl -n e2e-test port-forward pod/port-forwarder-coordinator 1313 &
PID=$!
nix run .#wait-for-port-listen -- 1313
./nunki set -c localhost:1313 -m manifest.json e2e/openssl/deployment
kill $PID
- name: Verify the Coordinator
shell: bash
run: |
nix run .#kubectl-wait-ready -- e2e-test coordinator
nix run .#kubectl-wait-ready -- e2e-test port-forwarder-coordinator
kubectl -n e2e-test port-forward pod/port-forwarder-coordinator 1313 &
PID=$!
nix run .#wait-for-port-listen -- 1313
./nunki verify -c localhost:1313 -o ./verify
kill $PID
- name: Run E2E Test
shell: bash
run: |
nix run .#kubectl-wait-ready -- e2e-test openssl-frontend
nix run .#kubectl-wait-ready -- e2e-test openssl-backend
nix run .#kubectl-wait-ready -- e2e-test openssl-client
go test -v -count=1 -timeout 10m --tags=e2e ./e2e/openssl
- name: Undeploy
if: always()
run: |
kubectl delete -f e2e/openssl/deployment/ns.yml