Skip to content

feat(CU-8695egu2z)!: update workerpool controller (#82) #45

feat(CU-8695egu2z)!: update workerpool controller (#82)

feat(CU-8695egu2z)!: update workerpool controller (#82) #45

name: Production chart publish
on:
push:
tags:
- "v*"
concurrency:
group: ${{ github.ref }}-chart-publish-prod
jobs:
registry:
name: Publish the Helm chart to the Helm repository
runs-on: ubuntu-latest
env:
HELM_VERSION: "3.7.1"
permissions:
id-token: write
contents: read
steps:
- name: Check out repository code
uses: actions/checkout@main
- name: Install Helm
run: |
curl -s https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz -o helm-v${HELM_VERSION}-linux-amd64.tar.gz
tar -zxf helm-v${HELM_VERSION}-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin
rm helm-v${HELM_VERSION}-linux-amd64.tar.gz
rm -rf linux-amd64
- name: Install Helm S3 Plugin
run: helm plugin install https://github.com/hypnoglow/helm-s3.git
- name: Create output directory for Spacelift PromEx Chart
run: mkdir -p build/chart/spacelift-promex
- name: Create output directory for Spacelift Worker Pool Chart
run: mkdir -p build/chart/worker-pool
- name: Create output directory for Spacelift VCS Agent Chart
run: mkdir -p build/chart/vcs-agent
- name: Create output directory for spacelift-workerpool-controller Chart
run: mkdir -p build/chart/spacelift-workerpool-controller
- name: Create output directory for spacelift-operator Chart
run: mkdir -p build/chart/spacelift-operator
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 900
- name: Add the Spacelift Helm registry
run: helm repo add spacelift s3://${{ secrets.AWS_S3_BUCKET }}/helm
# The first time this step runs the index file won't exist, so allow the step to fail
continue-on-error: true
- name: Set chart version number
run: |
if [[ $GITHUB_REF_NAME != v* ]]; then
echo "Tag does not look like a valid version: $GITHUB_REF_NAME"
exit 1
fi
echo "CHART_VERSION=${GITHUB_REF_NAME:1}" >> $GITHUB_ENV
- name: Lint Spacelift PromEx chart
run: helm lint spacelift-promex/
- name: Lint Spacelift Worker Pool chart
run: |
helm dependency update spacelift-workerpool-controller/
helm lint spacelift-worker-pool/
- name: Lint Spacelift VCS Agent chart
run: helm lint vcs-agent/
- name: Lint spacelift-workerpool-controller chart
run: helm lint spacelift-workerpool-controller/
- name: Lint spacelift-operator chart
run: helm lint spacelift-operator/
- name: Package Spacelift PromEx chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/spacelift-promex spacelift-promex/
helm s3 push --force --relative build/chart/spacelift-promex/spacelift-promex-${CHART_VERSION}.tgz spacelift
- name: Package Spacelift Worker Pool chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/worker-pool spacelift-worker-pool/
helm s3 push --force --relative build/chart/worker-pool/spacelift-worker-${CHART_VERSION}.tgz spacelift
- name: Package Spacelift VCS Agent chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/vcs-agent vcs-agent/
helm s3 push --force --relative build/chart/vcs-agent/vcs-agent-${CHART_VERSION}.tgz spacelift
- name: Package spacelift-workerpool-controller chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/spacelift-workerpool-controller/ spacelift-workerpool-controller
helm s3 push --force --relative build/chart/spacelift-workerpool-controller/spacelift-workerpool-controller-${CHART_VERSION}.tgz spacelift
- name: Package spacelift-operator chart
run: |
helm package --version "$CHART_VERSION" --destination build/chart/spacelift-operator/ spacelift-operator
helm s3 push --force --relative build/chart/spacelift-operator/spacelift-operator-${CHART_VERSION}.tgz spacelift
- name: Invalidate cache
run: >-
aws cloudfront create-invalidation
--distribution-id ${{ secrets.DISTRIBUTION }}
--paths "/helm/*"
test-new-version:
name: Test that the new chart version can be pulled
runs-on: ubuntu-latest
needs: [registry]
env:
HELM_VERSION: "3.7.1"
steps:
- name: Install Helm
run: |
curl -s https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz -o helm-v${HELM_VERSION}-linux-amd64.tar.gz
tar -zxf helm-v${HELM_VERSION}-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin
rm helm-v${HELM_VERSION}-linux-amd64.tar.gz
rm -rf linux-amd64
- name: Pull chart
run: |
helm repo add spacelift https://downloads.spacelift.io/helm
helm repo update
helm pull spacelift/spacelift-promex
helm pull spacelift/spacelift-worker
helm pull spacelift/vcs-agent
helm pull spacelift/spacelift-workerpool-controller
helm pull spacelift/spacelift-operator