From ab8563ab685bb234508b70d79f3aa7066b5e040f Mon Sep 17 00:00:00 2001 From: Dmytro Kirpa Date: Thu, 30 Jan 2025 16:54:55 +0100 Subject: [PATCH] chore(ci): add druRun mode to production AP --- .devops/templates/tools.yml | 6 ++++++ .devops/templates/variables.yml | 3 +++ azure-pipelines.deprecate-package.yml | 2 +- azure-pipelines.hotfix.yml | 13 ++++--------- azure-pipelines.release-fluentui.yml | 12 ------------ azure-pipelines.release-vnext.yml | 3 +++ azure-pipelines.release.tools.yml | 1 + azure-pipelines.release.web-components.yml | 1 + azure-pipelines.release.yml | 8 ++------ 9 files changed, 21 insertions(+), 28 deletions(-) diff --git a/.devops/templates/tools.yml b/.devops/templates/tools.yml index 7d9e9af92f0fe3..401560f408bdfc 100644 --- a/.devops/templates/tools.yml +++ b/.devops/templates/tools.yml @@ -38,3 +38,9 @@ steps: echo number of CPUs "$(getconf _NPROCESSORS_ONLN)" displayName: Log environment variables (Linux) condition: eq(variables['Agent.OS'], 'Linux') + + # Logs a message when dry run mode is enabled. + - script: | + echo "dry run mode enabled!" + displayName: dry run mode notification + condition: eq(variables.dryRun, true) diff --git a/.devops/templates/variables.yml b/.devops/templates/variables.yml index a72a48c528ab88..277d3b48c7db93 100644 --- a/.devops/templates/variables.yml +++ b/.devops/templates/variables.yml @@ -43,3 +43,6 @@ variables: deployBasePath: ${{ coalesce(parameters.deployBasePath, replace(variables['Build.SourceBranch'], 'refs/', '')) }} skipComponentGovernanceDetection: ${{ parameters.skipComponentGovernanceDetection }} + + # Dry run mode for testing the pipeline without making changes + dryRun: false diff --git a/azure-pipelines.deprecate-package.yml b/azure-pipelines.deprecate-package.yml index aa74c917d54392..6c6037f25cf54a 100644 --- a/azure-pipelines.deprecate-package.yml +++ b/azure-pipelines.deprecate-package.yml @@ -36,5 +36,5 @@ jobs: - script: | npm deprecate ${{ parameters.packageSpec }} "${{ parameters.message }}" --registry https://registry.npmjs.org/ --//registry.npmjs.org/:_authToken=$(npmToken) - displayName: 'Deprecate package' + condition: eq(variables.dryRun, false) diff --git a/azure-pipelines.hotfix.yml b/azure-pipelines.hotfix.yml index 0468472c4c864f..6e16d34a83f6a2 100644 --- a/azure-pipelines.hotfix.yml +++ b/azure-pipelines.hotfix.yml @@ -4,11 +4,6 @@ trigger: none name: '$(targetNpmVersion) ($(Rev:r))' -parameters: - - name: isTestRun - type: boolean - default: false - variables: - template: .devops/templates/variables.yml - name: tags @@ -78,10 +73,10 @@ extends: displayName: 'Create tarball' workingDirectory: 'packages/react' - - ${{ if ne(parameters.isTestRun, true) }}: - - script: | - npm publish packages/react/react-$(targetNpmVersion).tgz --tag hf8 --//registry.npmjs.org/:_authToken=$(npmToken) - displayName: Publish new version + - script: | + npm publish packages/react/react-$(targetNpmVersion).tgz --tag hf8 --//registry.npmjs.org/:_authToken=$(npmToken) + displayName: Publish new version + condition: eq(variables.dryRun, false) - template: .devops/templates/cleanup.yml@self parameters: diff --git a/azure-pipelines.release-fluentui.yml b/azure-pipelines.release-fluentui.yml index 6306c0ab620fa4..eb668f7c8aea0b 100644 --- a/azure-pipelines.release-fluentui.yml +++ b/azure-pipelines.release-fluentui.yml @@ -28,8 +28,6 @@ variables: value: production,externalfacing # below are variables configurable at queue time, so they cannot appear in yml file - # - name: dryRun # set it to true in order to execute publishing in dry run mode - nothing will be published - # value: false # - name: publishDocsiteOnly # set it to true to only run Job_build_publish_doc # value: false # - name: publishOfficial # set it to true to publish package to npm, and publish docsite for official releases @@ -59,11 +57,6 @@ extends: steps: - template: .devops/templates/tools.yml@self - - script: | - echo "dry run mode enabled!" - displayName: dry run mode notification - condition: eq(variables.dryRun, true) - - script: | git config user.name "Fluent UI Build" git config user.email "fluentui-internal@service.microsoft.com" @@ -122,11 +115,6 @@ extends: steps: - template: .devops/templates/tools.yml@self - - script: | - echo "dry run mode enabled!" - displayName: dry run mode notification - condition: eq(variables.dryRun, true) - - task: CmdLine@2 displayName: Checkout branch for pull condition: and(succeeded(), eq(variables.publishOfficial, true)) diff --git a/azure-pipelines.release-vnext.yml b/azure-pipelines.release-vnext.yml index 3725bd8e75d94a..fa2061fcdf5223 100644 --- a/azure-pipelines.release-vnext.yml +++ b/azure-pipelines.release-vnext.yml @@ -84,6 +84,7 @@ extends: - script: | node -r ./scripts/ts-node/src/register ./scripts/executors/src/deprecate-react-components-preview-packages.ts --token $(npmToken) displayName: 'Deprecate preview packages' + condition: eq(variables.dryRun, false) - script: | yarn publish:beachball -n $(npmToken) --config scripts/beachball/src/release-vNext.config.js --message 'release: applying package updates - react-components' @@ -91,11 +92,13 @@ extends: env: GITHUB_PAT: $(githubPAT) displayName: Publish changes and bump versions + condition: eq(variables.dryRun, false) - script: | node -r ./scripts/ts-node/src/register scripts/executors/src/tag-react-components.ts --token $(npmToken) displayName: Tag prelease packages with prerelease tag continueOnError: true + condition: eq(variables.dryRun, false) # Since releases are scoped, this should warn for any packages that were mistakenly not included in scoping - script: | diff --git a/azure-pipelines.release.tools.yml b/azure-pipelines.release.tools.yml index 613d26f156427a..4c4673c7947030 100644 --- a/azure-pipelines.release.tools.yml +++ b/azure-pipelines.release.tools.yml @@ -76,6 +76,7 @@ extends: env: GITHUB_PAT: $(githubPAT) displayName: Publish changes and bump versions + condition: eq(variables.dryRun, false) - template: .devops/templates/cleanup.yml@self parameters: diff --git a/azure-pipelines.release.web-components.yml b/azure-pipelines.release.web-components.yml index e3817f7116627a..975a7cc7798906 100644 --- a/azure-pipelines.release.web-components.yml +++ b/azure-pipelines.release.web-components.yml @@ -78,6 +78,7 @@ extends: env: GITHUB_PAT: $(githubPAT) displayName: Publish changes and bump versions + condition: eq(variables.dryRun, false) - template: .devops/templates/cleanup.yml@self parameters: diff --git a/azure-pipelines.release.yml b/azure-pipelines.release.yml index 63e83e912566e3..c48b9521e70d09 100644 --- a/azure-pipelines.release.yml +++ b/azure-pipelines.release.yml @@ -13,10 +13,6 @@ variables: - name: tags value: production,externalfacing -# below are variables configurable at queue time, so they cannot appear in yml file -# - name: skipPublish # set it to true in order to skip publishing to NPM. Useful for deploying docsite only updates. -# value: false - schedules: # minute 0, hour 7 in UTC (11pm in UTC-8), any day of month, any month, days 1-5 of week (M-F) # https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?tabs=yaml&view=azure-devops#supported-cron-syntax @@ -128,7 +124,7 @@ extends: - script: | yarn publish:beachball -n $(npmToken) --config scripts/beachball/src/release-v8.config.js --message 'release: applying package updates - react v8' git reset --hard origin/master - condition: eq(variables.skipPublish, false) + condition: eq(variables.dryRun, false) env: GITHUB_PAT: $(githubPAT) displayName: Publish changes and bump versions @@ -167,7 +163,7 @@ extends: # failure doesn't need to block anything else - script: | node -r ./scripts/ts-node/src/register ./scripts/update-release-notes/src/index.ts --token=$(githubPAT) --apply --debug - condition: eq(variables.skipPublish, false) + condition: eq(variables.dryRun, false) displayName: 'Update github release notes' - template: .devops/templates/cleanup.yml@self