1
0
mirror of synced 2025-12-30 12:02:01 -05:00

Cleanup preview env workflow variables (#25160)

* cleanup staging action vars, prep for OS deploy workflow

* fix app_url
This commit is contained in:
Mike Surowiec
2022-02-09 09:12:26 -06:00
committed by GitHub
parent 73f680106e
commit e2a35b3c38
5 changed files with 17 additions and 18 deletions

View File

@@ -47,8 +47,6 @@ jobs:
url: ${{ env.APP_URL }}
env:
PR_NUMBER: ${{ github.event.number || github.event.inputs.PR_NUMBER }}
NONPROD_REGISTRY_USERNAME: ghdocs
APP_LOCATION: eastus
ENABLE_EARLY_ACCESS: ${{ github.repository == 'github/docs-internal' }}
steps:
@@ -61,7 +59,7 @@ jobs:
uses: azure/docker-login@81744f9799e7eaa418697cb168452a2882ae844a
with:
login-server: ${{ secrets.NONPROD_REGISTRY_SERVER }}
username: ${{ env.NONPROD_REGISTRY_USERNAME }}
username: ${{ secrets.NONPROD_REGISTRY_USERNAME }}
password: ${{ secrets.NONPROD_REGISTRY_PASSWORD }}
- name: Set up Docker Buildx
@@ -80,7 +78,7 @@ jobs:
- name: Get preview app info
env:
APP_NAME_SEED: ${{ secrets.APP_NAME_SEED }}
APP_NAME_SEED: ${{ secrets.PREVIEW_ENV_NAME_SEED }}
run: .github/actions-scripts/get-preview-app-info.sh
- name: 'Set env vars'
@@ -150,7 +148,7 @@ jobs:
# Succeed despite any non-zero exit code (e.g. if there is no deployment to cancel)
- name: 'Cancel any existing deployments for this PR'
run: |
az deployment group cancel --name ${{ env.DEPLOYMENT_NAME }} -g ${{ env.RESOURCE_GROUP }} || true
az deployment group cancel --name ${{ env.DEPLOYMENT_NAME }} -g ${{ secrets.PREVIEW_ENV_RESOURCE_GROUP }} || true
# Deploy ARM template is idempotent
# Note: once the resources exist the image tag must change for a new deployment to occur (the image tag includes workflow run number, run attempt, as well as sha)
@@ -158,14 +156,16 @@ jobs:
id: deploy
uses: azure/arm-deploy@841b12551939c88af8f6df767c24c38a5620fd0d
with:
resourceGroupName: ${{ env.RESOURCE_GROUP }}
resourceGroupName: ${{ secrets.PREVIEW_ENV_RESOURCE_GROUP }}
subscriptionId: ${{ secrets.NONPROD_SUBSCRIPTION_ID }}
template: ./azure-preview-env-template.json
deploymentName: ${{ env.DEPLOYMENT_NAME }}
parameters: appName="${{ env.APP_NAME }}"
location="${{ env.APP_LOCATION }}"
location="${{ env.PREVIEW_ENV_LOCATION }}"
containerImage="${{ env.DOCKER_IMAGE }}"
dockerRegistryUrl="${{ secrets.NONPROD_REGISTRY_SERVER }}"
dockerRegistryUsername="${{ env.NONPROD_REGISTRY_USERNAME }}"
dockerRegistryUsername="${{ secrets.NONPROD_REGISTRY_USERNAME }}"
dockerRegistryPassword="${{ secrets.NONPROD_REGISTRY_PASSWORD }}"
# this shows warnings in the github actions console, because the flag is passed through a validation run,
# but it *is* functional during the actual execution
additionalArguments: --no-wait

View File

@@ -24,7 +24,6 @@ jobs:
timeout-minutes: 5
env:
PR_NUMBER: ${{ github.event.number || github.event.inputs.PR_NUMBER }}
NONPROD_REGISTRY_NAME: ghdocs
steps:
- name: 'Az CLI login'
@@ -37,25 +36,25 @@ jobs:
- name: Get preview app info
env:
APP_NAME_SEED: ${{ secrets.APP_NAME_SEED }}
APP_NAME_SEED: ${{ secrets.PREVIEW_ENV_NAME_SEED }}
run: .github/actions-scripts/get-preview-app-info.sh
# Succeed despite any non-zero exit code (e.g. if there is no deployment to cancel)
- name: 'Cancel any in progress deployments'
run: |
az deployment group cancel --name ${{ env.DEPLOYMENT_NAME }} -g ${{ env.RESOURCE_GROUP }} || true
az deployment group cancel --name ${{ env.DEPLOYMENT_NAME }} -g ${{ secrets.PREVIEW_ENV_RESOURCE_GROUP }} || true
# Delete web app (which will also delete the App Service plan)
# This will succeed even if the app doesn't exist / has already been deleted
- name: 'Delete App Service App (which will also delete the App Service plan)'
run: |
az container delete -n ${{ env.APP_NAME }} -g ${{ env.RESOURCE_GROUP }} -y
az container delete -n ${{ env.APP_NAME }} -g ${{ secrets.PREVIEW_ENV_RESOURCE_GROUP }} -y
# Untag all images under this PR's container registry repo - the container registry will automatically remove untagged images.
# This will fail if the IMAGE_REPO doesn't exist, but we don't care
- name: 'Untag all docker images for this PR'
run: |
az acr repository delete -n ${{ env.NONPROD_REGISTRY_NAME }} --repository ${{ env.IMAGE_REPO }} -y || true
az acr repository delete -n ${{ secrets.NONPROD_REGISTRY_NAME }} --repository ${{ env.IMAGE_REPO }} -y || true
# Remove all GitHub deployments from this environment and remove the environment
- uses: strumwolf/delete-deployment-environment@45c821e46baa405e25410700fe2e9643929706a0

View File

@@ -53,7 +53,7 @@ jobs:
- name: Get preview app info
env:
APP_NAME_SEED: ${{ secrets.APP_NAME_SEED }}
APP_NAME_SEED: ${{ secrets.PREVIEW_ENV_NAME_SEED }}
run: .github/actions-scripts/get-preview-app-info.sh
- name: Setup Node