77 required : true
88 description : The name of the environment where to deploy
99 type : string
10- target :
11- required : true
12- description : The environment target of the job
10+ branch :
11+ required : false
12+ default : ${{ github.ref_name }}
1313 type : string
1414
1515env :
16- NAMESPACE : receipts
1716 APP_NAME : pagopapagopareceiptpdfdatastore
1817
1918permissions :
2019 id-token : write
2120 contents : read
2221
2322jobs :
24- create_runner :
25- name : Create Runner
26- runs-on : ubuntu-22.04
27- environment :
28- name : ${{ inputs.environment }}
29- if : ${{ inputs.target == inputs.environment || inputs.target == 'all' }}
30- outputs :
31- runner_name : ${{ steps.create_github_runner.outputs.runner_name }}
32- steps :
33- - name : Create GitHub Runner
34- id : create_github_runner
35- # from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-create-action
36- uses : pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-create-action@main
37- with :
38- client_id : ${{ secrets.CLIENT_ID }}
39- tenant_id : ${{ secrets.TENANT_ID }}
40- subscription_id : ${{ secrets.SUBSCRIPTION_ID }}
41- container_app_environment_name : ${{ vars.CONTAINER_APP_ENVIRONMENT_NAME }}
42- resource_group_name : ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }} # RG of the runner
43- pat_token : ${{ secrets.BOT_TOKEN_GITHUB }}
44- self_hosted_runner_image_tag : " latest"
45-
4623 deploy :
47- needs : [ create_runner ]
48- runs-on : [ self-hosted, "${{ needs.create_runner.outputs.runner_name }}" ]
49- if : ${{ inputs.target == inputs.environment || inputs.target == 'all' }}
24+ runs-on : [ self-hosted-job, "${{ inputs.environment }}" ]
5025 name : Deploy on AKS
5126 environment : ${{ inputs.environment }}
5227 steps :
5328 - name : Deploy
5429 uses : pagopa/github-actions-template/aks-deploy@main
5530 with :
56- branch : ${{ github.ref_name }}
31+ branch : ${{ inputs.branch }}
5732 client_id : ${{ secrets.CLIENT_ID }}
5833 subscription_id : ${{ secrets.SUBSCRIPTION_ID }}
5934 tenant_id : ${{ secrets.TENANT_ID }}
6035 env : ${{ inputs.environment }}
61- namespace : ${{ env .NAMESPACE }}
36+ namespace : ${{ vars .NAMESPACE }}
6237 cluster_name : ${{ vars.CLUSTER_NAME }}
6338 resource_group : ${{ vars.CLUSTER_RESOURCE_GROUP }}
6439 app_name : ${{ env.APP_NAME }}
65- helm_upgrade_options : " --debug"
66-
67- cleanup_runner :
68- name : Cleanup Runner
69- needs : [ create_runner, deploy ]
70- if : ${{ success() || failure() && inputs.target == inputs.environment || inputs.target == 'all' }}
71- runs-on : ubuntu-22.04
72- environment : ${{ inputs.environment }}
73- steps :
74- - name : Cleanup GitHub Runner
75- id : cleanup_github_runner
76- # from https://github.com/pagopa/eng-github-actions-iac-template/tree/main/azure/github-self-hosted-runner-azure-cleanup-action
77- uses : pagopa/eng-github-actions-iac-template/azure/github-self-hosted-runner-azure-cleanup-action@0ee2f58fd46d10ac7f00bce4304b98db3dbdbe9a
78- with :
79- client_id : ${{ secrets.CLIENT_ID }}
80- tenant_id : ${{ secrets.TENANT_ID }}
81- subscription_id : ${{ secrets.SUBSCRIPTION_ID }}
82- resource_group_name : ${{ vars.CONTAINER_APP_ENVIRONMENT_RESOURCE_GROUP_NAME }}
83- runner_name : ${{ needs.create_runner.outputs.runner_name }}
84- pat_token : ${{ secrets.BOT_TOKEN_GITHUB }}
40+ helm_upgrade_options : ' --debug --set microservice-chart.azure.workloadIdentityClientId=${{vars.WORKLOAD_IDENTITY_ID}}'
41+ timeout : ' 15m0s'
0 commit comments