Compare commits
1 Commits
7a0265e3d9
...
2f029e0baa
| Author | SHA1 | Date | |
|---|---|---|---|
|
2f029e0baa
|
@@ -13,8 +13,6 @@ 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:
|
||||||
@@ -23,13 +21,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
path: infrastructure
|
fetch-depth: 0
|
||||||
|
|
||||||
- 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
|
||||||
@@ -40,13 +32,16 @@ jobs:
|
|||||||
- name: Render Helm Manifests
|
- name: Render Helm Manifests
|
||||||
run: |
|
run: |
|
||||||
for cluster in ${CLUSTERS}; do
|
for cluster in ${CLUSTERS}; do
|
||||||
for chart_path in ${MAIN_DIR}/clusters/$cluster/helm/*; do
|
mkdir -p ${{ gitea.workspace }}/clusters/$cluster/manifests
|
||||||
|
|
||||||
|
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 ${MANIFEST_DIR}/clusters/$cluster/manifests/$chart_name
|
mkdir -p ${{ gitea.workspace }}/clusters/$cluster/manifests/$chart_name
|
||||||
OUTPUT_FILE="${MANIFEST_DIR}/clusters/$cluster/manifests/$chart_name/$chart_name.yaml"
|
OUTPUT_FILE="${{ gitea.workspace }}/clusters/$cluster/manifests/$chart_name/$chart_name.yaml"
|
||||||
|
|
||||||
cd $chart_path
|
cd $chart_path
|
||||||
|
|
||||||
@@ -73,10 +68,33 @@ 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: |
|
||||||
cd ${MANIFEST_DIR}
|
git restore clusters/**/helm
|
||||||
|
|
||||||
if git status --porcelain | grep -q .; then
|
if git status --porcelain | grep -q .; then
|
||||||
echo ">> Changes detected"
|
echo ">> Changes detected"
|
||||||
@@ -91,8 +109,6 @@ 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
|
||||||
@@ -122,8 +138,6 @@ 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 \
|
||||||
@@ -180,34 +194,33 @@ 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 a new Pull Request!"
|
# details: "Manifest rendering for Infrastructure has created PR ${{ steps.pull-request.outputs.pull-request-number }}!"
|
||||||
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