Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESRP safety net #31292

Merged
merged 49 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
314f474
publish tag init commit
ckairen Aug 27, 2024
19bd1d4
Merge branch 'main' into al/publish-tag
ckairen Oct 2, 2024
d98f3f0
cleanup
ckairen Oct 2, 2024
96eee51
publish tag testing before actual npm tag change
ckairen Oct 2, 2024
3ceb250
temporarily removing unit test
ckairen Oct 2, 2024
8a39825
add verify npm tag pwsh path
ckairen Oct 2, 2024
0035793
add npm dist tag change
ckairen Oct 10, 2024
dd1ad95
add artifacts
ckairen Oct 10, 2024
63038a6
add artifacts
ckairen Oct 10, 2024
7e09bb7
package name
ckairen Oct 10, 2024
4e175da
update package name
ckairen Oct 11, 2024
4316967
Update eng/scripts/verify-npm-tags.ps1
ckairen Oct 22, 2024
e071b59
pr adjustments
ckairen Oct 22, 2024
3d89b56
change verify npm tags script to check for intended tags
ckairen Nov 4, 2024
1b5011f
Merge branch 'main' into al/publish-tag
ckairen Nov 4, 2024
36420bf
bug fix
ckairen Nov 4, 2024
864ff4f
set debug trace
ckairen Nov 5, 2024
69b6268
temp dir
ckairen Nov 5, 2024
7e26858
tar file location
ckairen Nov 5, 2024
8ddb743
tar file location
ckairen Nov 5, 2024
ab8e657
tar file full path
ckairen Nov 5, 2024
a10ca8d
json object as parameter
ckairen Nov 5, 2024
a1cf0c3
quote
ckairen Nov 5, 2024
37ac3f8
pck name
ckairen Nov 5, 2024
b98af61
warning
ckairen Nov 5, 2024
ce82b77
tag variable
ckairen Nov 5, 2024
93f2cfa
telem
ckairen Nov 5, 2024
cf08232
quote
ckairen Nov 5, 2024
2581275
json file path
ckairen Nov 7, 2024
7f8247e
json file path
ckairen Nov 7, 2024
45670de
cleanup
ckairen Nov 7, 2024
c533662
cleanup
ckairen Nov 7, 2024
2588c99
testing
ckairen Nov 7, 2024
86ef72e
testing 2
ckairen Nov 7, 2024
e2d9cc9
revert testing
ckairen Nov 7, 2024
58adec0
npm auth token
ckairen Nov 7, 2024
10c6baa
test 1
ckairen Nov 7, 2024
73904fc
test 1
ckairen Nov 7, 2024
a975cbe
test 1
ckairen Nov 7, 2024
7f0c8d9
test 1
ckairen Nov 8, 2024
a355faa
test 1
ckairen Nov 8, 2024
71d3828
test 2
ckairen Nov 8, 2024
f594556
cleanup
ckairen Nov 8, 2024
8975c2f
test 2
ckairen Nov 8, 2024
e55977a
test 2
ckairen Nov 8, 2024
d12b624
clean
ckairen Nov 8, 2024
c5d6e54
test1
ckairen Nov 8, 2024
fbfceed
clean
ckairen Nov 8, 2024
9f57e82
Update eng/pipelines/templates/stages/archetype-sdk-client.yml
ckairen Nov 11, 2024
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
2 changes: 0 additions & 2 deletions eng/pipelines/templates/stages/archetype-js-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ stages:
condition: succeeded()
- template: /eng/pipelines/templates/steps/npm-release-task.yml
parameters:
ArtifactName: ${{parameters.ArtifactName}}
Artifact: ${{artifact}}
Registry: ${{parameters.Registry}}
PathToArtifacts: $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}}
Expand Down Expand Up @@ -258,7 +257,6 @@ stages:
displayName: Detecting package archive_${{artifact.name}}
- template: /eng/pipelines/templates/steps/npm-release-task.yml
parameters:
ArtifactName: ${{parameters.ArtifactName}}
Artifact: ${{artifact}}
Registry: ${{parameters.Registry}}
PathToArtifacts: $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}}
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/stages/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extends:
Artifacts: ${{ parameters.Artifacts }}
${{ if eq(parameters.ServiceDirectory, 'template') }}:
TestPipeline: true
RunUnitTests: ${{ parameters.RunUnitTests }}
RunUnitTests: false
ckairen marked this conversation as resolved.
Show resolved Hide resolved
MatrixConfigs:
- ${{ each config in parameters.MatrixConfigs }}:
- ${{ config }}
Expand Down
1 change: 0 additions & 1 deletion eng/pipelines/templates/stages/partner-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ extends:

- template: /eng/pipelines/templates/steps/npm-release-task.yml
parameters:
ArtifactName: Partner Drop
Artifact:
name: Partner Drop
path: $(Artifacts)
Expand Down
8 changes: 7 additions & 1 deletion eng/pipelines/templates/steps/npm-release-task.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
parameters:
ArtifactName: ''
Artifact: {}
Registry: ''
PathToArtifacts: ''
Expand Down Expand Up @@ -47,3 +46,10 @@ steps:
arguments: -pathToArtifacts ${{parameters.PathToArtifacts}} -accessLevel "public" -tag "${{parameters.Tag}}" -additionalTag "${{parameters.AdditionalTag}}" -registry ${{parameters.Registry}} -npmToken $(azure-sdk-npm-token)
pwsh: true
condition: succeeded()

- task: Powershell@2
displayName: Verify package tags
inputs:
packageArtifact: ${{parameters.Artifact.name}}
workingDirectory: $(System.DefaultWorkingDirectory)

65 changes: 65 additions & 0 deletions eng/scripts/verify-npm-tags.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
param (
[Parameter(mandatory = $true)]
$packageArtifact,
[Parameter(mandatory = $true)]
$workingDirectory
)

$HelpersPath = Join-Path $PSScriptRoot "helpers"
. (Join-Path $HelpersPath npm-helpers.ps1)

$pkgProps = Get-javascript-PackageInfoFromPackageFile -pkg $packageArtifact -workingDirectory $workingDirectory
if (!$pkgProps)
{
Write-Error "Failed to parse package artifact $packageArtifact to get package name"
exit 1
}

$packageName = $pkgProps.PackageId
# TODO: delete testing comments below
#'@azure/eventhubs-checkpointstore-table' alpha, no beta, no GA
#'@azure/openai' alpha, beta, no GA
#'@azure/video-indexer-widgets' no alpha, no beta, GA
#'@azure/template' alpha, beta, GA
#$pkgProps.PackageId
Write-Host "Verify npm tag versions for package $packageName"
$packageVersions = npm view $packageName versions --json | ConvertFrom-Json
$validDev = $packageVersions | ? { $_ -match "alpha" } | Select-Object -Last 1
ckairen marked this conversation as resolved.
Show resolved Hide resolved
$validNext = $packageVersions | ? { $_ -match "beta" } | Select-Object -Last 1
$validLatest = $packageVersions | ? { !($_ -match "alpha") -and !($_ -match "beta") } | Select-Object -Last 1
if (!$validLatest) {
Write-Host "No GA package found"
$validLatest = $packageVersions | ? { $_ -match "beta" } | Select-Object -Last 1
}
if (!$validLatest) {
Write-Host "No beta package found"
$validLatest = $packageVersions | ? { $_ -match "alpha" } | Select-Object -Last 1
}

$currentDev = npm view $packageName@dev version --silent
ckairen marked this conversation as resolved.
Show resolved Hide resolved
$currentNext = npm view $packageName@next version --silent
$currentLatest = npm view $packageName@latest version --silent

if ($validDev) {
Write-Host "Dev version should be: $validDev, current dev version: $currentDev"
if ($validDev -ne $currentDev) {
Write-Host "Changing dev version from $currentDev to $validDev"
# TODO: add npm command for tag change
}
}

if ($validNext) {
Write-Host "Next version should be: $validNext, current next version: $currentNext"
if ($validNext -ne $currentNext) {
Write-Host "Changing next version from $currentNext to $validNext"
# TODO: add npm command for tag change
}
}

if ($validLatest) {
Write-Host "Latest version should be: $validLatest, current latest version: $currentLatest"
if ($validLatest -ne $currentLatest) {
Write-Host "Changing latest version from $currentLatest to $validLatest"
# TODO: add npm command for tag change
}
}