Merge branch 'main' into renovate/ghcr.io-linuxserver-syncthing
All checks were successful
Lint on PR / Lint YAML files (pull_request) Successful in 10s
Deploy to Hosts / deploy (pull_request) Successful in 50s

This commit is contained in:
Matt Reeves 2024-06-15 01:33:12 -04:00
commit b283cbf25c
2 changed files with 69 additions and 86 deletions

View file

@ -24,91 +24,74 @@ jobs:
echo "Modified folders: $folders" echo "Modified folders: $folders"
echo "::set-output name=folders::$folders" echo "::set-output name=folders::$folders"
- name: Determine target host - name: Deploy to hosts
id: determine-host
run: | run: |
folder=$(echo "${{ steps.detect-changes.outputs.folders }}" | head -n 1) IFS=' ' read -r -a folder_array <<< "${{ steps.detect-changes.outputs.folders }}"
if [ -z "$folder" ]; then for folder in "${folder_array[@]}"; do
echo "No modified folders detected" case $folder in
exit 1 arrs)
fi target_host="arrs.lan"
case $folder in ;;
arrs) arm)
target_host="arrs.lan" target_host="arm.lan"
;; ;;
arm) downloaders)
target_host="arm.lan" target_host="downloaders.lan"
;; ;;
downloaders) AI)
target_host="downloaders.lan" target_host="ai.lan"
;; ;;
AI) authentik)
target_host="ai.lan" target_host="auth.lan"
;; ;;
authentik) cf)
target_host="auth.lan" target_host="cf.lan"
;; ;;
cf) jellyfin)
target_host="cf.lan" target_host="jf.lan"
;; ;;
jellyfin) kasm)
target_host="jf.lan" target_host="kasm.lan"
;; ;;
kasm) netboot)
target_host="kasm.lan" target_host="netboot.lan"
;; ;;
netboot) nexus)
target_host="netboot.lan" target_host="nexus.lan"
;; ;;
nexus) pages)
target_host="nexus.lan" target_host="pages.lan"
;; ;;
pages) portainer)
target_host="pages.lan" target_host="port.lan"
;; ;;
portainer) twingate)
target_host="port.lan" target_host="twingate.lan"
;; ;;
twingate) whisper)
target_host="twingate.lan" target_host="whisper.lan"
;; ;;
whisper) # Add cases for other folders/hosts
target_host="whisper.lan" *)
;; echo "Unknown folder: $folder"
# Add cases for other folders/hosts continue
*) ;;
echo "Unknown folder: $folder" esac
exit 1 echo "Triggering AWX Job with target host: $target_host and folder: $folder"
;; curl -X POST -k -H "Content-Type: application/json" \
esac -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" \
echo "::set-output name=target_host::$target_host" -d "{\"extra_vars\": {\"target_host\": \"$target_host\", \"folder\": \"$folder\"}}" \
echo "::set-output name=folder::$folder" "https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/"
- name: Trigger AWX Job sleep 45 # Delay for 45 seconds before fetching logs
run: |
TARGET_HOST="${{ steps.determine-host.outputs.target_host }}"
FOLDER="${{ steps.determine-host.outputs.folder }}"
echo "Triggering AWX Job with target host: $TARGET_HOST and folder: $FOLDER"
curl -X POST -k -H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" \
-d "{\"extra_vars\": {\"target_host\": \"$TARGET_HOST\", \"folder\": \"$FOLDER\"}}" \
"https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/"
- name: Delay for 45 seconds job_id=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/job_templates/13/jobs/?order_by=-id | jq -r '.results[0].id')
run: sleep 45 logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json)
echo "AWX Job Logs for folder: $folder"
- name: Fetch AWX Job Logs echo "Range:"
run: | echo "Start: $(echo "$logs" | jq -r '.range.start')"
# Fetch the most recent job from AWX echo "End: $(echo "$logs" | jq -r '.range.end')"
job_id=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/job_templates/13/jobs/?order_by=-id | jq -r '.results[0].id') echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')"
echo "Content:"
# Fetch the logs for the job echo "$(echo "$logs" | jq -r '.content')"
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json) done
# Display the logs
echo "Range:"
echo "Start: $(echo "$logs" | jq -r '.range.start')"
echo "End: $(echo "$logs" | jq -r '.range.end')"
echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')"
echo "Content:"
echo "$(echo "$logs" | jq -r '.content')"

View file

@ -57,7 +57,7 @@ services:
- PGID=1000 - PGID=1000
sonarr: sonarr:
image: ghcr.io/linuxserver/sonarr@sha256:30432d9faf9e8fbb7c6336806ee061ed426204e1f9718d9659a2642a6e3a7c59 image: ghcr.io/linuxserver/sonarr@sha256:275467ba17d990bbc6301dec3cc76b042969836749de39067818759d0f3b407f
container_name: sonarr container_name: sonarr
ports: ports:
- "8989:8989" - "8989:8989"