From 7f2a37af9c47473164019138663dc34c0a94f59f 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 | 5 +++++ azure-pipelines.deprecate-package.yml | 2 +- azure-pipelines.hotfix.yml | 13 ++++--------- azure-pipelines.release-fluentui.yml | 14 +------------- 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, 24 insertions(+), 29 deletions(-) diff --git a/.devops/templates/tools.yml b/.devops/templates/tools.yml index 7d9e9af92f0fe..acaad89a1c51e 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(parameters.dryRun, true) diff --git a/.devops/templates/variables.yml b/.devops/templates/variables.yml index a72a48c528ab8..ca7a0f7bdf200 100644 --- a/.devops/templates/variables.yml +++ b/.devops/templates/variables.yml @@ -12,6 +12,11 @@ parameters: type: boolean default: true + # Dry run mode for testing the pipeline without making changes + - name: dryRun + type: boolean + default: false + variables: # Prevents failures on CI when "caniuse-lite" becomes outdated BROWSERSLIST_IGNORE_OLD_DATA: true diff --git a/azure-pipelines.deprecate-package.yml b/azure-pipelines.deprecate-package.yml index aa74c917d5439..a8ff9db776f57 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(parameters.dryRun, false) diff --git a/azure-pipelines.hotfix.yml b/azure-pipelines.hotfix.yml index 0468472c4c864..8952917882bfe 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(parameters.dryRun, false) - template: .devops/templates/cleanup.yml@self parameters: diff --git a/azure-pipelines.release-fluentui.yml b/azure-pipelines.release-fluentui.yml index 6306c0ab620fa..c76385371cd42 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" @@ -117,16 +110,11 @@ extends: image: '1ES-PT-Ubuntu-20.04' os: linux # run this job when the previous job is succeeded or when publishDocsiteOnly is true - condition: and(eq(variables.dryRun, false), or(succeeded(), eq(variables.publishDocsiteOnly, true))) + condition: and(eq(parameters.dryRun, false), or(succeeded(), eq(variables.publishDocsiteOnly, true))) 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 3725bd8e75d94..959a698970c2f 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(parameters.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(parameters.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(parameters.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 613d26f156427..f6595a305f2f0 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(parameters.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 e3817f7116627..a16802d90153e 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(parameters.dryRun, false) - template: .devops/templates/cleanup.yml@self parameters: diff --git a/azure-pipelines.release.yml b/azure-pipelines.release.yml index 63e83e912566e..3ab9982abbc99 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(parameters.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(parameters.dryRun, false) displayName: 'Update github release notes' - template: .devops/templates/cleanup.yml@self