-
Notifications
You must be signed in to change notification settings - Fork 23
193 lines (163 loc) · 6.45 KB
/
main-build.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: main build
on:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write # needed for signing the images with GitHub OIDC Token **not production ready**
container: ghcr.io/kedacore/keda-tools:1.22.2
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 1
lfs: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Go modules cache
uses: actions/cache@v4
with:
path: /go/pkg
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# Username used to log in to a Docker registry. If not set then no login will occur
username: ${{ github.repository_owner }}
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur
password: ${{ secrets.GHCR_AUTH_PAT }}
# Server address of Docker registry. If not set then will default to Docker Hub
registry: ghcr.io
- name: Publish on GitHub Container Registry
run: make publish
# https://github.com/sigstore/cosign-installer
- name: Install Cosign
uses: sigstore/cosign-installer@v2
- name: Check Cosign install!
run: cosign version
- name: Sign KEDA images published on GitHub Container Registry
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: make sign-images
deploy-test:
needs: Build
name: Deploy-test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 1
lfs: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# Username used to log in to a Docker registry. If not set then no login will occur
username: ${{ github.repository_owner }}
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur
password: ${{ secrets.GHCR_AUTH_PAT }}
# Server address of Docker registry. If not set then will default to Docker Hub
registry: ghcr.io
# homebrew (+ gcc etc.) removed from $PATH on Ubuntu images.
# https://github.com/actions/runner-images/issues/6283
- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Setup Env
run: sudo apt-get install gcc-11 g++ binutils libc6
- name: Install operator-sdk
run: brew install operator-sdk
- name: Download opm
run: |
version=1.26.1
curl -L https://github.com/operator-framework/operator-registry/releases/download/v${version}/linux-amd64-opm --output opm
sudo chmod +x opm
sudo mv opm /usr/bin
- name: Run functionality tests
run: make test-functionality
- name: Run audit flags tests
run: make test-audit
- name: Setup test environment for deployment tests
run: |
kind create cluster
OLM_VERSION=$(curl -s https://api.github.com/repos/operator-framework/operator-lifecycle-manager/releases/latest | jq -r .tag_name)
curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/$OLM_VERSION/install.sh -o install.sh
chmod +x install.sh
./install.sh $OLM_VERSION
- name: Build and deploy KEDA olm operator index for deployment testing
run: |
kubectl create namespace keda
make deploy-olm-testing
- name: Run deployment tests
run: make test-deployment
deploy:
needs: Deploy-test
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 1
lfs: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Go modules cache
uses: actions/cache@v4
with:
path: /go/pkg
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# Username used to log in to a Docker registry. If not set then no login will occur
username: ${{ github.repository_owner }}
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur
password: ${{ secrets.GHCR_AUTH_PAT }}
# Server address of Docker registry. If not set then will default to Docker Hub
registry: ghcr.io
- name: Download opm
run: |
version=1.26.1
curl -L https://github.com/operator-framework/operator-registry/releases/download/v${version}/linux-amd64-opm --output opm
sudo chmod +x opm
sudo mv opm /usr/bin
# homebrew (+ gcc etc.) removed from $PATH on Ubuntu images.
# https://github.com/actions/runner-images/issues/6283
- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Setup Env
run: sudo apt-get install gcc-11 g++ binutils libc6
- name: Install operator-sdk
run: brew install operator-sdk
- name: Setup cluster and olm
run: |
kind create cluster
OLM_VERSION=$(curl -s https://api.github.com/repos/operator-framework/operator-lifecycle-manager/releases/latest | jq -r .tag_name)
curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/$OLM_VERSION/install.sh -o install.sh
chmod +x install.sh
./install.sh $OLM_VERSION
- name: Disable 'replaces' field, as the testing bundle doesn't replace anything
run: |
sed -i 's/replaces: /# replaces: /' bundle/manifests/keda.clusterserviceversion.yaml
- name: Build and deploy KEDA olm operator index
run: |
kubectl create namespace keda
make deploy-olm