-
Notifications
You must be signed in to change notification settings - Fork 3
132 lines (121 loc) · 5.72 KB
/
pr_validation.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Validate PRs with demo use cases
on:
pull_request:
branches:
- dev
workflow_dispatch: # Allows manual triggering of the workflow
inputs:
use_cases:
description: 'Enter the use cases to run (comma-separated). Example: ["demo_ar_workflows_gitlab","demo_ar_workflows_ansible"]'
required: true
default: '["demo_all"]'
type: string
providers:
description: 'Select the providers to run (comma-separated). Example: ["gcloud","aws"]'
required: true
default: '["gcloud"]'
type: string
destroy_resources:
description: 'Set to "true" to enable resource destruction'
required: true
default: true
type: boolean
custom_domain:
description: "Custom Domain Name"
required: false
default: ""
type: string
# optional params for manual run
dt_tenant:
description: "Dynatrace Tenant"
required: false
default: ""
type: string
dt_api_token:
description: "Dynatrace API Token"
required: false
default: ""
type: string
dt_url_gen3:
description: "Dynatrace Environment URL Gen3"
required: false
default: ""
type: string
env:
DEFAULT_USE_CASES: '[\"demo_all\"]'
DEFAULT_PROVIDERS: '[\"gcloud\"]'
DESTROY_RESOURCES: true
DEFAULT_CUSTOM_DOMAIN: "demo-sprint-2.ace-innovation.info"
DT_TENANT: ${{ vars.DT_TENANT }}
DT_URL_GEN3: ${{ vars.DT_URL_GEN3 }}
DT_API_TOKEN: ${{ secrets.DT_API_TOKEN }}
jobs:
set_env_vars:
runs-on: spot
outputs:
use_cases: ${{ steps.set_outputs.outputs.use_cases }}
providers: ${{ steps.set_outputs.outputs.providers }}
destroy_resources: ${{ steps.set_outputs.outputs.destroy_resources }}
custom_domain: ${{ steps.set_outputs.outputs.custom_domain }}
dt_tenant: ${{ steps.set_outputs.outputs.dt_tenant }}
dt_url_gen3: ${{ steps.set_outputs.outputs.dt_url_gen3 }}
dt_api_token: ${{ steps.set_outputs.outputs.dt_api_token }}
steps:
- name: Set Environment Variables
id: set_env
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "use_cases=$(echo '${{ github.event.inputs.use_cases }}' )" >> "$GITHUB_ENV"
echo "providers=$(echo '${{ github.event.inputs.providers }}' )" >> "$GITHUB_ENV"
echo "destroy_resources=$(echo '${{ github.event.inputs.destroy_resources }}' )" >> "$GITHUB_ENV"
echo "custom_domain=$(echo '${{ github.event.inputs.custom_domain }}' )" >> "$GITHUB_ENV"
echo "dt_tenant=$(echo '${{ github.event.inputs.dt_tenant }}' )" >> "$GITHUB_ENV"
echo "dt_url_gen3=$(echo '${{ github.event.inputs.dt_url_gen3 }}' )" >> "$GITHUB_ENV"
echo "dt_api_token=$(echo '${{ github.event.inputs.dt_api_token }}' )" >> "$GITHUB_ENV"
else
echo "use_cases=${{ env.DEFAULT_USE_CASES }}" >> "$GITHUB_ENV"
echo "providers=${{ env.DEFAULT_PROVIDERS }}" >> "$GITHUB_ENV"
echo "destroy_resources=${{ env.DESTROY_RESOURCES }}" >> "$GITHUB_ENV"
echo "custom_domain=${{ env.DEFAULT_CUSTOM_DOMAIN }}" >> "$GITHUB_ENV"
echo "dt_tenant=${{ env.DT_TENANT }}" >> "$GITHUB_ENV"
echo "dt_url_gen3=${{ env.DT_URL_GEN3 }}" >> "$GITHUB_ENV"
echo "dt_api_token=${{ env.DT_API_TOKEN }}" >> "$GITHUB_ENV"
fi
- name: Set Outputs
id: set_outputs
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "use_cases=$(echo '${{ github.event.inputs.use_cases }}' )" >> "$GITHUB_OUTPUT"
echo "providers=$(echo '${{ github.event.inputs.providers }}' )" >> "$GITHUB_OUTPUT"
echo "destroy_resources=$(echo '${{ github.event.inputs.destroy_resources }}' )" >> "$GITHUB_OUTPUT"
echo "custom_domain=$(echo '${{ github.event.inputs.custom_domain }}' )" >> "$GITHUB_OUTPUT"
echo "dt_tenant=$(echo '${{ github.event.inputs.dt_tenant }}' )" >> "$GITHUB_OUTPUT"
echo "dt_url_gen3=$(echo '${{ github.event.inputs.dt_url_gen3 }}' )" >> "$GITHUB_OUTPUT"
echo "dt_api_token=$(echo '${{ github.event.inputs.dt_api_token }}' )" >> "$GITHUB_OUTPUT"
else
echo "use_cases=${{ env.DEFAULT_USE_CASES }}" >> "$GITHUB_OUTPUT"
echo "providers=${{ env.DEFAULT_PROVIDERS }}" >> "$GITHUB_OUTPUT"
echo "destroy_resources=${{ env.DESTROY_RESOURCES }}" >> "$GITHUB_OUTPUT"
echo "custom_domain=${{ env.DEFAULT_CUSTOM_DOMAIN }}" >> "$GITHUB_OUTPUT"
echo "dt_tenant=${{ env.DT_TENANT }}" >> "$GITHUB_OUTPUT"
echo "dt_url_gen3=${{ env.DT_URL_GEN3 }}" >> "$GITHUB_OUTPUT"
echo "dt_api_token=${{ env.DT_API_TOKEN }}" >> "$GITHUB_OUTPUT"
fi
shell: bash
test_demo_usecases:
needs: set_env_vars
uses: ./.github/workflows/validation.yaml
with:
use_cases: ${{ needs.set_env_vars.outputs.use_cases }}
providers: ${{ needs.set_env_vars.outputs.providers }}
destroy_resources: ${{ needs.set_env_vars.outputs.destroy_resources == 'true' }}
custom_domain: ${{ needs.set_env_vars.outputs.custom_domain }}
dt_tenant: ${{ needs.set_env_vars.outputs.dt_tenant }}
dt_url_gen3: ${{ needs.set_env_vars.outputs.dt_url_gen3 }}
dt_oauth_sso_endpoint: ${{ vars.DT_OAUTH_SSO_ENDPOINT }}
dt_oauth_account_urn: ${{ vars.DT_OAUTH_ACCOUNT_URN }}
secrets:
dt_api_token: ${{ needs.set_env_vars.outputs.dt_api_token }}
gcp_credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}
dt_oauth_client_id: ${{ secrets.DT_OAUTH_CLIENT_ID }}
dt_oauth_client_secret: ${{ secrets.DT_OAUTH_CLIENT_SECRET }}