Skip to content

[CI] Publish inframold charts (#838) #28

[CI] Publish inframold charts (#838)

[CI] Publish inframold charts (#838) #28

name: Publish inframold to S3
on:
push:
branches:
- main
paths:
- '.github/workflows/publish-app-catalogue.yaml'
- 'charts/tfy-k8s-aws-eks-inframold/**'
- 'charts/tfy-k8s-azure-aks-inframold/**'
- 'charts/tfy-k8s-civo-talos-inframold/**'
- 'charts/tfy-k8s-gcp-gke-standard-inframold/**'
- 'charts/tfy-k8s-generic-inframold/**'
env:
AWS_S3_BUCKET: 'tfy-argo-application-catalogue'
RELEASES_SERVER_URL: ${{ secrets.RELEASES_SERVER_URL }}
RELEASES_SERVER_API_KEY: ${{ secrets.RELEASES_SERVER_API_KEY }}
jobs:
publish_release_and_sync_to_s3:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/release-updater/requirements.txt
- name: Run release-updater script
run: |
python scripts/release-updater/release-updater.py --url ${{ env.RELEASES_SERVER_URL }} --api-key ${{ env.RELEASES_SERVER_API_KEY }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.APP_CATALOGUE_S3_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.APP_CATALOGUE_S3_SECRET_KEY }}
aws-region: 'eu-west-1' # optional: defaults to us-east-1
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.9.2
- name: Set up Python 3.10 (needed for cookiecutter cli)
uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: |
echo "Installing cookiecutter"
python -m pip install --upgrade pip
pip install cookiecutter==2.1.1
cookiecutter --version
- run: |
echo "Render AWS-EKS manifests"
helm template inframold -n argocd -f ./charts/tfy-k8s-aws-eks-inframold/values-helm.yaml -f ./charts/tfy-k8s-aws-eks-inframold/values-ocli.yaml ./charts/tfy-k8s-aws-eks-inframold --set aws.karpenter.defaultZones={""} --output-dir catalogues
# Get the version of the truefoundry helm chart
cp_chart_version=$(yq e '.spec.source.targetRevision' ./catalogues/tfy-k8s-aws-eks-inframold/templates/truefoundry.yaml)
# Sync to S3
aws s3 sync ./catalogues/tfy-k8s-aws-eks-inframold/templates s3://tfy-argo-application-catalogue/aws-eks/templates --delete
# Sync to S3 chart version folder
aws s3 sync ./catalogues/tfy-k8s-aws-eks-inframold/templates s3://tfy-argo-application-catalogue/aws-eks/$cp_chart_version/templates --delete
echo "Synced catalogue for aws-eks successfully"
- run: |
echo "Render GCP standard k8s manifests"
helm template inframold -n argocd -f ./charts/tfy-k8s-gcp-gke-standard-inframold/values-helm.yaml -f ./charts/tfy-k8s-gcp-gke-standard-inframold/values-ocli.yaml ./charts/tfy-k8s-gcp-gke-standard-inframold --output-dir catalogues
# Get the version of the truefoundry helm chart
cp_chart_version=$(yq e '.spec.source.targetRevision' ./catalogues/tfy-k8s-gcp-gke-standard-inframold/templates/truefoundry.yaml)
# Sync to S3
aws s3 sync ./catalogues/tfy-k8s-gcp-gke-standard-inframold/templates s3://tfy-argo-application-catalogue/gcp-gke-standard/templates --delete
# Sync to S3 chart version folder
aws s3 sync ./catalogues/tfy-k8s-gcp-gke-standard-inframold/templates s3://tfy-argo-application-catalogue/gcp-gke-standard/$cp_chart_version/templates --delete
echo "Synced catalogue for gcp-standard successfully"
- run: |
echo "Render Azure-AKS manifests"
helm template inframold -n argocd -f ./charts/tfy-k8s-azure-aks-inframold/values-helm.yaml -f ./charts/tfy-k8s-azure-aks-inframold/values-ocli.yaml ./charts/tfy-k8s-azure-aks-inframold --output-dir catalogues
# Get the version of the truefoundry helm chart
cp_chart_version=$(yq e '.spec.source.targetRevision' ./catalogues/tfy-k8s-azure-aks-inframold/templates/truefoundry.yaml)
# Sync to S3
aws s3 sync ./catalogues/tfy-k8s-azure-aks-inframold/templates s3://tfy-argo-application-catalogue/azure-aks/templates --delete
# Sync to S3 chart version folder
aws s3 sync ./catalogues/tfy-k8s-azure-aks-inframold/templates s3://tfy-argo-application-catalogue/azure-aks/$cp_chart_version/templates --delete
echo "Synced catalogue for azure-aks successfully"
- run: |
echo "Render Generic k8s manifests"
helm template inframold -n argocd -f ./charts/tfy-k8s-generic-inframold/values-helm.yaml -f ./charts/tfy-k8s-generic-inframold/values-ocli.yaml ./charts/tfy-k8s-generic-inframold --output-dir catalogues
# Get the version of the truefoundry helm chart
cp_chart_version=$(yq e '.spec.source.targetRevision' ./catalogues/tfy-k8s-generic-inframold/templates/truefoundry.yaml)
# Sync to S3
aws s3 sync ./catalogues/tfy-k8s-generic-inframold/templates s3://tfy-argo-application-catalogue/generic/templates --delete
# Sync to S3 chart version folder
aws s3 sync ./catalogues/tfy-k8s-generic-inframold/templates s3://tfy-argo-application-catalogue/generic/$cp_chart_version/templates --delete
echo "Synced catalogue for generic k8s successfully"
- run: |
echo "Render Civo-Talos k8s manifests"
helm template inframold -n argocd -f ./charts/tfy-k8s-civo-talos-inframold/values-helm.yaml -f ./charts/tfy-k8s-civo-talos-inframold/values-ocli.yaml ./charts/tfy-k8s-civo-talos-inframold --output-dir catalogues
# Get the version of the truefoundry helm chart
cp_chart_version=$(yq e '.spec.source.targetRevision' ./catalogues/tfy-k8s-civo-talos-inframold/templates/truefoundry.yaml)
# Sync to S3
aws s3 sync ./catalogues/tfy-k8s-civo-talos-inframold/templates s3://tfy-argo-application-catalogue/civo-talos/templates --delete
# Sync to S3 chart version folder
aws s3 sync ./catalogues/tfy-k8s-civo-talos-inframold/templates s3://tfy-argo-application-catalogue/civo-talos/$cp_chart_version/templates --delete
echo "Synced catalogue for civo-talos k8s successfully"
- run: |
# Invalidate cloudfront
aws configure set preview.cloudfront true && aws cloudfront create-invalidation --distribution-id EYFSW3BXDVFP0 --paths '/*'
- run: echo "🍏 This job's status is ${{ job.status }}."