Claudie v0.9.0 #40
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |