Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment scripts #72

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/devcontainer_run_command/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ runs:
- name: Construct TRE_URL
shell: bash
run: |
source devops/scripts/construct_tre_url.sh
source .github/scripts/construct_tre_url.sh
tre_url=$(construct_tre_url "${{ inputs.TRE_ID }}" "${{ inputs.LOCATION }}" "${{ env.AZURE_ENVIRONMENT }}")
echo "TRE_URL=$tre_url" >> $GITHUB_ENV

- name: Construct ARM_ENVIRONMENT
shell: bash
run: |
source devops/scripts/convert_azure_env_to_arm_env.sh
source .github/scripts/convert_azure_env_to_arm_env.sh
arm_environment=$(convert_azure_env_to_arm_env "${{ env.AZURE_ENVIRONMENT }}")
echo "ARM_ENVIRONMENT=$arm_environment" >> $GITHUB_ENV

Expand Down
15 changes: 15 additions & 0 deletions .github/scripts/construct_tre_url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# This script is designed to be `source`d to create reusable helper functions

function construct_tre_url()
{
tre_id=$1
location=$2
azure_environment=$3

declare -A cloudapp_endpoint_suffixes=( ["AzureCloud"]="cloudapp.azure.com" ["AzureUSGovernment"]="cloudapp.usgovcloudapi.net" )
domain=${cloudapp_endpoint_suffixes[${azure_environment}]}

echo https://"${tre_id}"."${location}"."${domain}"
}
10 changes: 10 additions & 0 deletions .github/scripts/convert_azure_env_to_arm_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# This script is designed to be `source`d to create reusable helper functions

function convert_azure_env_to_arm_env()
{
azure_environment=$1
declare -A arm_envs=( ["AzureCloud"]="public" ["AzureUSGovernment"]="usgovernment")
echo "${arm_envs[${azure_environment}]}"
}