use separate dir for each branch
All checks were successful
renovate / renovate (push) Successful in 1m14s
All checks were successful
renovate / renovate (push) Successful in 1m14s
This commit is contained in:
@@ -13,6 +13,8 @@ on:
|
|||||||
env:
|
env:
|
||||||
CLUSTERS: cl01tl
|
CLUSTERS: cl01tl
|
||||||
BASE_BRANCH: manifests
|
BASE_BRANCH: manifests
|
||||||
|
MAIN_DIR: /workspace/alexlebens/infrastructure
|
||||||
|
MANIFEST_DIR: /workspace/alexlebens/infrastructure-manifests
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
render-manifests-helm:
|
render-manifests-helm:
|
||||||
@@ -21,7 +23,13 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
path: infrastructure
|
||||||
|
|
||||||
|
- name: Checkout Manifests
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: manifests
|
||||||
|
path: infrastructure-manifests
|
||||||
|
|
||||||
- name: Set up Helm
|
- name: Set up Helm
|
||||||
uses: azure/setup-helm@v4
|
uses: azure/setup-helm@v4
|
||||||
@@ -32,16 +40,13 @@ jobs:
|
|||||||
- name: Render Helm Manifests
|
- name: Render Helm Manifests
|
||||||
run: |
|
run: |
|
||||||
for cluster in ${CLUSTERS}; do
|
for cluster in ${CLUSTERS}; do
|
||||||
mkdir -p ${{ gitea.workspace }}/clusters/$cluster/manifests
|
for chart_path in ${MAIN_DIR}/clusters/$cluster/helm/*; do
|
||||||
|
|
||||||
for chart_path in ${{ gitea.workspace }}/clusters/$cluster/helm/*; do
|
|
||||||
chart_name=$(basename "$chart_path")
|
chart_name=$(basename "$chart_path")
|
||||||
|
|
||||||
echo ">> Rendering chart: $chart_name"
|
echo ">> Rendering chart: $chart_name"
|
||||||
|
|
||||||
if [ -f "$chart_path/Chart.yaml" ]; then
|
if [ -f "$chart_path/Chart.yaml" ]; then
|
||||||
mkdir -p ${{ gitea.workspace }}/clusters/$cluster/manifests/$chart_name
|
mkdir -p ${MANIFEST_DIR}/clusters/$cluster/manifests/$chart_name
|
||||||
OUTPUT_FILE="${{ gitea.workspace }}/clusters/$cluster/manifests/$chart_name/$chart_name.yaml"
|
OUTPUT_FILE="${MANIFEST_DIR}/clusters/$cluster/manifests/$chart_name/$chart_name.yaml"
|
||||||
|
|
||||||
cd $chart_path
|
cd $chart_path
|
||||||
|
|
||||||
@@ -68,33 +73,10 @@ jobs:
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# - name: Create Pull Request
|
|
||||||
# id: pull-request
|
|
||||||
# uses: github.com/quentinlegot/gitea-create-pull-request@c05fb67b080696dcdb2d2b7ea83051ec413f7285
|
|
||||||
# with:
|
|
||||||
# token: ${{ secrets.BOT_TOKEN }}
|
|
||||||
# add-paths: |
|
|
||||||
# clusters/cl01tl/manifests/*
|
|
||||||
# commit-message: "chore: Update manifests after chart change"
|
|
||||||
# committer: gitea-bot <gitea-bot@alexlebens.net>
|
|
||||||
# author: gitea-bot <gitea-bot@alexlebens.net>
|
|
||||||
# branch: auto/update-manifests
|
|
||||||
# branch-suffix: timestamp
|
|
||||||
# base: manifests
|
|
||||||
# title: "Manifest Update"
|
|
||||||
# body: |
|
|
||||||
# This PR contains the newly rendered Kubernetes manifests.
|
|
||||||
|
|
||||||
# * Triggered by workflow run ${{ github.run_id }}
|
|
||||||
# * Review the `files changed` tab for the full YAML diff.
|
|
||||||
# labels: |
|
|
||||||
# manifests
|
|
||||||
# automated
|
|
||||||
|
|
||||||
- name: Check for Changes
|
- name: Check for Changes
|
||||||
id: check-changes
|
id: check-changes
|
||||||
run: |
|
run: |
|
||||||
git restore clusters/**/helm
|
cd ${MANIFEST_DIR}
|
||||||
|
|
||||||
if git status --porcelain | grep -q .; then
|
if git status --porcelain | grep -q .; then
|
||||||
echo ">> Changes detected"
|
echo ">> Changes detected"
|
||||||
@@ -109,6 +91,8 @@ jobs:
|
|||||||
id: commit-push
|
id: commit-push
|
||||||
if: steps.check-changes.outputs.changes-detected == 'true'
|
if: steps.check-changes.outputs.changes-detected == 'true'
|
||||||
run: |
|
run: |
|
||||||
|
cd ${MANIFEST_DIR}
|
||||||
|
|
||||||
BRANCH_NAME="auto/update-manifests-$(date +%s)"
|
BRANCH_NAME="auto/update-manifests-$(date +%s)"
|
||||||
|
|
||||||
# Configure Git
|
# Configure Git
|
||||||
@@ -138,6 +122,8 @@ jobs:
|
|||||||
GITEA_URL: ${{ secrets.REPO_URL }}
|
GITEA_URL: ${{ secrets.REPO_URL }}
|
||||||
HEAD_BRANCH: ${{ steps.commit-push.outputs.HEAD_BRANCH }}
|
HEAD_BRANCH: ${{ steps.commit-push.outputs.HEAD_BRANCH }}
|
||||||
run: |
|
run: |
|
||||||
|
cd ${MANIFEST_DIR}
|
||||||
|
|
||||||
API_ENDPOINT="${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/pulls"
|
API_ENDPOINT="${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/pulls"
|
||||||
|
|
||||||
PAYLOAD=$( jq -n \
|
PAYLOAD=$( jq -n \
|
||||||
@@ -194,33 +180,34 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
HEAD_BRANCH: ${{ steps.commit-push.outputs.HEAD_BRANCH }}
|
HEAD_BRANCH: ${{ steps.commit-push.outputs.HEAD_BRANCH }}
|
||||||
run: |
|
run: |
|
||||||
echo ">> Removing branch: ${HEAD_BRANCH}"
|
echo ">> Removing branch: ${HEAD_BRANCH}"
|
||||||
git push origin --delete ${HEAD_BRANCH}
|
git push origin --delete ${HEAD_BRANCH}
|
||||||
|
|
||||||
# - name: ntfy Created
|
- name: ntfy Created
|
||||||
# uses: niniyas/ntfy-action@master
|
uses: niniyas/ntfy-action@master
|
||||||
# if: steps.create-pull-request.outputs.pull-request-operation == 'created'
|
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
|
||||||
# with:
|
with:
|
||||||
# url: "${{ secrets.NTFY_URL }}"
|
url: "${{ secrets.NTFY_URL }}"
|
||||||
# topic: "${{ secrets.NTFY_TOPIC }}"
|
topic: "${{ secrets.NTFY_TOPIC }}"
|
||||||
# title: "Manifest Render PR Created - Infrastructure"
|
title: "Manifest Render PR Created - Infrastructure"
|
||||||
# priority: 3
|
priority: 3
|
||||||
# headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
# tags: action,successfully,completed
|
tags: action,successfully,completed
|
||||||
# details: "Manifest rendering for Infrastructure has created PR ${{ steps.pull-request.outputs.pull-request-number }}!"
|
details: "Manifest rendering for Infrastructure has created a new Pull Request!"
|
||||||
# icon: "https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png"
|
icon: "https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png"
|
||||||
|
actions: '[{"action": "view", "label": "Open Gitea", "url": "${{ steps.create-pull-request.outputs.pull-request-url }}", "clear": true}]'
|
||||||
|
|
||||||
# - name: ntfy Failed
|
- name: ntfy Failed
|
||||||
# uses: niniyas/ntfy-action@master
|
uses: niniyas/ntfy-action@master
|
||||||
# if: failure()
|
if: failure()
|
||||||
# with:
|
with:
|
||||||
# url: "${{ secrets.NTFY_URL }}"
|
url: "${{ secrets.NTFY_URL }}"
|
||||||
# topic: "${{ secrets.NTFY_TOPIC }}"
|
topic: "${{ secrets.NTFY_TOPIC }}"
|
||||||
# title: "Manifest Render Failure - Infrastructure"
|
title: "Manifest Render Failure - Infrastructure"
|
||||||
# priority: 4
|
priority: 4
|
||||||
# headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
# tags: action,failed
|
tags: action,failed
|
||||||
# details: "Manifest rendering for Infrastructure has failed!"
|
details: "Manifest rendering for Infrastructure has failed!"
|
||||||
# icon: "https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png"
|
icon: "https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png"
|
||||||
# actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/infrastructure/actions?workflow=render-manifests.yaml", "clear": true}]'
|
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/infrastructure/actions?workflow=render-manifests.yaml", "clear": true}]'
|
||||||
# image: true
|
image: true
|
||||||
|
|||||||
Reference in New Issue
Block a user