-
Notifications
You must be signed in to change notification settings - Fork 371
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 support for Azure clouds #2771
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# variables: | ||
# | ||
# NOTE: When creating the pipeline, "connection_info" must be added as a variable pointing to the | ||
# corresponding key vault; see wiki for details. | ||
# | ||
|
||
parameters: | ||
# See the test wiki for a description of the parameters | ||
- name: test_suites | ||
|
@@ -44,23 +50,6 @@ parameters: | |
- failed | ||
- no | ||
|
||
variables: | ||
- name: azureConnection | ||
value: 'azuremanagement' | ||
# These variables exposed the above parameters as environment variables | ||
- name: test_suites | ||
value: ${{ parameters.test_suites }} | ||
- name: image | ||
value: ${{ parameters.image }} | ||
- name: location | ||
value: ${{ parameters.location }} | ||
- name: vm_size | ||
value: ${{ parameters.vm_size }} | ||
- name: collect_logs | ||
value: ${{ parameters.collect_logs }} | ||
- name: keep_environment | ||
value: ${{ parameters.keep_environment }} | ||
|
||
trigger: | ||
- develop | ||
|
||
|
@@ -73,36 +62,48 @@ jobs: | |
- job: "ExecuteTests" | ||
|
||
steps: | ||
- task: UsePythonVersion@0 | ||
displayName: "Set Python Version" | ||
inputs: | ||
versionSpec: '3.10' | ||
addToPath: true | ||
architecture: 'x64' | ||
|
||
# Extract the Azure cloud from the "connection_info" variable and store it in the "cloud" variable. | ||
# The cloud name is used as a suffix of the value for "connection_info" and comes after the last '-'. | ||
- bash: echo "##vso[task.setvariable variable=cloud]$(echo $CONNECTION_INFO | sed 's/^.*-//')" | ||
displayName: "Set Cloud type" | ||
|
||
- task: DownloadSecureFile@1 | ||
name: downloadSshKey | ||
displayName: "Download SSH key" | ||
inputs: | ||
secureFile: 'id_rsa' | ||
|
||
- task: AzureKeyVault@2 | ||
displayName: "Fetch secrets from KV" | ||
displayName: "Fetch connection info" | ||
inputs: | ||
azureSubscription: '$(azureConnection)' | ||
KeyVaultName: 'dcrV2SPs' | ||
azureSubscription: 'azuremanagement' | ||
KeyVaultName: '$(connection_info)' | ||
SecretsFilter: '*' | ||
RunAsPreJob: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'RunAsPreJob' makes the secrets available to all the tasks, this is not needed since the only task that uses them is "Execute tests". I removed this parameter to use the default value (false), which makes the secrets available only to the next task and I moved the task to precede "Execute tests". |
||
|
||
- task: UsePythonVersion@0 | ||
displayName: "Set Python Version" | ||
inputs: | ||
versionSpec: '3.10' | ||
addToPath: true | ||
architecture: 'x64' | ||
|
||
- bash: $(Build.SourcesDirectory)/tests_e2e/pipeline/scripts/execute_tests.sh | ||
displayName: "Execute tests" | ||
continueOnError: true | ||
env: | ||
# Add all KeyVault secrets explicitly as they're not added by default to the environment vars | ||
SUBSCRIPTION_ID: $(SUBSCRIPTION-ID) | ||
AZURE_CLIENT_ID: $(AZURE-CLIENT-ID) | ||
AZURE_CLIENT_SECRET: $(AZURE-CLIENT-SECRET) | ||
AZURE_TENANT_ID: $(AZURE-TENANT-ID) | ||
SUBSCRIPTION_ID: $(SUBSCRIPTION-ID) | ||
CR_USER: $(CR-USER) | ||
CR_SECRET: $(CR-SECRET) | ||
CLOUD: ${{ variables.cloud }} | ||
COLLECT_LOGS: ${{ parameters.collect_logs }} | ||
IMAGE: ${{ parameters.image }} | ||
KEEP_ENVIRONMENT: ${{ parameters.keep_environment }} | ||
LOCATION: ${{ parameters.location }} | ||
TEST_SUITES: ${{ parameters.test_suites }} | ||
VM_SIZE: ${{ parameters.vm_size }} | ||
|
||
- publish: $(Build.ArtifactStagingDirectory) | ||
artifact: 'artifacts' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These variables are used only by the "Execute tests" tasks, so I removed them and referenced the parameters directly in that task.