-
Notifications
You must be signed in to change notification settings - Fork 40
117 lines (99 loc) · 3.96 KB
/
release.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
name: Release pipeline
on:
# Run when release is published
release:
types: [ published ]
env:
SERVICES: context-box scheduler builder terraformer ansibler kube-eleven kuber claudie-operator
jobs:
build-and-publish:
name: Create a new release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set release tag
run: |
R=${GITHUB_REF#"refs/tags/"}
echo "RELEASE=$R" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Create and use docker context
run: |
docker context create claudie
docker context use claudie
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: claudie
- name: Install kustomize
uses: imranismail/setup-kustomize@v2
with:
kustomize-version: 4.5.6
- name: Set up docker
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Update autoscaler-adapter manifest in this steps as new kuber would need to contain manifest with the correct image tag
- name: Edit autoscaler-adapter image tag in the manifest
run: |
TAG=${RELEASE}
sed "s/image: ghcr.io\/berops\/claudie\/autoscaler-adapter/&:$TAG/" services/kuber/templates/cluster-autoscaler.goyaml
# Remove autoscaler-adapter tag from claudie kustomization.yaml
awk '/autoscaler-adapter/{getline; next} 1' manifests/claudie/kustomization.yaml > temp.yaml && mv temp.yaml manifests/claudie/kustomization.yaml
- name: Build and push new images
run: |
ARR=( ${{ env.SERVICES }} )
for SERVICE in "${ARR[@]}"
do
echo "-----Building $SERVICE-----"
IMGTAG="ghcr.io/berops/claudie/$SERVICE:${RELEASE}"
DOCKER_BUILDKIT=1 docker buildx build --push --platform linux/amd64,linux/arm64 --tag $IMGTAG -f ./services/$SERVICE/Dockerfile .
done
- name: Set new image & tag to manifests
working-directory: manifests/claudie
run: |
ARR=( ${{ env.SERVICES }} )
for SERVICE in "${ARR[@]}"
do
kustomize edit set image ghcr.io/berops/claudie/$SERVICE:${RELEASE}
done
- name: Create claudie.yaml file from manifests
run: |
kustomize build manifests/claudie > claudie.yaml
- name: Add claudie.yaml checksum
run: |
sha256sum claudie.yaml >> claudie_checksum.txt
- name: Add network policies checksum
run: |
sha256sum manifests/network-policies/network-policy.yaml >> claudie_checksum.txt
sha256sum manifests/network-policies/network-policy-cilium.yaml >> claudie_checksum.txt
- name: Add claudie manifest to the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: claudie.yaml
- name: Add network-policy manifest to the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: manifests/network-policies/network-policy.yaml
asset_name: network-policy.yaml
- name: Add cilium-network-policy manifest to the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: manifests/network-policies/network-policy-cilium.yaml
asset_name: network-policy-cilium.yaml
- name: Add claudie checksums file to the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: claudie_checksum.txt