-
Notifications
You must be signed in to change notification settings - Fork 13
218 lines (191 loc) · 7.63 KB
/
integration.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Build
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
types: [ opened, reopened, synchronize ]
jobs:
build-api:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Image Tag Env
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Cache Maven Packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Build and Test
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_ORG: ${{secrets.SONAR_ORG}}
SONAR_PROJECT: ${{secrets.SONAR_PROJECT}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
run: |
#
# Set write-transformed-bytecode-to-build-output for IT coverage. Do NOT use the container image
# created by this step.
#
# See: https://quarkus.io/guides/tests-with-coverage#coverage-for-integration-tests
#
export QUARKUS_CONTAINER_IMAGE_REGISTRY="localhost:5000"
export QUARKUS_CONTAINER_IMAGE_PUSH=true
export QUARKUS_CONTAINER_IMAGE_TAG="${{ env.PROJECT_VERSION }}"
export QUARKUS_KUBERNETES_VERSION="${{ env.PROJECT_VERSION }}"
mvn verify -P container-image -B --no-transfer-progress \
-Dquarkus.kubernetes.namespace='$${NAMESPACE}' \
-Dquarkus.package.write-transformed-bytecode-to-build-output=true \
-Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64
- name: Modify CSV Annotation
run: ./operator/bin/modify-bundle-metadata.sh "SKIP_RANGE=>=0.0.1 <${{ env.PROJECT_VERSION }}"
- name: Build Operator Bundle Image
uses: docker/build-push-action@v6
with:
context: operator/target/bundle/console-operator/
platforms: linux/amd64,linux/arm64
provenance: false
push: true
file: operator/target/bundle/console-operator/bundle.Dockerfile
tags: |
localhost:5000/streamshub/console-operator-bundle:${{ env.PROJECT_VERSION }}
- name: Build Operator Catalog
run: |
curl -L -o opm https://github.com/operator-framework/operator-registry/releases/download/v1.43.1/linux-amd64-opm
chmod +x opm
sudo cp -v opm /usr/bin/
rm -vf opm
operator/bin/generate-catalog.sh ${{ env.PROJECT_VERSION }}
- name: Build Operator Catalog Image
uses: docker/build-push-action@v6
with:
context: operator/target/
platforms: linux/amd64,linux/arm64
provenance: false
push: true
file: operator/target/catalog.Dockerfile
tags: |
localhost:5000/streamshub/console-operator-catalog:${{ env.PROJECT_VERSION }}
- name: Attach Kubernetes Resources
uses: actions/upload-artifact@v4
with:
name: k8s-resources
path: |
operator/target/bundle/
operator/target/catalog/
operator/target/kubernetes/*.yml
- name: Archive Results
uses: actions/upload-artifact@v4
if: failure()
with:
name: artifacts
path: api/target/failsafe-reports/
## Save the context information for use in Sonar analysis
- name: Save Build Context
run: |
mkdir -vp target
echo "$GITHUB_CONTEXT" > target/build-context.json
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
## Attach the target directory for use in Sonar analysis
- name: Attach Build Output
uses: actions/upload-artifact@v4
with:
name: target
path: |
**/target/
!**/target/**/*.jar
!**/target/failsafe-reports/**/*
!**/target/surefire-reports/**/*
- name: Save Images
run: |
docker pull localhost:5000/streamshub/console-api:${{ env.PROJECT_VERSION }}
docker pull localhost:5000/streamshub/console-operator:${{ env.PROJECT_VERSION }}
docker pull localhost:5000/streamshub/console-operator-bundle:${{ env.PROJECT_VERSION }}
docker pull localhost:5000/streamshub/console-operator-catalog:${{ env.PROJECT_VERSION }}
docker save -o console-api-${{ env.PROJECT_VERSION }}.tar localhost:5000/streamshub/console-api:${{ env.PROJECT_VERSION }}
docker save -o console-operator-${{ env.PROJECT_VERSION }}.tar localhost:5000/streamshub/console-operator:${{ env.PROJECT_VERSION }}
docker save -o console-operator-bundle-${{ env.PROJECT_VERSION }}.tar localhost:5000/streamshub/console-operator-bundle:${{ env.PROJECT_VERSION }}
docker save -o console-operator-catalog-${{ env.PROJECT_VERSION }}.tar localhost:5000/streamshub/console-operator-catalog:${{ env.PROJECT_VERSION }}
- name: Archive Images
uses: actions/upload-artifact@v4
with:
name: backend-images
path: |
console-api-${{ env.PROJECT_VERSION }}.tar
console-operator-${{ env.PROJECT_VERSION }}.tar
console-operator-bundle-${{ env.PROJECT_VERSION }}.tar
console-operator-catalog-${{ env.PROJECT_VERSION }}.tar
build-ui:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Image Tag Env
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Build UI
working-directory: ui
run: |
npm ci --omit=dev
export BACKEND_URL=http://example
export CONSOLE_METRICS_PROMETHEUS_URL=http://example
export NEXTAUTH_SECRET=examplesecret
export LOG_LEVEL=info
export CONSOLE_MODE=read-only
npm run build
- name: Build UI Image
uses: docker/build-push-action@v6
with:
context: ui/
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
localhost:5000/streamshub/console-ui:${{ env.PROJECT_VERSION }}
- name: Save Image
run: |
docker pull localhost:5000/streamshub/console-ui:${{ env.PROJECT_VERSION }}
docker save -o console-ui-${{ env.PROJECT_VERSION }}.tar localhost:5000/streamshub/console-ui:${{ env.PROJECT_VERSION }}
- name: Archive Image
uses: actions/upload-artifact@v4
with:
name: frontend-images
path: |
console-ui-${{ env.PROJECT_VERSION }}.tar
Playwright:
if: ${{ contains(github.event.pull_request.labels.*.name, 'safe to test') || github.repository == 'streamshub/console' }}
uses: ./.github/workflows/playwright-tests.yml
needs:
- build-api
- build-ui