-
Notifications
You must be signed in to change notification settings - Fork 15
145 lines (128 loc) · 5.59 KB
/
snapshot.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
name: Publish Snapshot
on:
push:
branches:
- 'main'
- '[0-9]+.[0-9]+.x'
paths-ignore:
- '.github/project.yml'
jobs:
release:
runs-on: ubuntu-latest
name: snapshot
env:
PLATFORMS: linux/amd64,linux/arm64,linux/ppc64le
steps:
# ==================== Setup ====================
- name: Checkout
uses: actions/checkout@v4
- name: Retrieve Project Metadata
uses: radcortez/project-metadata-action@603060a0627d4f04d37d20331ebd472377fd088b
id: metadata
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yml'
local-file: 'true'
- name: Set Image Tag Env
run: echo "NEXT_VERSION=$(echo ${{steps.metadata.outputs.next-version}} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Setup JDK
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
- name: Login to Quay
uses: docker/login-action@v3
with:
registry: "${{ secrets.IMAGE_REPO_HOSTNAME }}"
username: "${{ secrets.IMAGE_REPO_USERNAME }}"
password: "${{ secrets.IMAGE_REPO_PASSWORD }}"
# ==================== UI ====================
- name: Build UI
working-directory: ui
run: |
npm ci --omit=dev
export BACKEND_URL=http://example
export NEXTAUTH_SECRET=examplesecret
export LOG_LEVEL=info
export CONSOLE_MODE=read-only
npm run build
- name: Build and Push UI Image
uses: docker/build-push-action@v6
with:
context: ui/
platforms: ${{ env.PLATFORMS }}
provenance: false
push: true
tags: |
${{ secrets.IMAGE_REPO_HOSTNAME }}/${{ secrets.IMAGE_REPO_NAMESPACE }}/console-ui:${{ env.NEXT_VERSION }}
${{ secrets.IMAGE_REPO_HOSTNAME }}/${{ secrets.IMAGE_REPO_NAMESPACE }}/console-ui:snapshot-${{github.ref_name}}
# ==================== API & Operator ====================
- name: Build and Push API and Operator Image
run: |
export QUARKUS_CONTAINER_IMAGE_REGISTRY="${{ secrets.IMAGE_REPO_HOSTNAME }}"
export QUARKUS_CONTAINER_IMAGE_GROUP="${{ secrets.IMAGE_REPO_NAMESPACE }}"
export QUARKUS_CONTAINER_IMAGE_USERNAME="${{ secrets.IMAGE_REPO_USERNAME }}"
export QUARKUS_CONTAINER_IMAGE_PASSWORD="${{ secrets.IMAGE_REPO_PASSWORD }}"
export QUARKUS_CONTAINER_IMAGE_PUSH="true"
export QUARKUS_CONTAINER_IMAGE_TAG="${{ env.NEXT_VERSION }}"
export QUARKUS_CONTAINER_IMAGE_ADDITIONAL_TAGS=snapshot-${{github.ref_name}}
export QUARKUS_KUBERNETES_VERSION="${{ env.NEXT_VERSION }}"
export GIT_REVISION=$(git rev-parse --short HEAD)
# Build and push the snapshot images
mvn -B -P container-image verify --no-transfer-progress -DskipTests \
-Dquarkus.kubernetes.namespace='$${NAMESPACE}' \
-Dquarkus.docker.buildx.platform=${{ env.PLATFORMS }}
# ==================== Operator-Bundle ====================
- name: Modify Bundle CSV Metadata
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{ env.NEXT_VERSION }}" "SKIP_RANGE=>=0.0.1 <${{ env.NEXT_VERSION }}"
- name: Build and Push Operator Bundle Image
uses: docker/build-push-action@v6
with:
context: operator/target/bundle/streamshub-console-operator/
platforms: ${{ env.PLATFORMS }}
provenance: false
push: true
file: operator/target/bundle/streamshub-console-operator/bundle.Dockerfile
tags: |
${{ secrets.IMAGE_REPO_HOSTNAME }}/${{ secrets.IMAGE_REPO_NAMESPACE }}/console-operator-bundle:${{ env.NEXT_VERSION }}
${{ secrets.IMAGE_REPO_HOSTNAME }}/${{ secrets.IMAGE_REPO_NAMESPACE }}/console-operator-bundle:snapshot-${{github.ref_name}}
# ==================== Operator-Catalog ====================
- name: Generate Operator Catalog Config
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.NEXT_VERSION }}
- name: Build and Push Operator Catalog Image
uses: docker/build-push-action@v6
with:
context: operator/target/
platforms: ${{ env.PLATFORMS }}
network: none
provenance: false
push: true
file: operator/target/catalog.Dockerfile
tags: |
${{ secrets.IMAGE_REPO_HOSTNAME }}/${{ secrets.IMAGE_REPO_NAMESPACE }}/console-operator-catalog:${{ env.NEXT_VERSION }}
${{ secrets.IMAGE_REPO_HOSTNAME }}/${{ secrets.IMAGE_REPO_NAMESPACE }}/console-operator-catalog:snapshot-${{github.ref_name}}
# ==================== Archive artifacts ====================
- name: Attach Kubernetes Resources
uses: actions/upload-artifact@v4
with:
name: k8s-resources
path: |
operator/target/bundle/
operator/target/catalog/
operator/target/kubernetes/*.yml