From ca2af1060e6da5444650bf72a31e42938d99ca37 Mon Sep 17 00:00:00 2001 From: Tarun R <> Date: Fri, 1 Aug 2025 14:54:56 +0530 Subject: [PATCH 1/3] Seperating CI/PR yml from release yml to seperate out the pipelines --- azure-pipelines-release.yml | 104 ++++++++++++++++++++++++++++++++++++ azure-pipelines.yml | 95 ++------------------------------ build-template.yml | 39 ++++++++++++++ 3 files changed, 147 insertions(+), 91 deletions(-) create mode 100644 azure-pipelines-release.yml create mode 100644 build-template.yml diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml new file mode 100644 index 0000000..6d017ba --- /dev/null +++ b/azure-pipelines-release.yml @@ -0,0 +1,104 @@ +# Release Pipeline - Build, Test, and Release +# This pipeline will be extended to the OneESPT template +trigger: none +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + sdl: + sbom: + enabled: false + sourceAnalysisPool: + name: 1ES-ABTT-Shared-Pool + image: abtt-windows-2022 + os: windows + pool: + name: 1ES-ABTT-Shared-Pool + image: abtt-ubuntu-2204 + os: linux + customBuildTags: + - ES365AIMigrationTooling + stages: + - stage: Build + displayName: Build and Prerelease + jobs: + - template: build-template.yml + - job: PublishPrerelease + displayName: Publish Prerelease + dependsOn: BuildAndTest + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) + steps: + - task: NodeTool@0 + inputs: + versionSpec: '16.x' + displayName: Install node + - script: npm install -g npm@8 + displayName: Upgrade npm + - task: NpmAuthenticate@0 + inputs: + workingFile: .npmrc + - script: npm install + displayName: npm install + - script: npm run build + displayName: npm run build + - task: Npm@1 + displayName: Publish azure-devops-node-api to npm + inputs: + command: custom + customCommand: publish --tag prerelease + workingDir: '_build' + publishRegistry: useExternalRegistry + customEndpoint: btt-npm-publish-token + publishEndpoint: btt-npm-publish-token + continueOnError: true + - stage: Release + displayName: Release to Latest + trigger: manual + dependsOn: Build + jobs: + - job: Release + displayName: Release to Latest + steps: + - checkout: self + clean: true + - task: NodeTool@0 + inputs: + versionSpec: 16.x + displayName: Install node + - task: NpmAuthenticate@0 + inputs: + workingFile: .npmrc + - script: npm install + displayName: npm install + - script: npm run build + displayName: npm run build + - bash: | + package_name=$(npm pkg get name version | jq -r '"\(.name)@\(.version)"') + echo "##vso[task.setvariable variable=npm_package]$package_name" + workingDirectory: '_build' + displayName: Get package name and version + - task: Npm@1 + displayName: Remove prerelease tag for azure-devops-node-api in Npm + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) + inputs: + command: custom + customCommand: dist-tag remove "$(npm_package)" prerelease + workingDir: '_build' + publishRegistry: useExternalRegistry + customEndpoint: btt-npm-publish-token + publishEndpoint: btt-npm-publish-token + - task: Npm@1 + displayName: Add latest tag for azure-devops-node-api in Npm + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) + inputs: + command: custom + customCommand: dist-tag add "$(npm_package)" latest + workingDir: '_build' + publishRegistry: useExternalRegistry + customEndpoint: btt-npm-publish-token + publishEndpoint: btt-npm-publish-token diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8d030bc..eefbca2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,4 +1,4 @@ -# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool. +# CI Pipeline - Build and Test # This pipeline will be extended to the OneESPT template resources: repositories: @@ -20,95 +20,8 @@ extends: name: 1ES-ABTT-Shared-Pool image: abtt-ubuntu-2204 os: linux - customBuildTags: - - ES365AIMigrationTooling stages: - - stage: stage + - stage: CI + displayName: Build And Test jobs: - - job: job - strategy: - matrix: - 'Node 16': - versionSpec: '16.x' - npmVersion: '8' - 'Node 18': - versionSpec: '18.x' - npmVersion: '10' - 'Node 20': - versionSpec: '20.x' - npmVersion: '10' - 'Node 22': - versionSpec: '22.x' - npmVersion: '10' - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(versionSpec) - displayName: Install node - - script: npm install -g npm@$(npmVersion) - displayName: Upgrade npm - - task: NpmAuthenticate@0 - inputs: - workingFile: .npmrc - - script: npm install - displayName: npm install - - script: npm run build - displayName: npm run build - - script: npm run units - displayName: Run unit tests - - task: Npm@1 - displayName: Publish azure-devops-node-api to npm - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'), eq(variables['npmVersion'], '8')) - inputs: - command: custom - customCommand: publish --tag prerelease - workingDir: '_build' - publishRegistry: useExternalRegistry - customEndpoint: btt-npm-publish-token - publishEndpoint: btt-npm-publish-token - continueOnError: true - - stage: Release - displayName: Release to Latest - trigger: manual - jobs: - - job: Release - displayName: Release to Latest - steps: - - checkout: self - clean: true - - task: NodeTool@0 - inputs: - versionSpec: 16.x - displayName: Install node - - task: NpmAuthenticate@0 - inputs: - workingFile: .npmrc - - script: npm install - displayName: npm install - - script: npm run build - displayName: npm run build - - bash: | - package_name=$(npm pkg get name version | jq -r '"\(.name)@\(.version)"') - echo "##vso[task.setvariable variable=npm_package]$package_name" - workingDirectory: '_build' - displayName: Get package name and version - - task: Npm@1 - displayName: Remove prerelease tag for azure-devops-node-api in Npm - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) - inputs: - command: custom - customCommand: dist-tag remove "$(npm_package)" prerelease - workingDir: '_build' - publishRegistry: useExternalRegistry - customEndpoint: btt-npm-publish-token - publishEndpoint: btt-npm-publish-token - - task: Npm@1 - displayName: Add latest tag for azure-devops-node-api in Npm - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) - inputs: - command: custom - customCommand: dist-tag add "$(npm_package)" latest - workingDir: '_build' - publishRegistry: useExternalRegistry - customEndpoint: btt-npm-publish-token - publishEndpoint: btt-npm-publish-token \ No newline at end of file + - template: build-template.yml \ No newline at end of file diff --git a/build-template.yml b/build-template.yml new file mode 100644 index 0000000..c617abe --- /dev/null +++ b/build-template.yml @@ -0,0 +1,39 @@ +# Shared template for build and test steps +parameters: +- name: nodeVersions + type: object + default: + 'Node 16': + versionSpec: '16.x' + npmVersion: '8' + 'Node 18': + versionSpec: '18.x' + npmVersion: '10' + 'Node 20': + versionSpec: '20.x' + npmVersion: '10' + 'Node 22': + versionSpec: '22.x' + npmVersion: '10' + +jobs: +- job: BuildAndTest + displayName: Build and Test + strategy: + matrix: ${{ parameters.nodeVersions }} + steps: + - task: NodeTool@0 + inputs: + versionSpec: $(versionSpec) + displayName: Install node + - script: npm install -g npm@$(npmVersion) + displayName: Upgrade npm + - task: NpmAuthenticate@0 + inputs: + workingFile: .npmrc + - script: npm install + displayName: npm install + - script: npm run build + displayName: npm run build + - script: npm run units + displayName: Run unit tests From 24c998678ec0376c668c6405c882ea92a2d75e0e Mon Sep 17 00:00:00 2001 From: Tarun R <> Date: Fri, 1 Aug 2025 15:00:20 +0530 Subject: [PATCH 2/3] Updating the location for the files --- build-template.yml => .azure-pipelines/build-template.yml | 0 azure-pipelines-release.yml => .azure-pipelines/release.yml | 2 +- azure-pipelines.yml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename build-template.yml => .azure-pipelines/build-template.yml (100%) rename azure-pipelines-release.yml => .azure-pipelines/release.yml (98%) diff --git a/build-template.yml b/.azure-pipelines/build-template.yml similarity index 100% rename from build-template.yml rename to .azure-pipelines/build-template.yml diff --git a/azure-pipelines-release.yml b/.azure-pipelines/release.yml similarity index 98% rename from azure-pipelines-release.yml rename to .azure-pipelines/release.yml index 6d017ba..890c1df 100644 --- a/azure-pipelines-release.yml +++ b/.azure-pipelines/release.yml @@ -27,7 +27,7 @@ extends: - stage: Build displayName: Build and Prerelease jobs: - - template: build-template.yml + - template: .azure-pipelines/build-template.yml - job: PublishPrerelease displayName: Publish Prerelease dependsOn: BuildAndTest diff --git a/azure-pipelines.yml b/azure-pipelines.yml index eefbca2..34466d2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,4 +24,4 @@ extends: - stage: CI displayName: Build And Test jobs: - - template: build-template.yml \ No newline at end of file + - template: .azure-pipelines/build-template.yml \ No newline at end of file From 21e8b95df18268f8d6045f8fdee045043c80e510 Mon Sep 17 00:00:00 2001 From: Tarun R <> Date: Fri, 1 Aug 2025 15:10:45 +0530 Subject: [PATCH 3/3] updating references --- .azure-pipelines/{release.yml => azure-pipelines-release.yml} | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .azure-pipelines/{release.yml => azure-pipelines-release.yml} (98%) diff --git a/.azure-pipelines/release.yml b/.azure-pipelines/azure-pipelines-release.yml similarity index 98% rename from .azure-pipelines/release.yml rename to .azure-pipelines/azure-pipelines-release.yml index 890c1df..32d5186 100644 --- a/.azure-pipelines/release.yml +++ b/.azure-pipelines/azure-pipelines-release.yml @@ -27,7 +27,7 @@ extends: - stage: Build displayName: Build and Prerelease jobs: - - template: .azure-pipelines/build-template.yml + - template: .azure-pipelines/build-template.yml@self - job: PublishPrerelease displayName: Publish Prerelease dependsOn: BuildAndTest diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 34466d2..27dc891 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,4 +24,4 @@ extends: - stage: CI displayName: Build And Test jobs: - - template: .azure-pipelines/build-template.yml \ No newline at end of file + - template: .azure-pipelines/build-template.yml@self \ No newline at end of file