From f8c1bc2fc1cece94a5d6d840a8d8f88a2d558667 Mon Sep 17 00:00:00 2001 From: hossam-nasr Date: Tue, 14 May 2024 13:11:16 -0700 Subject: [PATCH] endgame --- azure-pipelines/1esstages.yml | 6 +-- azure-pipelines/templates/test.nightly.yml | 43 ---------------------- azure-pipelines/templates/test.yml | 33 +++++++++++++++++ 3 files changed, 34 insertions(+), 48 deletions(-) delete mode 100644 azure-pipelines/templates/test.nightly.yml diff --git a/azure-pipelines/1esstages.yml b/azure-pipelines/1esstages.yml index 723f9fe312..b694641d38 100644 --- a/azure-pipelines/1esstages.yml +++ b/azure-pipelines/1esstages.yml @@ -22,13 +22,9 @@ stages: - template: ./templates/setup.yml - template: ./templates/build.yml - template: ./templates/1espackage.yml - - template: ./templates/test.nightly.yml + - template: ./templates/test.yml parameters: useAzureFederatedCredentials: ${{ parameters.useAzureFederatedCredentials }} - # - ${{ if ne(parameters.useAzureFederatedCredentials, true) }}: - # - template: ./templates/test.yml - # - ${{ if eq(parameters.useAzureFederatedCredentials, true) }}: - # - template: ./templates/test.nightly.yml variables: artifact_name: ${{ job.name }} working_directory: ${{ job.working_directory }} diff --git a/azure-pipelines/templates/test.nightly.yml b/azure-pipelines/templates/test.nightly.yml deleted file mode 100644 index f511ee5791..0000000000 --- a/azure-pipelines/templates/test.nightly.yml +++ /dev/null @@ -1,43 +0,0 @@ -parameters: - - name: useAzureFederatedCredentials - type: boolean - default: false - -steps: - # This gives the AzCodeE2ETests service connection access to this pipeline. - - ${{ if eq(parameters.useAzureFederatedCredentials, true) }}: - - task: AzureKeyVault@1 - displayName: "\U0001F449 Authorize AzCodeE2ETests service connection" - inputs: - azureSubscription: 'AzCodeE2ETests' - KeyVaultName: 'AzCodeE2ETestsDummyKV' - condition: eq(variables['AzCode_UseAzureFederatedCredentials'], true) - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - - # This task obtains the values necessary to connect to the AzCodeE2ETests service connection from the AzCodeE2ETestsCredKV key vault. - - ${{ if eq(parameters.useAzureFederatedCredentials, true) }}: - - task: AzureKeyVault@2 - displayName: "\U0001F449 Get AzCodeE2ETests service connection secrets" - inputs: - azureSubscription: 'AzCodeE2ETestsCreds' - KeyVaultName: 'AzCodeE2ETestsCredsKV' - SecretsFilter: 'AzCodeServiceConnectionID, AzCodeServiceConnectionDomain, AzCodeServiceConnectionClientID' - RunAsPreJob: true - condition: eq(variables['AzCode_UseAzureFederatedCredentials'], true) - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - - - task: Npm@1 - displayName: "\U0001F449 Test" - inputs: - command: custom - customCommand: test - workingDir: $(working_directory) - condition: succeeded() - env: - DISPLAY: :99 # Only necessary for linux tests - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - AzCode_ServiceConnectionID: $(AzCodeServiceConnectionID) - AzCode_ServiceConnectionDomain: $(AzCodeServiceConnectionDomain) - AzCode_ServiceConnectionClientID: $(AzCodeServiceConnectionClientID) diff --git a/azure-pipelines/templates/test.yml b/azure-pipelines/templates/test.yml index 30e2b6628a..f6cb6b34b8 100644 --- a/azure-pipelines/templates/test.yml +++ b/azure-pipelines/templates/test.yml @@ -1,4 +1,31 @@ +parameters: + - name: useAzureFederatedCredentials + type: boolean + default: false + steps: + # This gives the AzCodeE2ETests service connection access to this pipeline. + - ${{ if eq(parameters.useAzureFederatedCredentials, true) }}: + - task: AzureKeyVault@1 + displayName: "\U0001F449 Authorize AzCodeE2ETests service connection" + inputs: + azureSubscription: 'AzCodeE2ETests' + KeyVaultName: 'AzCodeE2ETestsDummyKV' + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + + # This task obtains the values necessary to connect to the AzCodeE2ETests service connection from the AzCodeE2ETestsCredKV key vault. + - ${{ if eq(parameters.useAzureFederatedCredentials, true) }}: + - task: AzureKeyVault@2 + displayName: "\U0001F449 Get AzCodeE2ETests service connection secrets" + inputs: + azureSubscription: 'AzCodeE2ETestsCreds' + KeyVaultName: 'AzCodeE2ETestsCredsKV' + SecretsFilter: 'AzCodeServiceConnectionID, AzCodeServiceConnectionDomain, AzCodeServiceConnectionClientID' + RunAsPreJob: true + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + - task: Npm@1 displayName: "\U0001F449 Test" inputs: @@ -8,3 +35,9 @@ steps: condition: succeeded() env: DISPLAY: :99 # Only necessary for linux tests + ${{ if eq(parameters.useAzureFederatedCredentials, true) }}: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + AzCode_ServiceConnectionID: $(AzCodeServiceConnectionID) + AzCode_ServiceConnectionDomain: $(AzCodeServiceConnectionDomain) + AzCode_ServiceConnectionClientID: $(AzCodeServiceConnectionClientID) +