File tree Expand file tree Collapse file tree 2 files changed +21
-12
lines changed
Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Original file line number Diff line number Diff line change 99 default : ' dev'
1010 type : choice
1111 options :
12+ - staging
13+ - qa
14+ - production
15+ - development
1216 - dev
17+ - backup
18+ - jump
1319 tags :
1420 description : ' Tags to apply to the provisioned resources'
1521 required : true
3238 - join-workers
3339 - system-preparation
3440 - kubeconfig
35-
3641jobs :
3742 provision :
38- runs-on :
43+ runs-on :
3944 - self-hosted
4045 - ${{ inputs.environment }}
4146 - node
4752 chmod 600 /tmp/id_rsa
4853 env :
4954 SSH_KEY : ${{ secrets.SSH_KEY }}
50-
5155 - name : Set variables for ansible
5256 id : ansible-variables
5357 run : |
6266 k8s_runner_token : ${{ secrets.K8S_RUNNER_TOKEN }}
6367 repository : ${{ github.repository }}
6468 k8s_cluster_env : ${{ inputs.environment }}
65-
6669 - name : checkout repository
6770 uses : actions/checkout@v4
68-
69-
7071 - name : Run Ansible Playbook
7172 uses : dawidd6/action-ansible-playbook@v4
7273 env :
7778 requirements : galaxy-requirements.yml
7879 playbook : playbook.yml
7980 directory : ./infrastructure/server-setup
80- options : |
81+ options : |-
8182 --verbose
8283 --inventory inventory/${{ inputs.environment }}.yml
8384 --private-key /tmp/id_rsa
8485 ${{ inputs.tags != 'all' && format('--tags={0}', inputs.tags) || '' }}
85- --extra-vars ""${{ steps.ansible-variables.outputs.EXTRA_VARS }}""
86+ --extra-vars ""${{ steps.ansible-variables.outputs.EXTRA_VARS }}""
Original file line number Diff line number Diff line change @@ -33,11 +33,19 @@ jobs:
3333 path=".on.workflow_dispatch.inputs.environment.options"
3434
3535 IFS=' ' read -r -a envs <<< "${{ steps.extract.outputs.env_list }}"
36-
36+ list=$(printf '"%s", ' "${envs[@]}")
37+ list="[${list%, }]"
3738 for wf in "${workflows[@]}"; do
38- echo "Updating $wf with: ${envs[*] }"
39- yq e "$path = [${envs[@]/#/'\"'}]"$'\"]' "$wf" -i
39+ echo "Updating $wf with: ${list }"
40+ yq e "$path = $list" "$wf" -i
4041 done
4142
4243 - name : Show diff
43- run : git diff
44+ run : git diff
45+ - name : Commit changes
46+ run : |
47+ git config user.name "GitHub Actions"
48+ git config user.email "actions@github.com"
49+ git add .github/workflows/*.yml
50+ git commit -m "Update environment options" || echo "No changes"
51+ git push
You can’t perform that action at this time.
0 commit comments