Skip to content
Open
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
23 changes: 21 additions & 2 deletions build/yaml/pipelines/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ name: $(date:yyyyMMdd)$(rev:rr)
trigger: none
pr: none

parameters:
- name: dryRun
displayName: 'Dry run: run everything but skip the NuGet publish (nothing is published)'
type: boolean
default: false
- name: promoteToRelease
displayName: 'Promote the published packages to the Release view'
type: boolean
default: false

variables:
TeamName: VS Production Diagnostics

Expand All @@ -37,8 +47,17 @@ variables:
# ---- Contacts ----
TeamContact: clrieowners@microsoft.com

# Set to 'True' (e.g. at queue time) to promote the published packages to the Release view.
PromoteToRelease: 'False'
# Queue-time toggles. YAML variables alone are NOT settable at queue time, so these map the
# runtime parameters (declared above, shown in the "Run pipeline" dialog) onto the variable
# names the stage conditions already use. A boolean parameter expands to 'True'/'False'.
#
# Promote the published packages to the Release view.
PromoteToRelease: ${{ parameters.promoteToRelease }}

# Dry run: the full pipeline runs (artifact download, approval gate, and -- if enabled --
# the promote logic), but the NuGet push (output: nuget) is skipped so nothing is
# actually published to the feed.
DryRun: ${{ parameters.dryRun }}

resources:
repositories:
Expand Down
112 changes: 84 additions & 28 deletions build/yaml/stages/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ stages:
displayName: Publish NuGets to internal InstrumentationEngine Feed
dependsOn: []
jobs:
- deployment: Publish
displayName: Publish NuGets to internal InstrumentationEngine Feed
# ---------------------------------------------------------------------------------
# Approval gate. A release (deployment) job targeting the gated environment so the
# classic pre-deploy approval still applies before anything is published. It performs
# no work itself -- 1ES release jobs cannot declare outputs, so the actual NuGet push
# lives on the separate plain 'Publish' job below (output: nuget).
# ---------------------------------------------------------------------------------
- deployment: ApprovalGate
displayName: Approval gate (internal NuGet feed)
environment: CLRIE-Release-Internal-NuGet-Feed
pool:
name: VSEngSS-Microbuild2022-1ES
Expand All @@ -39,43 +45,93 @@ stages:
deploy:
steps:
- download: none
- download: ClrInstrumentationEngine-Signed-Yaml
artifact: packages-windows-Release
patterns: '**/Microsoft.InstrumentationEngine*.nupkg'
displayName: Download Windows packages
- download: ClrInstrumentationEngine-Signed-Yaml
artifact: packages-linux-ubuntu-Release
patterns: '**/Microsoft.InstrumentationEngine*.nupkg'
displayName: Download Linux (ubuntu) packages
- download: ClrInstrumentationEngine-Signed-Yaml
artifact: packages-linux-alpine-Release
patterns: '**/Microsoft.InstrumentationEngine*.nupkg'
displayName: Download Linux (alpine) packages

- task: NuGetAuthenticate@1
displayName: NuGet Authenticate
# ---------------------------------------------------------------------------------
# Publish. Plain job (runs only after the gate is approved). Artifacts are downloaded
# via templateContext.inputs (the 1ES-sanctioned replacement for '- download:') and
# published via the only construct 1ES allows for pushing NuGet packages: output: nuget.
# ---------------------------------------------------------------------------------
- job: Publish
displayName: Publish NuGets to internal InstrumentationEngine Feed
dependsOn: ApprovalGate
pool:
name: VSEngSS-Microbuild2022-1ES
os: windows
templateContext:
inputs:
- input: pipelineArtifact
pipeline: ClrInstrumentationEngine-Signed-Yaml
artifactName: packages-windows-Release
targetPath: $(Pipeline.Workspace)\ClrInstrumentationEngine-Signed-Yaml\packages-windows-Release
- input: pipelineArtifact
pipeline: ClrInstrumentationEngine-Signed-Yaml
artifactName: packages-linux-ubuntu-Release
targetPath: $(Pipeline.Workspace)\ClrInstrumentationEngine-Signed-Yaml\packages-linux-ubuntu-Release
- input: pipelineArtifact
pipeline: ClrInstrumentationEngine-Signed-Yaml
artifactName: packages-linux-alpine-Release
targetPath: $(Pipeline.Workspace)\ClrInstrumentationEngine-Signed-Yaml\packages-linux-alpine-Release
outputs:
- output: nuget
displayName: Push to DevDiv InstrumentationEngine feed
# Dry run: skip the actual push (nothing is published) while the rest of the job
# -- artifact download above and the promote logic downstream -- still runs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promote logic doesn't have any dryrun checks. So you can do a dry-run with no push followed by a promote?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to skip promote when DryRun is set

condition: ne(variables['DryRun'], 'True')
packageParentPath: $(ArtifactsDirectory)
packagesToPush: $(ArtifactsDirectory)\$(WindowsInstrumentationEngineNuGetArtifactPathPattern);$(ArtifactsDirectory)\$(LinuxInstrumentationEngineNuGetArtifactPathPattern)
nuGetFeedType: internal
publishVstsFeed: 59c1dfae-dea5-4ea5-ac83-c9abcb4ac339
allowPackageConflicts: true
publishPackageMetadata: true
verbosityPush: Detailed
steps:
- checkout: none

- task: NuGetCommand@2
displayName: Push to DevDiv InstrumentationEngine feed
inputs:
command: push
nuGetFeedType: internal
publishVstsFeed: 59c1dfae-dea5-4ea5-ac83-c9abcb4ac339
packagesToPush: $(ArtifactsDirectory)\$(WindowsInstrumentationEngineNuGetArtifactPathPattern);$(ArtifactsDirectory)\$(LinuxInstrumentationEngineNuGetArtifactPathPattern)
allowPackageConflicts: true
publishPackageMetadata: true
verbosityPush: Detailed
# ---------------------------------------------------------------------------------
# Promote (optional). Release (deployment) job, only runs when PromoteToRelease=True.
# Artifacts are downloaded via templateContext.inputs; the promote REST call runs in
# the on.success hook below.
# ---------------------------------------------------------------------------------
- deployment: Promote
displayName: Promote package to Release View
dependsOn: Publish
condition: and(eq(variables['PromoteToRelease'], 'True'), ne(variables['DryRun'], 'True'))
environment: CLRIE-Release-Promote-Internal-NuGet-Feed
pool:
name: VSEngSS-Microbuild2022-1ES
os: windows
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
pipeline: ClrInstrumentationEngine-Signed-Yaml
artifactName: packages-windows-Release
targetPath: $(Pipeline.Workspace)\ClrInstrumentationEngine-Signed-Yaml\packages-windows-Release
- input: pipelineArtifact
pipeline: ClrInstrumentationEngine-Signed-Yaml
artifactName: packages-linux-ubuntu-Release
targetPath: $(Pipeline.Workspace)\ClrInstrumentationEngine-Signed-Yaml\packages-linux-ubuntu-Release
- input: pipelineArtifact
pipeline: ClrInstrumentationEngine-Signed-Yaml
artifactName: packages-linux-alpine-Release
targetPath: $(Pipeline.Workspace)\ClrInstrumentationEngine-Signed-Yaml\packages-linux-alpine-Release
strategy:
runOnce:
deploy:
steps:
- download: none
Comment thread
wiktork marked this conversation as resolved.
on:
# The 'on success' hook runs after the deploy phase (including the NuGet push above)
# has succeeded, so the promote step always runs after the packages are published.
success:
steps:
# Classic equivalent: "Promote package to Release View" (deprecated marketplace task,
# gated on PromoteToRelease). Implemented here against the Azure Artifacts packaging
# REST API; only runs when PromoteToRelease is set to 'True'.
# REST API; only runs when PromoteToRelease is 'True' and this is not a dry run.
- task: PowerShell@2
displayName: Promote package to Release View
condition: and(succeeded(), eq(variables['PromoteToRelease'], 'True'))
condition: and(succeeded(), eq(variables['PromoteToRelease'], 'True'), ne(variables['DryRun'], 'True'))
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
Expand Down
Loading