Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions packages/java-packages/codesnippet-maven-plugin/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,30 @@ pr:
include:
- /packages/java-packages/codesnippet-maven-plugin/

stages:
- stage: Validate
jobs:
- job: Validate
variables:
- template: /eng/pipelines/templates/variables/globals.yml
extends:
template: /eng/pipelines/templates/stages/1es-redirect.yml
parameters:
stages:
- stage: Validate
jobs:
- job: Validate
variables:
- template: /eng/pipelines/templates/variables/globals.yml
- template: /eng/pipelines/templates/variables/image.yml

pool:
name: azsdk-pool-mms-ubuntu-2204-general
pool:
name: $(WINDOWSPOOL)
image: $(WINDOWSVMIMAGE)
os: windows

steps:
- task: Maven@3
displayName: 'Validate Build'
inputs:
mavenPomFile: 'packages/java-packages/codesnippet-maven-plugin/pom.xml'
goals: 'clean install'
options: '--batch-mode -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 --no-transfer-progress'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
steps:
- task: Maven@3
displayName: 'Validate Build'
inputs:
mavenPomFile: 'packages/java-packages/codesnippet-maven-plugin/pom.xml'
goals: 'clean install'
options: '--batch-mode -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 --no-transfer-progress'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
175 changes: 85 additions & 90 deletions tools/js-sdk-release-tools/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
branches:
include:
Expand All @@ -30,96 +25,96 @@ pr:
include:
- tools/js-sdk-release-tools

variables:
- template: ../../eng/pipelines/templates/variables/globals.yml
- name: NodeVersion
value: '14.x'
- name: VAR_ARTIFACT_NAME
value: 'drop'
- name: VAR_BUILD_ARTIFACT_STAGING_DIRECTORY
value: $(Build.ArtifactStagingDirectory)
extends:
template: /eng/pipelines/templates/stages/1es-redirect.yml
parameters:
stages:
- stage: InstallAndBuild
variables:
- template: /eng/pipelines/templates/variables/globals.yml
- template: /eng/pipelines/templates/variables/image.yml
- name: NodeVersion
value: '18.x'

jobs:
- job: Build
pool:
name: $(LINUXNEXTPOOL)
image: $(LINUXNEXTVMIMAGE)
os: linux
steps:
- task: NodeTool@0
inputs:
versionSpec: '$(NodeVersion)'
displayName: 'Install Node.js'

- script: |
npm install
displayName: 'npm install'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/js-sdk-release-tools

stages:
- stage: InstallAndBuild
jobs:
- job: Build
strategy:
matrix:
linux:
imageName: ubuntu-22.04
mac:
imageName: 'macos-latest'
windows:
imageName: 'windows-latest'
pool:
vmImage: $(imageName)
steps:
- task: NodeTool@0
inputs:
versionSpec: '$(NodeVersion)'
displayName: 'Install Node.js'
- script: |
npm pack
displayName: 'npm pack'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/js-sdk-release-tools

- script: |
npm install
displayName: 'npm install'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/js-sdk-release-tools
- script: 'cp azure-tools-js-sdk-release-tools-*.tgz $(Build.ArtifactStagingDirectory)'
displayName: 'copy to staging dir'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/js-sdk-release-tools

- script: |
npm pack
displayName: 'npm pack'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/js-sdk-release-tools
condition: contains(variables['imageName'], 'ubuntu')
- task: 1ES.PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'

- script: 'cp azure-tools-js-sdk-release-tools-*.tgz $(VAR_BUILD_ARTIFACT_STAGING_DIRECTORY)'
displayName: 'copy to staging dir'
workingDirectory: $(System.DefaultWorkingDirectory)/tools/js-sdk-release-tools
condition: contains(variables['imageName'], 'ubuntu')
- ${{if ne(variables['Build.Reason'], 'PullRequest')}}:
- stage: Release
dependsOn: InstallAndBuild
condition: succeeded()
variables:
- template: /eng/pipelines/templates/variables/globals.yml
- template: /eng/pipelines/templates/variables/image.yml
- name: NodeVersion
value: '18.x'

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(VAR_BUILD_ARTIFACT_STAGING_DIRECTORY)'
ArtifactName: '$(VAR_ARTIFACT_NAME)'
publishLocation: 'Container'
condition: contains(variables['imageName'], 'ubuntu')
jobs:
- job: approve
pool: server
steps:
- task: ManualValidation@0
inputs:
notifyUsers: 'Click to approve if it''s an expected public release.'

- ${{if ne(variables['Build.Reason'], 'PullRequest')}}:
- stage: Release
dependsOn: InstallAndBuild
condition: succeeded()
jobs:
- job: approve
pool: server
steps:
- task: ManualValidation@0
inputs:
notifyUsers: 'Click to approve if it''s an expected public release.'
- job: release
dependsOn: approve
condition: and(succeeded(), ne(variables['USER_SKIP_PUBLIC_RELEASE'], 'true'))
steps:
- task: NodeTool@0
inputs:
versionSpec: '$(NodeVersion)'
displayName: 'Install Node.js'
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: '$(VAR_ARTIFACT_NAME)'
downloadPath: '$(VAR_BUILD_ARTIFACT_STAGING_DIRECTORY)'
- script: |
echo -e "\e[32m[$(date -u)] LOG: Ensure latest npm is installed"
sudo npm install -g npm || { echo 'npm install failed' ; exit 1; }
sudo npm install -g pnpm || { echo 'pnpm install failed' ; exit 1; }
- job: release
dependsOn: approve
condition: and(succeeded(), ne(variables['USER_SKIP_PUBLIC_RELEASE'], 'true'))
pool:
name: $(LINUXNEXTPOOL)
image: $(LINUXNEXTVMIMAGE)
os: linux
steps:
- task: NodeTool@0
inputs:
versionSpec: '$(NodeVersion)'
displayName: 'Install Node.js'

- task: DownloadPipelineArtifact@2
inputs:
artifactName: 'drop'
targetPath: '$(Build.ArtifactStagingDirectory)'

echo -e "\e[32m[$(date -u)] LOG: publish the package"
echo "//registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)" >> ~/.npmrc
for file in $(VAR_BUILD_ARTIFACT_STAGING_DIRECTORY)/$(VAR_ARTIFACT_NAME)/*.tgz
do
echo -e "\e[32m[$(date -u)] LOG: File: $file"
npm publish $file --access public || { echo 'publish $file failed' ; exit 1; }
done
rm ~/.npmrc || { echo 'rm ~/.npmrc failed' ; exit 1; }
displayName: Publish
workingDirectory: $(System.DefaultWorkingDirectory)/tools/js-sdk-release-tools
- script: |
echo -e "\e[32m[$(date -u)] LOG: Ensure latest npm is installed"
sudo npm install -g npm || { echo 'npm install failed' ; exit 1; }
sudo npm install -g pnpm || { echo 'pnpm install failed' ; exit 1; }

echo -e "\e[32m[$(date -u)] LOG: publish the package"
echo "//registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)" >> ~/.npmrc
for file in $(Build.ArtifactStagingDirectory)/*.tgz
do
echo -e "\e[32m[$(date -u)] LOG: File: $file"
npm publish $file --access public || { echo 'publish $file failed' ; exit 1; }
done
rm ~/.npmrc || { echo 'rm ~/.npmrc failed' ; exit 1; }
displayName: Publish
workingDirectory: $(System.DefaultWorkingDirectory)/tools/js-sdk-release-tools