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
78 changes: 54 additions & 24 deletions eng/pipelines/templates/stages/publish-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,57 @@ stages:
value: Registry update

jobs:
- deployment: Publish_Release
condition: >-
and(
succeeded(),
ne('true', variables['Skip.Publish'])
)
# Nightly publishes unattended, so it uses the no-approval 'none'
# environment and is not a governed production release. Manual releases
# go through the approval-gated package-publish environment.
- ${{ if ne(variables['Build.Reason'], 'Schedule') }}:
- job: Create_GitHub_Release
dependsOn: []
condition: >-
and(
succeeded(),
ne('true', variables['Skip.Publish'])
)

pool:
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux

steps:
- checkout: self

- template: /eng/pipelines/templates/steps/extension-set-metadata-variables.yml

- task: DownloadPipelineArtifact@2
displayName: Download release artifact
inputs:
artifactName: release
targetPath: release

- task: DownloadPipelineArtifact@2
displayName: Download changelog artifact
inputs:
artifactName: changelog
targetPath: changelog

- template: /eng/pipelines/templates/steps/publish-extension-github-release.yml
parameters:
TagPrefix: azd-ext-${{ parameters.SanitizedExtensionId }}
TagVersion: $(EXT_VERSION)

# Storage upload — runs for both nightly and manual. 1ES releaseJob keeps
# production governance (package-publish approval on manual runs). No
# GH_TOKEN needed here. azcopy --overwrite=true makes retry safe.
- deployment: Publish_Storage
${{ if eq(variables['Build.Reason'], 'Schedule') }}:
dependsOn: []
environment: none
${{ else }}:
dependsOn: Create_GitHub_Release
environment: package-publish
condition: >-
and(
succeeded(),
ne('true', variables['Skip.Publish'])
)

pool:
name: azsdk-pool
Expand All @@ -82,10 +120,6 @@ stages:
artifactName: release
targetPath: release

- input: pipelineArtifact
artifactName: changelog
targetPath: changelog

strategy:
runOnce:
deploy:
Expand All @@ -103,28 +137,22 @@ stages:
displayName: Set StorageUploadLocations (nightly)
- ${{ else }}:
- pwsh: |
# Initial upload locations
$publishUploadLocations = '${{ parameters.SanitizedExtensionId }}/$(EXT_VERSION)'

Write-Host "Setting StorageUploadLocations to $publishUploadLocations"
Write-Host "###vso[task.setvariable variable=StorageUploadLocations]$publishUploadLocations"
displayName: Set StorageUploadLocations

- template: /eng/pipelines/templates/steps/publish-extension.yml
- template: /eng/pipelines/templates/steps/publish-extension-storage.yml
parameters:
PublishUploadLocations: $(StorageUploadLocations)
TagPrefix: azd-ext-${{ parameters.SanitizedExtensionId }}
TagVersion: $(EXT_VERSION)
# Nightly builds publish to storage only; no GitHub release since that'd just be a ton of clutter.
# Nightly extension consumers just grab it from blob storage.
${{ if eq(variables['Build.Reason'], 'Schedule') }}:
CreateGitHubRelease: false


# Updates the selected extension registry after the GitHub Release exists.
# Production registry updates also refresh global command snapshots.
# Mirrors Increment_Version in eng/pipelines/templates/stages/publish.yml.
- job: Update_Registry
dependsOn: Publish_Release
dependsOn:
- Publish_Storage
condition: >-
and(
succeeded(),
Expand All @@ -139,6 +167,8 @@ stages:
steps:
- checkout: self

- template: /eng/common/pipelines/templates/steps/login-to-github.yml

- template: /eng/pipelines/templates/steps/extension-set-metadata-variables.yml

- template: /eng/pipelines/templates/steps/setup-go.yml
Expand Down Expand Up @@ -243,7 +273,7 @@ stages:
--version "$(EXT_VERSION)"
displayName: Update $(ExtensionRegistryFile) (azd x publish)
env:
GH_TOKEN: $(azuresdk-github-pat)
GH_TOKEN: $(GH_TOKEN)

- ${{ if ne(parameters.PublishToDevRegistry, true) }}:
- bash: |
Expand Down
177 changes: 109 additions & 68 deletions eng/pipelines/templates/stages/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -459,96 +459,137 @@ stages:
PublishUploadLocations: pr/$(PRNumber)
UploadInstaller: true

- pwsh: |
$urlBase = "$(publish-storage-static-host)/azd/standalone/pr/$(PRNumber)"
Write-Host "##vso[task.setvariable variable=UrlBase;isOutput=true]$urlBase"
name: GenerateUrlBase
displayName: Set UrlBase
- job: Comment_On_PR
dependsOn: Publish_For_PR
condition: >-
and(
succeeded(),
ne(variables['Skip.Release'], 'true'),
or(
eq('PullRequest', variables['BuildReasonOverride']),
and(
eq('', variables['BuildReasonOverride']),
eq(variables['Build.Reason'], 'PullRequest')
)
)
)

- pwsh: |
$urlBase = "$(GenerateUrlBase.UrlBase)"
$linuxReleaseUrl = "$urlBase/azd-linux-amd64.tar.gz"
$linuxReleaseUrlArm64 = "$urlBase/azd-linux-arm64.tar.gz"
$macosReleaseUrl = "$urlBase/azd-darwin-amd64.zip"
$macosReleaseUrlArm64 = "$urlBase/azd-darwin-arm64.zip"
$windowsReleaseUrl = "$urlBase/azd-windows-amd64.zip"
$windowsReleaseUrlArm64 = "$urlBase/azd-windows-arm64-alpha.zip"
$msiReleaseUrl = "$urlBase/azd-windows-amd64.msi"
pool:
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux

steps:
- checkout: self

- task: DownloadPipelineArtifact@2
displayName: Download docs artifact
inputs:
artifactName: docs
targetPath: docs

$refDocContent = Get-Content docs/azd.md -Raw
- pwsh: |
$PRNumber = '$(System.PullRequest.PullRequestNumber)'
if ($env:PRNUMBEROVERRIDE) {
Write-Host "PR Number override: $($env:PRNUMBEROVERRIDE)"
$PRNumber = "$($env:PRNUMBEROVERRIDE)"
}
Write-Host "##vso[task.setvariable variable=PRNumber]$PRNumber"
displayName: Set PR Number Variable

$content = @"
<!-- #comment-cli-pr -->
## Azure Dev CLI Install Instructions
- pwsh: |
$urlBase = "$(publish-storage-static-host)/azd/standalone/pr/$(PRNumber)"
Write-Host "##vso[task.setvariable variable=UrlBase;isOutput=true]$urlBase"
name: GenerateUrlBase
displayName: Set UrlBase

### Install scripts
- pwsh: |
$urlBase = "$(GenerateUrlBase.UrlBase)"
$linuxReleaseUrl = "$urlBase/azd-linux-amd64.tar.gz"
$linuxReleaseUrlArm64 = "$urlBase/azd-linux-arm64.tar.gz"
$macosReleaseUrl = "$urlBase/azd-darwin-amd64.zip"
$macosReleaseUrlArm64 = "$urlBase/azd-darwin-arm64.zip"
$windowsReleaseUrl = "$urlBase/azd-windows-amd64.zip"
$windowsReleaseUrlArm64 = "$urlBase/azd-windows-arm64-alpha.zip"
$msiReleaseUrl = "$urlBase/azd-windows-amd64.msi"

#### MacOS/Linux
$refDocContent = Get-Content docs/azd.md -Raw

> May elevate using ``sudo`` on some platforms and configurations
$content = @"
<!-- #comment-cli-pr -->
## Azure Dev CLI Install Instructions

bash:
``````
curl -fsSL $urlBase/uninstall-azd.sh | bash;
curl -fsSL $urlBase/install-azd.sh | bash -s -- --base-url $urlBase --version '' --verbose --skip-verify
``````
### Install scripts

pwsh:
``````
Invoke-RestMethod '$urlBase/uninstall-azd.ps1' -OutFile uninstall-azd.ps1; ./uninstall-azd.ps1
Invoke-RestMethod '$urlBase/install-azd.ps1' -OutFile install-azd.ps1; ./install-azd.ps1 -BaseUrl '$urlBase' -Version '' -SkipVerify -Verbose
``````
#### MacOS/Linux

> May elevate using ``sudo`` on some platforms and configurations

#### Windows
bash:
``````
curl -fsSL $urlBase/uninstall-azd.sh | bash;
curl -fsSL $urlBase/install-azd.sh | bash -s -- --base-url $urlBase --version '' --verbose --skip-verify
``````

PowerShell install
pwsh:
``````
Invoke-RestMethod '$urlBase/uninstall-azd.ps1' -OutFile uninstall-azd.ps1; ./uninstall-azd.ps1
Invoke-RestMethod '$urlBase/install-azd.ps1' -OutFile install-azd.ps1; ./install-azd.ps1 -BaseUrl '$urlBase' -Version '' -SkipVerify -Verbose
``````

``````
powershell -c "Set-ExecutionPolicy Bypass Process; irm '$urlBase/uninstall-azd.ps1' > uninstall-azd.ps1; ./uninstall-azd.ps1;"
powershell -c "Set-ExecutionPolicy Bypass Process; irm '$urlBase/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl '$urlBase' -Version '' -SkipVerify -Verbose;"
``````

MSI install
``````
powershell -c "irm '$msiReleaseUrl' -OutFile azd-windows-amd64.msi; msiexec /i azd-windows-amd64.msi /qn"
``````
#### Windows

### Standalone Binary
PowerShell install

* Linux -
* x86_64 - $linuxReleaseUrl
* ARM64 - $linuxReleaseUrlArm64
* MacOS -
* x86_64 - $macosReleaseUrl
* ARM64 - $macosReleaseUrlArm64
* Windows -
* x86_64 - $windowsReleaseUrl
* ARM64 - $windowsReleaseUrlArm64
``````
powershell -c "Set-ExecutionPolicy Bypass Process; irm '$urlBase/uninstall-azd.ps1' > uninstall-azd.ps1; ./uninstall-azd.ps1;"
powershell -c "Set-ExecutionPolicy Bypass Process; irm '$urlBase/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl '$urlBase' -Version '' -SkipVerify -Verbose;"
``````

### MSI
MSI install
``````
powershell -c "irm '$msiReleaseUrl' -OutFile azd-windows-amd64.msi; msiexec /i azd-windows-amd64.msi /qn"
``````

* x86_64 - $msiReleaseUrl
### Standalone Binary

## Documentation
* Linux -
* x86_64 - $linuxReleaseUrl
* ARM64 - $linuxReleaseUrlArm64
* MacOS -
* x86_64 - $macosReleaseUrl
* ARM64 - $macosReleaseUrlArm64
* Windows -
* x86_64 - $windowsReleaseUrl
* ARM64 - $windowsReleaseUrlArm64

<details>
<summary>learn.microsoft.com documentation</summary>
### MSI

$refDocContent
* x86_64 - $msiReleaseUrl

</details>
"@
$file = New-TemporaryFile
Set-Content -Path $file -Value $content
Write-Host "##vso[task.setvariable variable=CommentBodyFile]$file"
displayName: Write body content to temporary file
## Documentation

- template: /eng/pipelines/templates/steps/update-prcomment.yml
parameters:
PrNumber: $(PRNumber)
BodyFile: $(CommentBodyFile)
Tag: '<!-- #comment-cli-pr -->'
<details>
<summary>learn.microsoft.com documentation</summary>

$refDocContent

</details>
"@
$file = New-TemporaryFile
Set-Content -Path $file -Value $content
Write-Host "##vso[task.setvariable variable=CommentBodyFile]$file"
displayName: Write body content to temporary file

- template: /eng/common/pipelines/templates/steps/login-to-github.yml

- template: /eng/pipelines/templates/steps/update-prcomment.yml
parameters:
PrNumber: $(PRNumber)
BodyFile: $(CommentBodyFile)
Tag: '<!-- #comment-cli-pr -->'
GitHubToken: $(GH_TOKEN)

- stage: PublishInstallers
dependsOn: Sign
Expand Down
Loading