6
6
jobs :
7
7
deploy :
8
8
if : github.event.pull_request.merged == true
9
- runs-on : docker
9
+ runs-on : ubuntu-22.04
10
10
steps :
11
11
- name : Checkout repository
12
12
uses : actions/checkout@v4
@@ -22,30 +22,11 @@ jobs:
22
22
fi
23
23
folders=$(git diff --name-only HEAD~1 HEAD | grep '^docker/' | cut -d/ -f2 | sort | uniq)
24
24
echo "Modified folders: $folders"
25
- echo "::set-output name=folders::$folders"
26
-
27
- - name : Set condition for deployment
28
- id : set-condition
29
- run : |
30
- if [ -z "${{ steps.detect-changes.outputs.folders }}" ]; then
31
- echo "No relevant changes detected."
32
- echo "::set-output name=continue::false"
33
- else
34
- echo "Relevant changes detected."
35
- echo "::set-output name=continue::true"
36
- fi
37
-
38
- conditional-deploy :
39
- if : needs.deploy.outputs.continue == 'true'
40
- runs-on : docker
41
- needs : deploy
42
- steps :
43
- - name : Checkout repository
44
- uses : actions/checkout@v4
25
+ echo "::set-output name=folders::$folders"
45
26
46
27
- name : Deploy to hosts
47
28
run : |
48
- IFS=' ' read -r -a folder_array <<< "${{ needs.deploy .outputs.folders }}"
29
+ IFS=' ' read -r -a folder_array <<< "${{ steps.detect-changes .outputs.folders }}"
49
30
for folder in "${folder_array[@]}"; do
50
31
case $folder in
51
32
arrs)
102
83
-d "{\"extra_vars\": {\"target_host\": \"$target_host\", \"folder\": \"$folder\"}}" \
103
84
"https://awx.mafyuh.xyz/api/v2/job_templates/13/launch/"
104
85
105
- sleep 45
106
-
86
+ sleep 45 # Delay for 45 seconds before fetching logs
87
+
107
88
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')
108
89
logs=$(curl -s -H "Authorization: Bearer ${{ secrets.AWX_API_TOKEN }}" https://awx.mafyuh.xyz/api/v2/jobs/$job_id/stdout/?format=json)
109
90
echo "AWX Job Logs for folder: $folder"
113
94
echo "Absolute End: $(echo "$logs" | jq -r '.range.absolute_end')"
114
95
echo "Content:"
115
96
echo "$(echo "$logs" | jq -r '.content')"
116
- done
97
+ done
0 commit comments