From 5ff617d2570beca6d4d5a5dbd56fee7301e9fcb1 Mon Sep 17 00:00:00 2001 From: TristanWatanabe Date: Fri, 26 Jul 2024 13:41:33 -0400 Subject: [PATCH 1/4] chore: move create policy to runpublishvrscreenshot --- .devops/templates/runpublishvrscreenshot.yml | 15 +++++++ azure-pipelines.vrt-pr.yml | 44 -------------------- 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/.devops/templates/runpublishvrscreenshot.yml b/.devops/templates/runpublishvrscreenshot.yml index 6849c169cc9e84..5636482c574767 100644 --- a/.devops/templates/runpublishvrscreenshot.yml +++ b/.devops/templates/runpublishvrscreenshot.yml @@ -1,3 +1,6 @@ +variables: + - template: .devops/templates/variables.yml + parameters: - name: fluentVersion type: string @@ -54,3 +57,15 @@ steps: ArtifactName: 'vrscreenshot${{ parameters.fluentVersion }}' publishLocation: 'Container' condition: eq(variables['vrTestSkip'], 'no') + + - bash: | + set -exuo pipefail + yarn vr-app create-policy --nonBlockingPipelines '{"$(pipelineId)":{"pipelineStatus": "PENDING","pipelineName": "$(pipelineName)"}}' --clientType 'FLUENTUI' + displayName: VR App - Create Policy + env: + VR_APP_API_URL: $(VR_APP_API_URL) + TENANT_ID: $(TenantId) + PRINCIPAL_CLIENT_ID: $(PrincipalClientId) + SERVICE_CONNECTION_ID: $(ServiceConnectionId) + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: eq(variables.isPR, true) diff --git a/azure-pipelines.vrt-pr.yml b/azure-pipelines.vrt-pr.yml index fbeb97ed538efa..23205e4465e1d6 100644 --- a/azure-pipelines.vrt-pr.yml +++ b/azure-pipelines.vrt-pr.yml @@ -33,17 +33,6 @@ jobs: vrTestPackageName: '@fluentui/vr-tests-web-components' vrTestPackagePath: 'apps/vr-tests-web-components' - - bash: | - set -exuo pipefail - yarn vr-app create-policy --nonBlockingPipelines '{"$(pipelineId)":{"pipelineStatus": "PENDING","pipelineName": "$(pipelineName)"}}' --clientType 'FLUENTUI' - displayName: VR App - Create Policy - env: - VR_APP_API_URL: $(VR_APP_API_URL) - TENANT_ID: $(TenantId) - PRINCIPAL_CLIENT_ID: $(PrincipalClientId) - SERVICE_CONNECTION_ID: $(ServiceConnectionId) - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - - task: AzureCLI@2 displayName: 'Run fluentui-screenshotdiff' env: @@ -83,17 +72,6 @@ jobs: vrTestPackageName: '@fluentui/vr-tests-react-components' vrTestPackagePath: 'apps/vr-tests-react-components' - - bash: | - set -exuo pipefail - yarn vr-app create-policy --nonBlockingPipelines '{"$(pipelineId)":{"pipelineStatus": "PENDING","pipelineName": "$(pipelineName)"}}' --clientType 'FLUENTUI' - displayName: VR App - Create Policy - env: - VR_APP_API_URL: $(VR_APP_API_URL) - TENANT_ID: $(TenantId) - PRINCIPAL_CLIENT_ID: $(PrincipalClientId) - SERVICE_CONNECTION_ID: $(ServiceConnectionId) - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - - task: AzureCLI@2 displayName: 'Run fluentui-screenshotdiff' env: @@ -132,17 +110,6 @@ jobs: vrTestPackageName: '@fluentui/vr-tests' vrTestPackagePath: 'apps/vr-tests' - - bash: | - set -exuo pipefail - yarn vr-app create-policy --nonBlockingPipelines '{"$(pipelineId)":{"pipelineStatus": "PENDING","pipelineName": "$(pipelineName)"}}' --clientType 'FLUENTUI' - displayName: VR App - Create Policy - env: - VR_APP_API_URL: $(VR_APP_API_URL) - TENANT_ID: $(TenantId) - PRINCIPAL_CLIENT_ID: $(PrincipalClientId) - SERVICE_CONNECTION_ID: $(ServiceConnectionId) - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - - task: AzureCLI@2 displayName: 'Run fluentui-screenshotdiff' env: @@ -182,17 +149,6 @@ jobs: vrTestPackageName: '@fluentui/docs' vrTestPackagePath: 'packages/fluentui/docs' - - bash: | - set -exuo pipefail - yarn vr-app create-policy --nonBlockingPipelines '{"$(pipelineId)":{"pipelineStatus": "PENDING","pipelineName": "$(pipelineName)"}}' --clientType 'FLUENTUI' - displayName: VR App - Create Policy - env: - VR_APP_API_URL: $(VR_APP_API_URL) - TENANT_ID: $(TenantId) - PRINCIPAL_CLIENT_ID: $(PrincipalClientId) - SERVICE_CONNECTION_ID: $(ServiceConnectionId) - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - - task: AzureCLI@2 displayName: 'Run fluentui-screenshotdiff' env: From 188200e571f2601f3b30d6784fa238c6e51809ed Mon Sep 17 00:00:00 2001 From: TristanWatanabe Date: Fri, 26 Jul 2024 13:48:56 -0400 Subject: [PATCH 2/4] set isPR variable --- .devops/templates/runpublishvrscreenshot.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.devops/templates/runpublishvrscreenshot.yml b/.devops/templates/runpublishvrscreenshot.yml index 5636482c574767..995a4f2ca567ce 100644 --- a/.devops/templates/runpublishvrscreenshot.yml +++ b/.devops/templates/runpublishvrscreenshot.yml @@ -1,6 +1,3 @@ -variables: - - template: .devops/templates/variables.yml - parameters: - name: fluentVersion type: string @@ -25,6 +22,7 @@ steps: - script: | isPR=${{lower(eq(variables['Build.Reason'], 'PullRequest'))}} echo $isPR + echo "##vso[task.setvariable variable=isPR;]$isPR" if [[ $isPR == true ]]; then packageAffected=$(yarn --silent check:affected --package ${{ parameters.vrTestPackageName }}) if [[ $packageAffected == false ]]; then From 4965ffba157baad45390ae9ad9b40736564708c8 Mon Sep 17 00:00:00 2001 From: TristanWatanabe Date: Mon, 29 Jul 2024 12:11:39 -0400 Subject: [PATCH 3/4] Move Run fluentui-screenshotdiff to runpublishvrscreenshot --- .devops/templates/runpublishvrscreenshot.yml | 29 ++++++ azure-pipelines.vrt-pr.yml | 92 +++----------------- 2 files changed, 41 insertions(+), 80 deletions(-) diff --git a/.devops/templates/runpublishvrscreenshot.yml b/.devops/templates/runpublishvrscreenshot.yml index 995a4f2ca567ce..fcb77f7294ebb5 100644 --- a/.devops/templates/runpublishvrscreenshot.yml +++ b/.devops/templates/runpublishvrscreenshot.yml @@ -8,6 +8,15 @@ parameters: - name: vrTestPackagePath type: string default: 'apps/vr-tests' + - name: locationPrefix + type: string + default: fluentuiv8 + - name: locationPostfix + type: string + default: vrscreenshotv8 + - name: clientName + type: string + default: fluentuiv8 steps: - task: Bash@3 @@ -67,3 +76,23 @@ steps: SERVICE_CONNECTION_ID: $(ServiceConnectionId) SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: eq(variables.isPR, true) + + - task: AzureCLI@2 + displayName: 'Run fluentui-screenshotdiff' + env: + API_TOKEN: $(fabric-public-pipeline-access-PAT) + GITHUB_API_TOKEN: $(githubRepoStatusPAT) + VR_APP_API_URL: $(VR_APP_API_URL) + STORAGE_ACCOUNT_ID: $(StorageAccountId) + TENANT_ID: $(TenantId) + PRINCIPAL_CLIENT_ID: $(PrincipalClientId) + SERVICE_CONNECTION_ID: $(ServiceConnectionId) + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + azureSubscription: $(AzureSubscription) + scriptType: bash + scriptLocation: 'inlineScript' + # ciDefinitionId is set to 205 because that is the ID of the baseline pipeline (https://uifabric.visualstudio.com/fabricpublic/_build?definitionId=205) used by the master branch + inlineScript: | + yarn vr-app run-diff --screenshotsDirectory ./screenshots --buildType pr --clientType "FLUENTUI" --ciDefinitionId 205 --groupName $(pipelineName) --locationPrefix ${{ parameters.locationPrefix }} --locationPostfix ${{ parameters.locationPostfix }} --pipelineId $(pipelineId) --clientName ${{ parameters.clientName }} --threshold '0.04' --cumThreshold '1' + condition: eq(variables['vrTestSkip'], 'no') diff --git a/azure-pipelines.vrt-pr.yml b/azure-pipelines.vrt-pr.yml index 23205e4465e1d6..54a0bfed17430f 100644 --- a/azure-pipelines.vrt-pr.yml +++ b/azure-pipelines.vrt-pr.yml @@ -32,26 +32,9 @@ jobs: fluentVersion: webcomponents vrTestPackageName: '@fluentui/vr-tests-web-components' vrTestPackagePath: 'apps/vr-tests-web-components' - - - task: AzureCLI@2 - displayName: 'Run fluentui-screenshotdiff' - env: - API_TOKEN: $(fabric-public-pipeline-access-PAT) - GITHUB_API_TOKEN: $(githubRepoStatusPAT) - VR_APP_API_URL: $(VR_APP_API_URL) - STORAGE_ACCOUNT_ID: $(StorageAccountId) - TENANT_ID: $(TenantId) - PRINCIPAL_CLIENT_ID: $(PrincipalClientId) - SERVICE_CONNECTION_ID: $(ServiceConnectionId) - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - azureSubscription: $(AzureSubscription) - scriptType: bash - scriptLocation: 'inlineScript' - # ciDefinitionId is set to 205 because that is the ID of the baseline pipeline (https://uifabric.visualstudio.com/fabricpublic/_build?definitionId=205) used by the master branch - inlineScript: | - yarn vr-app run-diff --screenshotsDirectory ./screenshots --buildType pr --clientType "FLUENTUI" --ciDefinitionId 205 --groupName $(pipelineName) --locationPrefix 'FluentUI-web-components' --locationPostfix 'vrscreenshotwebcomponents' --pipelineId $(pipelineId) --clientName 'fluentui-web-components-v3' --threshold '0.04' --cumThreshold '1' - condition: eq(variables['vrTestSkip'], 'no') + locationPrefix: 'FluentUI-web-components' + locationPostfix: 'vrscreenshotwebcomponents' + clientName: 'fluentui-web-components-v3' - job: VisualRegressionTest_V9 variables: @@ -71,26 +54,9 @@ jobs: fluentVersion: v9 vrTestPackageName: '@fluentui/vr-tests-react-components' vrTestPackagePath: 'apps/vr-tests-react-components' - - - task: AzureCLI@2 - displayName: 'Run fluentui-screenshotdiff' - env: - API_TOKEN: $(fabric-public-pipeline-access-PAT) - GITHUB_API_TOKEN: $(githubRepoStatusPAT) - VR_APP_API_URL: $(VR_APP_API_URL) - STORAGE_ACCOUNT_ID: $(StorageAccountId) - TENANT_ID: $(TenantId) - PRINCIPAL_CLIENT_ID: $(PrincipalClientId) - SERVICE_CONNECTION_ID: $(ServiceConnectionId) - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - azureSubscription: $(AzureSubscription) - scriptType: bash - scriptLocation: 'inlineScript' - # ciDefinitionId is set to 205 because that is the ID of the baseline pipeline (https://uifabric.visualstudio.com/fabricpublic/_build?definitionId=205) used by the master branch - inlineScript: | - yarn vr-app run-diff --buildType pr --screenshotsDirectory ./screenshots --clientType "FLUENTUI" --ciDefinitionId 205 --groupName $(pipelineName) --locationPrefix 'fluentuiv9' --locationPostfix 'vrscreenshotv9' --pipelineId $(pipelineId) --clientName 'fluentuiv9' --threshold '0.04' --cumThreshold '1' - condition: eq(variables['vrTestSkip'], 'no') + locationPrefix: 'fluentuiv9' + locationPostfix: 'vrscreenshotv9' + clientName: 'fluentuiv9' - job: VisualRegressionTest_V8 variables: @@ -109,26 +75,9 @@ jobs: fluentVersion: v8 vrTestPackageName: '@fluentui/vr-tests' vrTestPackagePath: 'apps/vr-tests' - - - task: AzureCLI@2 - displayName: 'Run fluentui-screenshotdiff' - env: - API_TOKEN: $(fabric-public-pipeline-access-PAT) - GITHUB_API_TOKEN: $(githubRepoStatusPAT) - VR_APP_API_URL: $(VR_APP_API_URL) - STORAGE_ACCOUNT_ID: $(StorageAccountId) - TENANT_ID: $(TenantId) - PRINCIPAL_CLIENT_ID: $(PrincipalClientId) - SERVICE_CONNECTION_ID: $(ServiceConnectionId) - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - azureSubscription: $(AzureSubscription) - scriptType: bash - scriptLocation: 'inlineScript' - # ciDefinitionId is set to 205 because that is the ID of the baseline pipeline (https://uifabric.visualstudio.com/fabricpublic/_build?definitionId=205) used by the master branch - inlineScript: | - yarn vr-app run-diff --screenshotsDirectory ./screenshots --buildType pr --clientType "FLUENTUI" --ciDefinitionId 205 --groupName $(pipelineName) --locationPrefix 'fluentuiv8' --locationPostfix 'vrscreenshotv8' --pipelineId $(pipelineId) --clientName 'fluentuiv8' --threshold '0.04' --cumThreshold '1' - condition: eq(variables['vrTestSkip'], 'no') + locationPrefix: 'fluentuiv8' + locationPostfix: 'vrscreenshotv8' + clientName: 'fluentuiv8' - job: VisualRegressionTest_V0 variables: @@ -148,23 +97,6 @@ jobs: fluentVersion: v0 vrTestPackageName: '@fluentui/docs' vrTestPackagePath: 'packages/fluentui/docs' - - - task: AzureCLI@2 - displayName: 'Run fluentui-screenshotdiff' - env: - API_TOKEN: $(fabric-public-pipeline-access-PAT) - GITHUB_API_TOKEN: $(githubRepoStatusPAT) - VR_APP_API_URL: $(VR_APP_API_URL) - STORAGE_ACCOUNT_ID: $(StorageAccountId) - TENANT_ID: $(TenantId) - PRINCIPAL_CLIENT_ID: $(PrincipalClientId) - SERVICE_CONNECTION_ID: $(ServiceConnectionId) - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - azureSubscription: $(AzureSubscription) - scriptType: bash - scriptLocation: 'inlineScript' - # ciDefinitionId is set to 205 because that is the ID of the baseline pipeline (https://uifabric.visualstudio.com/fabricpublic/_build?definitionId=205) used by the master branch - inlineScript: | - yarn vr-app run-diff --buildType pr --screenshotsDirectory ./screenshots --clientType "FLUENTUI" --ciDefinitionId 205 --groupName $(pipelineName) --locationPrefix 'FluentUI-v0' --locationPostfix 'vrscreenshotv0' --pipelineId $(pipelineId) --clientName 'FluentUIV0' --threshold '0.04' --cumThreshold '1' - condition: eq(variables['vrTestSkip'], 'no') + locationPrefix: 'FluentUI-v0' + locationPostfix: 'vrscreenshotv0' + clientName: 'FluentUIV0' From b7b3313eb167e5290ff464615985ffd311466048 Mon Sep 17 00:00:00 2001 From: TristanWatanabe Date: Mon, 29 Jul 2024 12:14:50 -0400 Subject: [PATCH 4/4] fix conditional to only run-diff when in PR --- .devops/templates/runpublishvrscreenshot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devops/templates/runpublishvrscreenshot.yml b/.devops/templates/runpublishvrscreenshot.yml index fcb77f7294ebb5..e8bd3cef37ff01 100644 --- a/.devops/templates/runpublishvrscreenshot.yml +++ b/.devops/templates/runpublishvrscreenshot.yml @@ -95,4 +95,4 @@ steps: # ciDefinitionId is set to 205 because that is the ID of the baseline pipeline (https://uifabric.visualstudio.com/fabricpublic/_build?definitionId=205) used by the master branch inlineScript: | yarn vr-app run-diff --screenshotsDirectory ./screenshots --buildType pr --clientType "FLUENTUI" --ciDefinitionId 205 --groupName $(pipelineName) --locationPrefix ${{ parameters.locationPrefix }} --locationPostfix ${{ parameters.locationPostfix }} --pipelineId $(pipelineId) --clientName ${{ parameters.clientName }} --threshold '0.04' --cumThreshold '1' - condition: eq(variables['vrTestSkip'], 'no') + condition: and(eq(variables.isPR, true), eq(variables['vrTestSkip'], 'no'))