Deploy demo steps optimization #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |