Tweaking checkout and HA config check steps.
Home Assistant & Miscellaneous Deployment / Check and Create PR (push) Successful in 30s
Home Assistant & Miscellaneous Deployment / Home Assistant Configuration Check (push) Failing after 13s

This commit is contained in:
2025-08-25 10:23:56 -04:00
parent 896828147c
commit ae9d0e99f3
+106 -103
View File
@@ -77,6 +77,9 @@ jobs:
- name: Run Home Assistant Configuration Check
run: |
which pip3
which python3
pip3 install homeassistant
python3 -m homeassistant --config "ansible/configs/homeassistant" --script check_config
- name: Gotify Notification
uses: eikendev/gotify-action@master
with:
@@ -84,114 +87,114 @@ jobs:
gotify_app_token: '${{ secrets.RIKKU_RUNNER_GOTIFY_TOKEN }}'
notification_title: 'GITEA: Home Assistant Config Check'
notification_message: 'Config check completed'
generate-service-list:
name: Generate list of added/modified/deleted services
runs-on: ubuntu-latest
needs: [home-assistant-config-check]
outputs:
svc_deploy_list: ${{ steps.detect_services.outputs.docker_svc_list }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch base branch
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
- name: Gotify Notification
uses: eikendev/gotify-action@master
with:
gotify_api_base: '${{ secrets.RIKKU_GOTIFY_URL }}'
gotify_app_token: '${{ secrets.RIKKU_RUNNER_GOTIFY_TOKEN }}'
notification_title: 'GITEA: Services TBD'
notification_message: 'Generating list of services to deploy...'
- name: Save both versions of docker-compose.yml
run: |
git show origin/main:docker-compose.yml > docker-compose-main.yml || touch docker-compose-main.yml
cp docker-compose.yml docker-compose-head.yml
- name: Detect added, deleted, and modified services
id: detect_services
run: |
echo "Getting services from main and ${{ github.ref_name }}"
yq '.services | keys | .[]' docker-compose-main.yml | sort > services_main.txt
yq '.services | keys | .[]' docker-compose-head.yml | sort > services_head.txt
# generate-service-list:
# name: Generate list of added/modified/deleted services
# runs-on: ubuntu-latest
# needs: [home-assistant-config-check]
# outputs:
# svc_deploy_list: ${{ steps.detect_services.outputs.docker_svc_list }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Fetch base branch
# run: |
# git fetch origin ${{ github.event.pull_request.base.ref }}
# - name: Gotify Notification
# uses: eikendev/gotify-action@master
# with:
# gotify_api_base: '${{ secrets.RIKKU_GOTIFY_URL }}'
# gotify_app_token: '${{ secrets.RIKKU_RUNNER_GOTIFY_TOKEN }}'
# notification_title: 'GITEA: Services TBD'
# notification_message: 'Generating list of services to deploy...'
# - name: Save both versions of docker-compose.yml
# run: |
# git show origin/main:docker-compose.yml > docker-compose-main.yml || touch docker-compose-main.yml
# cp docker-compose.yml docker-compose-head.yml
# - name: Detect added, deleted, and modified services
# id: detect_services
# run: |
# echo "Getting services from main and ${{ github.ref_name }}"
# yq '.services | keys | .[]' docker-compose-main.yml | sort > services_main.txt
# yq '.services | keys | .[]' docker-compose-head.yml | sort > services_head.txt
echo "Creating list of modified services..."
touch service_changes.txt
# echo "Creating list of modified services..."
# touch service_changes.txt
comm -13 services_main.txt services_head.txt | while read service; do
echo "$service: added" >> service_changes.txt
done
# comm -13 services_main.txt services_head.txt | while read service; do
# echo "$service: added" >> service_changes.txt
# done
comm -12 services_main.txt services_head.txt | while read service; do
yq ".services[\"$service\"]" docker-compose-main.yml > tmp_main.yml
yq ".services[\"$service\"]" docker-compose-head.yml > tmp_head.yml
if ! diff -q tmp_main.yml tmp_head.yml > /dev/null; then
echo "$service: modified" >> service_changes.txt
fi
done
# comm -12 services_main.txt services_head.txt | while read service; do
# yq ".services[\"$service\"]" docker-compose-main.yml > tmp_main.yml
# yq ".services[\"$service\"]" docker-compose-head.yml > tmp_head.yml
# if ! diff -q tmp_main.yml tmp_head.yml > /dev/null; then
# echo "$service: modified" >> service_changes.txt
# fi
# done
echo "Detected service changes:"
cat service_changes.txt
# echo "Detected service changes:"
# cat service_changes.txt
mod_svcs=$(cut -d':' -f1 service_changes.txt | sort | uniq)
echo "docker_svc_list<<EOF" >> "$GITHUB_OUTPUT"
echo "$mod_svcs" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: List of Services for (Re)Deployment
run: |
echo -e "${{ steps.detect_services.outputs.docker_svc_list }}"
docker-compose-dry-run:
name: Docker Compose Dry Run
needs: [generate-service-list]
runs-on: ubuntu-latest
env:
VAULT_ADDR: ${{ secrets.RIKKU_VAULT_ADDR }}
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
VAULT_NAMESPACE: ""
RIKKU_REGISTRY_PASSWORD: ${{ secrets.BOT_GITEA_PASSWORD }}
DOCKER_SVC_LIST: ${{ needs.generate-service-list.outputs.svc_deploy_list }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Gitea Container Registry
run: |
docker login -u gitea-sonarqube-bot -p ${RIKKU_REGISTRY_PASSWORD} git.trez.wtf
- name: Cache Vault install
id: cache-vault
uses: actions/cache@v4
with:
path: /opt/hostedtoolcache/vault/${{ env.HC_VAULT_VERSION }}/x64
key: vault-${{ runner.os }}-${{ env.HC_VAULT_VERSION }}
- name: Install Vault (only if not cached)
if: steps.cache-vault.outputs.cache-hit != 'true'
uses: cpanato/vault-installer@main
with:
version: ${{ env.HC_VAULT_VERSION }}
- name: Gotify Notification
uses: eikendev/gotify-action@master
with:
gotify_api_base: '${{ secrets.RIKKU_GOTIFY_URL }}'
gotify_app_token: '${{ secrets.RIKKU_RUNNER_GOTIFY_TOKEN }}'
notification_title: 'GITEA: Docker Compose Dry Run @ Rinoa'
notification_message: 'Starting Docker Compose dry run...'
- name: Generate .env file for Docker Compose
run: |
vault kv get -format=json rikku-docker/env | jq -r '.data.data' | jq -r 'keys[] as $k | "\($k)='\''\(.[$k])'\''"' > .env
echo ${DOCKER_SVC_LIST}
- name: Docker Compose Dry Run
uses: astappiev/docker-compose-remote-action@master
with:
ssh_user: pi
ssh_host: 192.168.1.252
ssh_private_key: ${RIKKU_SSH_PRIVATE_KEY}
ssh_host_public_key: ${RIKKU_SSH_PUBLIC_KEY}
docker_args: -d --remove-orphans --build ${DOCKER_SVC_LIST}
- name: Gotify Notification
uses: eikendev/gotify-action@master
with:
gotify_api_base: '${{ secrets.RIKKU_GOTIFY_URL }}'
gotify_app_token: '${{ secrets.RIKKU_RUNNER_GOTIFY_TOKEN }}'
notification_title: 'GITEA: Docker Compose Dry Run @ Rinoa'
notification_message: 'Docker Compose dry run completed successfully.'
# mod_svcs=$(cut -d':' -f1 service_changes.txt | sort | uniq)
# echo "docker_svc_list<<EOF" >> "$GITHUB_OUTPUT"
# echo "$mod_svcs" >> "$GITHUB_OUTPUT"
# echo "EOF" >> "$GITHUB_OUTPUT"
# - name: List of Services for (Re)Deployment
# run: |
# echo -e "${{ steps.detect_services.outputs.docker_svc_list }}"
# docker-compose-dry-run:
# name: Docker Compose Dry Run
# needs: [generate-service-list]
# runs-on: ubuntu-latest
# env:
# VAULT_ADDR: ${{ secrets.RIKKU_VAULT_ADDR }}
# VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
# VAULT_NAMESPACE: ""
# RIKKU_REGISTRY_PASSWORD: ${{ secrets.BOT_GITEA_PASSWORD }}
# DOCKER_SVC_LIST: ${{ needs.generate-service-list.outputs.svc_deploy_list }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Login to Gitea Container Registry
# run: |
# docker login -u gitea-sonarqube-bot -p ${RIKKU_REGISTRY_PASSWORD} git.trez.wtf
# - name: Cache Vault install
# id: cache-vault
# uses: actions/cache@v4
# with:
# path: /opt/hostedtoolcache/vault/${{ env.HC_VAULT_VERSION }}/x64
# key: vault-${{ runner.os }}-${{ env.HC_VAULT_VERSION }}
# - name: Install Vault (only if not cached)
# if: steps.cache-vault.outputs.cache-hit != 'true'
# uses: cpanato/vault-installer@main
# with:
# version: ${{ env.HC_VAULT_VERSION }}
# - name: Gotify Notification
# uses: eikendev/gotify-action@master
# with:
# gotify_api_base: '${{ secrets.RIKKU_GOTIFY_URL }}'
# gotify_app_token: '${{ secrets.RIKKU_RUNNER_GOTIFY_TOKEN }}'
# notification_title: 'GITEA: Docker Compose Dry Run @ Rinoa'
# notification_message: 'Starting Docker Compose dry run...'
# - name: Generate .env file for Docker Compose
# run: |
# vault kv get -format=json rikku-docker/env | jq -r '.data.data' | jq -r 'keys[] as $k | "\($k)='\''\(.[$k])'\''"' > .env
# echo ${DOCKER_SVC_LIST}
# - name: Docker Compose Dry Run
# uses: astappiev/docker-compose-remote-action@master
# with:
# ssh_user: pi
# ssh_host: 192.168.1.252
# ssh_private_key: ${RIKKU_SSH_PRIVATE_KEY}
# ssh_host_public_key: ${RIKKU_SSH_PUBLIC_KEY}
# docker_args: -d --remove-orphans --build ${DOCKER_SVC_LIST}
# - name: Gotify Notification
# uses: eikendev/gotify-action@master
# with:
# gotify_api_base: '${{ secrets.RIKKU_GOTIFY_URL }}'
# gotify_app_token: '${{ secrets.RIKKU_RUNNER_GOTIFY_TOKEN }}'
# notification_title: 'GITEA: Docker Compose Dry Run @ Rinoa'
# notification_message: 'Docker Compose dry run completed successfully.'
# pr-merge:
# name: PR Merge
# needs: [regenerate-readme-modified-services]