Helm with dashboard changes #23
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: CLOUD-CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
# Grant permissions to obtain federated identity credentials | |
# see https://docs.github.com/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure | |
# Also grant permissions to publish test results | |
permissions: | |
id-token: write | |
contents: read | |
checks: write | |
pull-requests: write | |
# Update this value with a unique name to guarantee uniqueness of resource names and avoid conflicts between fork repositories when running CD workflow. | |
# CD workflow creates resources with this prefix and destroy them. | |
env: | |
CD_RESOURCES_PREFIX: mvd | |
jobs: | |
# The purpose of this job is only to set up resources_prefix as an output, because env context is not available in arguments to a called workflow | |
# See this discussion for more context: https://github.community/t/reusable-workflow-env-context-not-available-in-jobs-job-id-with/206111/13 | |
SetResourcesPrefix: | |
name: 'Set Resources Prefix' | |
runs-on: ubuntu-latest | |
# Added a step doing nothing, because a job needs to have at least one step. | |
steps: | |
- name: 'Set resources prefix' | |
run: | | |
# creates a random string consisting of 3 lower case characters | |
echo "CD_RESOURCES_PREFIX=$(tr -dc a-z </dev/urandom | tail -n +1 | head -c 7; echo '')" >> $GITHUB_ENV | |
- name: 'Test resources prefix' | |
run: echo $CD_RESOURCES_PREFIX | |
outputs: | |
resources_prefix: ${{ env.CD_RESOURCES_PREFIX }} #${{ github.run_number }} | |
# Temporary step that checks if Azure secrets are set up. If not then the deploy of Azure resources will be skipped. Introduced to not fail checks in PRs from forks. | |
Check-Cloud-Environments: | |
name: 'Check if Azure secrets are set up' | |
runs-on: ubuntu-latest | |
steps: | |
- id: has-azure | |
env: | |
HAS_AZURE: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
if: "${{ env.HAS_AZURE != '' }}" | |
run: echo "defined=true" >> $GITHUB_OUTPUT | |
outputs: | |
has-azure: ${{ steps.has-azure.outputs.defined }} | |
Deploy: | |
if: ${{ needs.Check-Cloud-Environments.outputs.has-azure == 'true' }} | |
uses: ./.github/workflows/run_azure_dataspace_tests.yaml | |
secrets: inherit | |
needs: | |
- SetResourcesPrefix | |
- Check-Cloud-Environments | |
with: | |
resources_prefix: ${{ needs.SetResourcesPrefix.outputs.resources_prefix }} |