Notifications and workflow triggers.
Validate DAGs / DAGU DAG(s) Validation (push) Failing after 1m0s
Validate DAGs / DAGU DAG(s) Validation (push) Failing after 1m0s
This commit is contained in:
@@ -15,25 +15,63 @@ env:
|
|||||||
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate-dags:
|
||||||
|
name: DAGU DAG(s) Validation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout Repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
|
notification_title: 'GITEA: Dagu Validation'
|
||||||
|
notification_message: 'Setting up Ansible and Vault... 🏗️'
|
||||||
|
|
||||||
- name: Install Ansible
|
- name: Install Ansible
|
||||||
uses: alex-oleshkevich/setup-ansible@v1.0.1
|
uses: alex-oleshkevich/setup-ansible@v1.0.1
|
||||||
with:
|
with:
|
||||||
version: "11.4.0"
|
version: "11.4.0"
|
||||||
|
|
||||||
|
- name: Cache Ansible Galaxy Collections
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: collections
|
||||||
|
key: ${{ runner.os }}-ansible-${{ hashFiles('./collections/requirements.yml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-ansible-
|
||||||
|
|
||||||
- name: Set up Vault CLI
|
- name: Set up Vault CLI
|
||||||
uses: eLco/setup-vault@v1
|
uses: eLco/setup-vault@v1
|
||||||
with:
|
with:
|
||||||
vault_version: 1.18.0
|
vault_version: 1.18.0
|
||||||
|
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Install hvac (Vault Python SDK)
|
- name: Install hvac (Vault Python SDK)
|
||||||
run: pip install hvac
|
run: pip install hvac
|
||||||
|
|
||||||
- name: Render .yaml.j2 templates
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
|
notification_title: 'GITEA: Dagu Validation'
|
||||||
|
notification_message: 'Ansible and Vault setups completed, starting Dagu validation... 🔬'
|
||||||
|
|
||||||
|
- name: Install dagu
|
||||||
|
run: |
|
||||||
|
curl -L https://raw.githubusercontent.com/dagu-org/dagu/main/scripts/installer.sh | bash
|
||||||
|
|
||||||
|
- name: Render DAG Jinja templates
|
||||||
uses: dawidd6/action-ansible-playbook@v2
|
uses: dawidd6/action-ansible-playbook@v2
|
||||||
with:
|
with:
|
||||||
directory: .
|
directory: .
|
||||||
@@ -41,14 +79,41 @@ jobs:
|
|||||||
requirements: collections/requirements.yml
|
requirements: collections/requirements.yml
|
||||||
playbook: playbooks/rinoa-render-dags.yml
|
playbook: playbooks/rinoa-render-dags.yml
|
||||||
|
|
||||||
- name: Install dagu
|
|
||||||
run: |
|
|
||||||
curl -L https://raw.githubusercontent.com/dagu-org/dagu/main/scripts/installer.sh | bash
|
|
||||||
dagu version
|
|
||||||
|
|
||||||
- name: Validate DAGs
|
- name: Validate DAGs
|
||||||
run: |
|
run: |
|
||||||
for dag in $(find ${DAGS_PATH} -type f -name "*.yaml" -a ! -name "*example*"); do
|
for dag in $(find ${DAGS_PATH} -type f -name "*.yaml" -a ! -name "*example*"); do
|
||||||
echo "===========Validating ${dag}==========="
|
echo -e "\n\n===========Validating ${dag}==========="
|
||||||
dagu dry "${dag}"
|
dagu dry "${dag}"
|
||||||
done
|
done
|
||||||
|
echo "exit_code=$status" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
if: steps.validate-dags.outputs.exit_code == '0'
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
|
notification_title: 'GITEA: Dagu Validation'
|
||||||
|
notification_message: 'Dagu DAG validation passed! 🏁'
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
if: steps.validate-dags.outputs.exit_code != '0'
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: '${{ secrets.GOTIFY_URL }}'
|
||||||
|
gotify_app_token: '${{ secrets.RUNNER_GOTIFY_TOKEN }}'
|
||||||
|
notification_title: 'GITEA: Dagu Validation'
|
||||||
|
notification_message: 'Dagu DAG validation failed! 🚫'
|
||||||
|
|
||||||
|
- name: Write downstream trigger marker
|
||||||
|
if: steps.validate-dags.outputs.exit_code == '0'
|
||||||
|
run: |
|
||||||
|
echo "DAG validation completed at $(date -u)" > .dag-validation-complete
|
||||||
|
|
||||||
|
- name: Add/Commit Validation Trigger File
|
||||||
|
id: commit-readme
|
||||||
|
uses: EndBug/add-and-commit@v9
|
||||||
|
with:
|
||||||
|
add: ".dag-validation-complete"
|
||||||
|
default_author: ${{ github.actor }}
|
||||||
|
message: "chore: mark DAG validation complete"
|
||||||
@@ -2,11 +2,12 @@ name: Gitea Branch PR & Ansible Deployment
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
workflow_run:
|
# workflow_run will be supported in Gitea 1.25.x
|
||||||
workflows: [Home Assistant Config Check, Validate DAGs]
|
# workflow_run:
|
||||||
types:
|
# workflows: [Home Assistant Config Check, Validate DAGs]
|
||||||
- completed
|
# types:
|
||||||
branches: main
|
# - completed
|
||||||
|
# branches: main
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- 'main'
|
- 'main'
|
||||||
@@ -16,6 +17,7 @@ on:
|
|||||||
- '!app-configs/rinoa/dagu/dags/**'
|
- '!app-configs/rinoa/dagu/dags/**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
TEA_VERSION: '0.10.1'
|
||||||
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
|
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
|
||||||
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||||
|
|
||||||
@@ -33,9 +35,9 @@ jobs:
|
|||||||
- name: Install tea CLI
|
- name: Install tea CLI
|
||||||
uses: supplypike/setup-bin@v4
|
uses: supplypike/setup-bin@v4
|
||||||
with:
|
with:
|
||||||
uri: 'https://gitea.com/gitea/tea/releases/download/v0.9.2/tea-0.9.2-linux-amd64'
|
uri: 'https://gitea.com/gitea/tea/releases/download/v${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64'
|
||||||
name: 'tea'
|
name: 'tea'
|
||||||
version: '0.9.2'
|
version: ${{ env.TEA_VERSION }}
|
||||||
|
|
||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
@@ -96,13 +98,21 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: "11.4.0"
|
version: "11.4.0"
|
||||||
|
|
||||||
|
- name: Set up Vault CLI
|
||||||
|
uses: eLco/setup-vault@v1
|
||||||
|
with:
|
||||||
|
vault_version: 1.18.0
|
||||||
|
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Install Vault & hvac
|
- name: Install Vault & hvac
|
||||||
run: |
|
run: pip install hvac
|
||||||
sudo apt-get update && sudo apt-get install -y unzip
|
|
||||||
curl -fsSL https://releases.hashicorp.com/vault/1.18.0/vault_1.18.0_linux_amd64.zip -o vault.zip
|
|
||||||
unzip vault.zip
|
|
||||||
sudo mv vault /usr/local/bin/
|
|
||||||
pip install hvac
|
|
||||||
|
|
||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
@@ -144,9 +154,9 @@ jobs:
|
|||||||
- name: Install tea
|
- name: Install tea
|
||||||
uses: supplypike/setup-bin@v4
|
uses: supplypike/setup-bin@v4
|
||||||
with:
|
with:
|
||||||
uri: 'https://gitea.com/gitea/tea/releases/download/v0.9.2/tea-0.9.2-linux-amd64'
|
uri: 'https://gitea.com/gitea/tea/releases/download/v${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64'
|
||||||
name: 'tea'
|
name: 'tea'
|
||||||
version: '0.9.2'
|
version: ${{ env.TEA_VERSION }}
|
||||||
|
|
||||||
- name: PR Merge
|
- name: PR Merge
|
||||||
id: pr_merge
|
id: pr_merge
|
||||||
@@ -181,18 +191,34 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
|
|
||||||
|
- name: Cache Ansible Galaxy Collections
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: collections
|
||||||
|
key: ${{ runner.os }}-ansible-${{ hashFiles('./collections/requirements.yml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-ansible-
|
||||||
|
|
||||||
- name: Install Ansible
|
- name: Install Ansible
|
||||||
uses: alex-oleshkevich/setup-ansible@v1.0.1
|
uses: alex-oleshkevich/setup-ansible@v1.0.1
|
||||||
with:
|
with:
|
||||||
version: "11.4.0"
|
version: "11.4.0"
|
||||||
|
|
||||||
|
- name: Set up Vault CLI
|
||||||
|
uses: eLco/setup-vault@v1
|
||||||
|
with:
|
||||||
|
vault_version: 1.18.0
|
||||||
|
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Install Vault & hvac
|
- name: Install Vault & hvac
|
||||||
run: |
|
run: pip install hvac
|
||||||
sudo apt-get update && sudo apt-get install -y unzip
|
|
||||||
curl -fsSL https://releases.hashicorp.com/vault/1.18.0/vault_1.18.0_linux_amd64.zip -o vault.zip
|
|
||||||
unzip vault.zip
|
|
||||||
sudo mv vault /usr/local/bin/
|
|
||||||
pip install hvac
|
|
||||||
|
|
||||||
- name: Gotify Notification
|
- name: Gotify Notification
|
||||||
uses: eikendev/gotify-action@master
|
uses: eikendev/gotify-action@master
|
||||||
|
|||||||
Reference in New Issue
Block a user