Skip to content

Commit

Permalink
Hide output from 'az containerapp' commands, show FQDN at end of action
Browse files Browse the repository at this point in the history
  • Loading branch information
cormacpayne committed Oct 10, 2023
1 parent 29cdfec commit 45eb493
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ runs:
run: |
az group show \
-n ${{ env.CA_GH_ACTION_RESOURCE_GROUP }} \
-o none && CA_GH_ACTION_RG_EXISTS=true || CA_GH_ACTION_RG_EXISTS=false
--output none && CA_GH_ACTION_RG_EXISTS=true || CA_GH_ACTION_RG_EXISTS=false
echo "CA_GH_ACTION_RG_EXISTS=${CA_GH_ACTION_RG_EXISTS}" >> $GITHUB_ENV
- name: Get default location for Container Apps to use if resource group doesn't exist and location wasn't provided
Expand Down Expand Up @@ -344,7 +344,7 @@ runs:
az containerapp show \
-g ${{ env.CA_GH_ACTION_RESOURCE_GROUP }} \
-n ${{ inputs.containerAppName }} \
-o none && CA_GH_ACTION_RESOURCE_EXISTS=true || CA_GH_ACTION_RESOURCE_EXISTS=false
--output && CA_GH_ACTION_RESOURCE_EXISTS=true || CA_GH_ACTION_RESOURCE_EXISTS=false
echo "CA_GH_ACTION_RESOURCE_EXISTS=${CA_GH_ACTION_RESOURCE_EXISTS}" >> $GITHUB_ENV
- name: Export environment to environment variable
Expand All @@ -368,7 +368,7 @@ runs:
az containerapp env show \
-g ${{ env.CA_GH_ACTION_RESOURCE_GROUP }} \
-n ${{ env.CA_GH_ACTION_CONTAINER_APP_ENVIRONMENT }} \
-o none && CA_GH_ACTION_ENVIRONMENT_EXISTS=true || CA_GH_ACTION_ENVIRONMENT_EXISTS=false
--output none && CA_GH_ACTION_ENVIRONMENT_EXISTS=true || CA_GH_ACTION_ENVIRONMENT_EXISTS=false
echo "CA_GH_ACTION_ENVIRONMENT_EXISTS=${CA_GH_ACTION_ENVIRONMENT_EXISTS}" >> $GITHUB_ENV
- name: Reuse an existing Container App environment if found in the resource group
Expand Down Expand Up @@ -588,7 +588,8 @@ runs:
az containerapp create \
-g ${{ env.CA_GH_ACTION_RESOURCE_GROUP }} \
-n ${{ inputs.containerAppName }} \
--yaml ${{ inputs.yamlConfigPath }}
--yaml ${{ inputs.yamlConfigPath }} \
--output none
- name: Create the Container App from provided arguments
if: ${{ env.CA_GH_ACTION_YAML_PROVIDED != 'true' && env.CA_GH_ACTION_RESOURCE_EXISTS == 'false' }}
Expand All @@ -602,7 +603,8 @@ runs:
${{ env.CA_GH_ACTION_INGRESS_ARG }} \
${{ env.CA_GH_ACTION_TARGET_PORT_ARG }} \
${{ env.CA_GH_ACTION_REGISTRY_LOGIN_ARG }} \
${{ env.CA_GH_ACTION_CONTAINER_APP_ENVIRONMENT_VARIABLES_ARG }}
${{ env.CA_GH_ACTION_CONTAINER_APP_ENVIRONMENT_VARIABLES_ARG }} \
--output none
- name: Update the existing Container App from a YAML configuration file
if: ${{ env.CA_GH_ACTION_YAML_PROVIDED == 'true' && env.CA_GH_ACTION_RESOURCE_EXISTS == 'true' }}
Expand All @@ -611,7 +613,8 @@ runs:
az containerapp update \
-g ${{ env.CA_GH_ACTION_RESOURCE_GROUP }} \
-n ${{ inputs.containerAppName }} \
--yaml ${{ inputs.yamlConfigPath }}
--yaml ${{ inputs.yamlConfigPath }} \
--output none
- name: Determine whether or not 'update' or 'up' should be used
if: ${{ env.CA_GH_ACTION_YAML_PROVIDED != 'true' && env.CA_GH_ACTION_RESOURCE_EXISTS == 'true' && (inputs.targetPort != '' || inputs.ingress != '') }}
Expand Down Expand Up @@ -639,7 +642,8 @@ runs:
-g ${{ env.CA_GH_ACTION_RESOURCE_GROUP }} \
-n ${{ inputs.containerAppName }} \
-i ${{ env.CA_GH_ACTION_IMAGE_TO_DEPLOY }} \
${{ env.CA_GH_ACTION_CONTAINER_APP_ENVIRONMENT_VARIABLES_ARG }}
${{ env.CA_GH_ACTION_CONTAINER_APP_ENVIRONMENT_VARIABLES_ARG }} \
--output none
- name: Reset the ingress argument environment variable if it wasn't provided (use default ingress value)
if: ${{ inputs.ingress == '' && env.CA_GH_ACTION_YAML_PROVIDED != 'true' && env.CA_GH_ACTION_RESOURCE_EXISTS == 'true' }}
Expand All @@ -666,7 +670,8 @@ runs:
${{ env.CA_GH_ACTION_TARGET_PORT_ARG }} \
${{ env.CA_GH_ACTION_INGRESS_ARG }} \
${{ env.CA_GH_ACTION_CONTAINER_APP_ENVIRONMENT_VARIABLES_ARG }} \
${{ env.CA_GH_ACTION_REGISTRY_LOGIN_ARG }}
${{ env.CA_GH_ACTION_REGISTRY_LOGIN_ARG }} \
--output none
- name: Disable ingress on the existing Container App
if: ${{ env.CA_GH_ACTION_RESOURCE_EXISTS == 'true' && inputs.ingress == 'disabled' && env.CA_GH_ACTION_YAML_PROVIDED != 'true' }}
Expand Down Expand Up @@ -713,6 +718,14 @@ runs:
CA_GH_ACTION_SCENARIO_ARG="--property 'scenario=used-builder'"
echo "CA_GH_ACTION_SCENARIO_ARG=${CA_GH_ACTION_SCENARIO_ARG}" >> $GITHUB_ENV
- name: Output Container App's FQDN
shell: bash
run: |
CA_GH_ACTION_CONTAINER_APP_FQDN=$(az containerapp show -g ${{ env.CA_GH_ACTION_RESOURCE_GROUP }} -n ${{ inputs.containerAppName }} --query 'properties.configuration.ingress.fqdn')
if [[ -n "${CA_GH_ACTION_CONTAINER_APP_FQDN}" ]]; then
echo "Azure Container App can be accessed via the following FQDN: ${CA_GH_ACTION_CONTAINER_APP_FQDN}"
fi
- name: Log telemetry for action
if: ${{ always() && inputs.disableTelemetry == 'false' }}
shell: bash
Expand Down

0 comments on commit 45eb493

Please sign in to comment.