-
Notifications
You must be signed in to change notification settings - Fork 40
135 lines (116 loc) · 4.68 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Release pipeline
on:
# Run when release is published
release:
types: [ published ]
env:
SERVICES: manager builder terraformer ansibler kube-eleven kuber claudie-operator autoscaler-adapter
jobs:
build-and-publish:
name: Create a new release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
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@v3
- 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@v3
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@v3
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 -i "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
#--------------------------------------------------------------------------------------------------
create-issue:
name: Create Claudie upgrade issue in infra
# the action has been tested only on ubuntu-latest https://github.com/marketplace/actions/create-github-issue#usage
runs-on: ubuntu-latest
needs: build-and-publish
steps:
- uses: actions/checkout@v4
- uses: dacbd/create-issue-action@v2
with:
token: ${{ secrets.GH_ISSUES_TOKEN }}
org: berops
repo: infra
title: Upgrade Claudie version on mgmt cluster
labels: chore
body: |
The Claudie version on our `mgmt` cluster should be upgraded due to new release.