You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Used for resource names, eg adlsnlangley1602c96a22d or adlsci09498d47f45. This should give enough uiniqueness to allow parallel environments, while showing the build reason and owner
# We need the object id of the Enterprise Application created from the App Registration in order to set permissions in the ARM template. This is **not** the same as the app/client id
24
49
echo"Retriving service principal id for the logged in user..."
25
50
SERVICEPRINCIPALAPPID=$(az account show | jq --raw-output '.user.name')
26
-
echo"Service Principal App/Client Id: $SERVICEPRINCIPALAPPID"
51
+
#echo "Service Principal App/Client Id: $SERVICEPRINCIPALAPPID"
27
52
SERVICEPRINCIPALID=$( az ad sp list --filter "appId eq '$SERVICEPRINCIPALAPPID' and servicePrincipalType eq 'Application'" --query [0].objectId --output tsv)
28
-
echo"Service Principal Object Id: $SERVICEPRINCIPALID"
53
+
#echo "Service Principal Object Id: $SERVICEPRINCIPALID"
29
54
30
55
31
56
# Build a JSON snippet with the client/app id, object id and client secret for the devops SPN. This is used by the ARM template to grant permissions on resources so that the devops SPN
32
57
# can deploy code into them. The ARM template generates the required .runsettings file for the integration tests as an output, which reuses the devops SPN to access resources to test.
# DEBUG: Use this to get the full deployment output JSON. If the ARM template outputs a full reference to a resource, we can find the bits we need easily.
# --raw-output is requiored on all jq commands that select strings, otherwise they come out with the quotes, which is interpreted as a command, and it likely won't exist!
# azcliversion: 2.24.0 # Versions prior to this have a bug creating environments
75
80
# This runs in a container, so all output is passed back using 'echo "::set-output name=OUTPUT_VAR_NAME::value here"', as files created won't persist.
81
+
# Note: Environment variables passed in (as env:... above) break if they contain quotes and newlines, eg multiline JSON. The export commands below work correctly as long as the bash
82
+
# quoting rules are followed.
76
83
inlineScript: |
77
-
# We need the secrets in an environment variable so they get passed to our shell script that does the work
# --raw-output is requiored on all jq commands that select strings, otherwise they come out with the quotes, which is interpreted as a command, and it likely won't exist!
145
+
- name: Teardown DevTest Labs Environment
146
+
id: teardown-devtest-labs-environment
147
+
if: ${{ (github.event_name != 'workflow_dispatch') && (success() || failure()) }} # run this step even if previous step failed
# This runs in a container, so all output is passed back using 'echo "::set-output name=OUTPUT_VAR_NAME::value here"', as files created won't persist.
154
+
# Note: Environment variables passed in (as env:... above) break if they contain quotes and newlines, eg multiline JSON. The export commands below work correctly as long as the bash
155
+
# quoting rules are followed.
156
+
inlineScript: |
157
+
# Get the prvisioing state for the RG created for the lab
158
+
echo "Lab Name: $ENVIRONMENT_INSTANCE_NAME"
159
+
echo "Checking provisioning state of lab resource group $ENVIRONMENT_INSTANCE_RESOURCE_GROUP_NAME"
160
+
PROVISIONING_STATE=$(az deployment group list --resource-group $ENVIRONMENT_INSTANCE_RESOURCE_GROUP_NAME --query 'sort_by([*], &properties.timestamp)[0].properties.provisioningState' | sed -e 's/^"//' -e 's/"$//')
161
+
162
+
echo "Povisioning State: $PROVISIONING_STATE"
163
+
164
+
if [ ! -z "$PROVISIONING_STATE" ]; then
165
+
echo "Deleting lab $ENVIRONMENT_INSTANCE_NAME"
166
+
az lab environment delete --resource-group "$RESOURCE_GROUP" --lab-name "$LAB_NAME" --name "$ENVIRONMENT_INSTANCE_NAME"
167
+
fi
168
+
142
169
143
170
- name: Publish Test Report
144
171
uses: dorny/test-reporter@v1
145
-
if: success() || failure() # run this step even if previous step failed
172
+
if: success() || failure() # run this step even if previous step failed
146
173
with:
147
174
name: Tests # Name of the check run which will be created
0 commit comments