-
Notifications
You must be signed in to change notification settings - Fork 16
166 lines (135 loc) · 6.54 KB
/
gitops_update.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
name: gitops_update
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
REPOSITORY_OWNER: wkspower
WEBSOCKET_ENABLED: true
TOPIC_CASE_CREATE: case-create
TOPIC_CREATE_HUMAN_TASK: human-task-create
NOVU_ENABLED: true
KEYCLOAK_URL_LOCAL: http://login.wkspower.local
WKS_API_URL_LOCAL: http://api.wkspower.local
WKS_STORAGE_API_URL_LOCAL: http://api.wkspower.local/storage
WEBSOCKET_URL_LOCAL: ws://ws.wkspower.local
NOVU_PUBLISHER_API_URL_LOCAL: http://novu.wkspower.local
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up jdk 18
uses: actions/setup-java@v3
with:
java-version: "18"
distribution: "temurin"
- name: Set up maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.2
- name: Install dependencies for case-portal
run: yarn --cwd apps/react/case-portal install
- name: Build for case-portal
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: |
export REACT_APP_KEYCLOAK_URL="${{ env.KEYCLOAK_URL_LOCAL }}"
export REACT_APP_API_URL="${{ env.WKS_API_URL_LOCAL }}"
export REACT_APP_STORAGE_URL="${{ env.WKS_STORAGE_API_URL_LOCAL }}"
export REACT_APP_WEBSOCKETS_ENABLED="${{ env.WEBSOCKET_ENABLED }}"
export REACT_APP_WEBSOCKETS_URL="${{ env.WEBSOCKET_URL_LOCAL }}"
export REACT_APP_WEBSOCKETS_CASE_CREATED="${{ env.TOPIC_CASE_CREATE }}"
export REACT_APP_WEBSOCKETS_HUMAN_TASK_CREATED="${{ env.TOPIC_CREATE_HUMAN_TASK }}"
export REACT_APP_NOVU_ENABLED="${{ env.NOVU_ENABLED }}"
export REACT_APP_NOVU_PUBLISHER_API_URL="${{ env.NOVU_PUBLISHER_API_URL_LOCAL }}"
yarn --cwd apps/react/case-portal build
- name: Extract tag name
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})"
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image for case-portal
uses: docker/build-push-action@v2
with:
context: ./apps/react/case-portal
platforms: linux/amd64,linux/arm64
file: apps/react/case-portal/deployments/Dockerfile
push: true
tags: "${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-portal-local:${{ steps.extract_tag.outputs.tag }}"
deploy:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
repository: wkspower/wks-gitops
path: wks-gitops
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag name
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})"
- uses: supplypike/setup-bin@v3
with:
uri: 'https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.0.0/kustomize_v5.0.0_linux_amd64.tar.gz'
name: 'kustomize'
version: '5.0.0'
- name: Update kubernetes resources with new tag to Local Environment
run: |
cd wks-gitops/apps
cd opa/local
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/opa=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/opa:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd case-engine-rest-api/local
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-engine-rest-api=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-engine-rest-api:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd demo-data-loader/local
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/demo-data-loader=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/demo-data-loader:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd c7-external-tasks/local
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/c7-external-tasks=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/c7-external-tasks:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd case-portal/local
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-portal-local=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-portal-local:${{ steps.extract_tag.outputs.tag }}
cd ../../
- name: Update kubernetes resources with new tag to Staging Environment
run: |
cd wks-gitops/apps
cd storage-api/staging
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/storage-api=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/storage-api:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd opa/staging
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/opa=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/opa:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd case-engine-rest-api/staging
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-engine-rest-api=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-engine-rest-api:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd demo-data-loader/staging
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/demo-data-loader=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/demo-data-loader:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd c7-external-tasks/staging
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/c7-external-tasks=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/c7-external-tasks:${{ steps.extract_tag.outputs.tag }}
cd ../../
cd case-portal-client/staging
kustomize edit set image ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-portal-local=${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/case-portal-local:${{ steps.extract_tag.outputs.tag }}
cd ../../
- name: New tag release for continuous delivery
run: |
cd wks-gitops
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Release docker tag"
git push