Skip to content

Commit 978343d

Browse files
Alexander Smolyakovembetten
andauthored
Add new job to build and push single task to feed (#16274) (#16430)
* Add new job to build and push single task to feed * revert unintented change * revert commenting * Add new job to build and push single task to feed * revert unintented change * revert commenting * Fix yaml error * Fix yaml error * remove duplicate task added by bad force push Co-authored-by: Alexander Smolyakov <[email protected]> Co-authored-by: embetten <[email protected]>
1 parent 3048b87 commit 978343d

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

azure-pipelines.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ jobs:
110110
steps:
111111
- template: ci/build-single-steps.yml
112112

113+
# Single task build and push
114+
- job: buildAndPushSingle
115+
displayName: Build And Push Single Task
116+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
117+
pool:
118+
vmImage: windows-2022
119+
steps:
120+
- template: ci/build-and-push-single-steps.yml
121+
parameters:
122+
os: Windows_NT
123+
113124
- job: buildSharedNpm_win
114125
displayName: Build shared npm packages (Win)
115126
condition: and(succeeded(), not(variables.task), eq(variables.os, 'Windows_NT'))

ci/build-and-push-single-steps.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
steps:
2+
3+
# Clean
4+
- checkout: self
5+
clean: true
6+
7+
# Start collect diagnostics
8+
- powershell: ./ci/start-collect-diagnostics.ps1
9+
displayName: Start collect diagnostics
10+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
11+
12+
# Use node 8, npm 5
13+
- task: NodeTool@0
14+
displayName: Use node 8
15+
inputs:
16+
versionSpec: "8.x"
17+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
18+
19+
# npm install
20+
- script: npm install
21+
displayName: npm install
22+
23+
# Verify min agent version demands
24+
- script: |
25+
cd ci
26+
cd verifyMinAgentDemands
27+
npm install
28+
node index.js
29+
displayName: Verify all min agent demands are valid
30+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
31+
32+
# Build
33+
- script: node make.js build --task "$(task)"
34+
displayName: Build
35+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
36+
37+
# Test
38+
- script: node make.js test
39+
displayName: Run tests
40+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
41+
- script: node make.js testLegacy --task "$(task)"
42+
displayName: Legacy tests with node 6
43+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
44+
45+
# Publish test results
46+
- task: PublishTestResults@2
47+
displayName: Publish Test Results test-*.xml
48+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
49+
inputs:
50+
testResultsFiles: 'test-*.xml'
51+
testRunTitle: 'Node 6 Test Results'
52+
searchFolder: '$(System.DefaultWorkingDirectory)/testresults'
53+
54+
# Only on Windows:
55+
- ${{ if eq(parameters.os, 'Windows_NT') }}:
56+
57+
# Stage tasks individually into the package directory
58+
- script: node ./ci/stage-package.js individually
59+
displayName: Stage tasks individually into the package directory
60+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
61+
62+
# Sign all task zips as nuget packages
63+
- template: sign-all-tasks.yml
64+
parameters:
65+
layoutRoot: $(Build.SourcesDirectory)\_package\tasks-layout
66+
67+
# Stage all the tasks into a single zip for upload
68+
- script: node ./ci/stage-package.js
69+
displayName: Stage all the tasks into a single zip for upload
70+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
71+
72+
# Set variables
73+
- powershell: .\ci\set-publish-variables.ps1
74+
displayName: Set publish variables
75+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
76+
77+
# Moving Package zip file to be consumed by Milestone staging task
78+
- powershell: |
79+
mkdir $env:SYSTEM_ARTIFACTSDIRECTORY\package
80+
Copy-Item $(Build.SourcesDirectory)\_package\tasks.zip -Destination $env:SYSTEM_ARTIFACTSDIRECTORY\package\tasks.zip
81+
Write-Host "Copying from '$(Build.SourcesDirectory)\_package\tasks.zip' to '$env:SYSTEM_ARTIFACTSDIRECTORY\package\tasks.zip'"
82+
displayName: Move package zip file
83+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
84+
85+
# Stage Milestone task
86+
- script: node .\ci\stage-milestone.js
87+
displayName: Stage milestone
88+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
89+
90+
# Stage per task NuGet package
91+
- script: npm run package
92+
displayName: npm run package
93+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
94+
95+
# Authenticate
96+
- task: NuGetAuthenticate@0
97+
displayName: 'Authenticate with nuget'
98+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
99+
100+
# Push to feed
101+
- script: |
102+
cd $(Build.SourcesDirectory)\_package\nuget-packages\$(task)
103+
push.cmd
104+
displayName: 'Push Nuget package'
105+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)
106+
107+
# Stop collect diagnostics
108+
- powershell: ./ci/stop-collect-diagnostics.ps1
109+
displayName: Stop collect diagnostics
110+
condition: and(succeeded(), ne(variables['build.reason'], 'PullRequest'), variables.task, variables.rollForward)

0 commit comments

Comments
 (0)