-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add Conda publishing to Conda build pipeline #44944
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6e45cb1
initial pipeline draft
JennyPng 16370d4
refinement
JennyPng f5442e6
comment out entire upload portion for testing!
JennyPng 81e35d2
remove checkout
JennyPng 28b4144
one more check
JennyPng ca52278
uncomment upload step
JennyPng 75600dd
Merge branch 'main' into jennypng-conda-publish
JennyPng b692f48
remove private flag, which was for testing
JennyPng 296d484
trigger should include subdirectories
JennyPng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
86 changes: 64 additions & 22 deletions
86
eng/pipelines/templates/stages/archetype-conda-release.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,74 @@ | ||
| parameters: | ||
| - name: CondaArtifacts | ||
| type: object | ||
| - name: DependsOn | ||
| type: string | ||
| default: Build | ||
| - name: ArtifactName | ||
| type: string | ||
| default: 'conda' | ||
|
|
||
| stages: | ||
| # - ${{if and(eq(variables['Build.Reason'], 'Manual'), eq(variables['System.TeamProject'], 'internal'))}}: | ||
| - stage: Release | ||
| displayName: 'Conda Release' | ||
| dependsOn: ${{parameters.DependsOn}} | ||
| condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-python-pr')) | ||
| jobs: | ||
| - deployment: CondaRelease | ||
| displayName: "Publish Conda Artifact" | ||
| # environment: pypi | ||
| - ${{if and(in(variables['Build.Reason'], 'Manual', ''), eq(variables['System.TeamProject'], 'internal'))}}: | ||
| - stage: Release_Conda | ||
| displayName: 'Release Conda Packages' | ||
| dependsOn: ${{parameters.DependsOn}} | ||
| condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-python-pr')) | ||
| jobs: | ||
| - deployment: PublishCondaPackages | ||
| displayName: "Publish Conda Packages to Anaconda" | ||
| environment: package-publish | ||
|
|
||
| templateContext: | ||
| type: releaseJob | ||
| isProduction: true | ||
| inputs: | ||
| - input: pipelineArtifact | ||
| artifactName: ${{parameters.ArtifactName}} | ||
| targetPath: $(Pipeline.Workspace)/${{parameters.ArtifactName}} | ||
|
|
||
| pool: | ||
| name: azsdk-pool | ||
| image: ubuntu-24.04 | ||
| os: linux | ||
|
|
||
| pool: | ||
| name: 'azsdk-pool' | ||
| demands: ImageOverride -equals 'ubuntu-24.04' | ||
| strategy: | ||
| runOnce: | ||
| deploy: | ||
| steps: | ||
| - task: UsePythonVersion@0 | ||
| inputs: | ||
| versionSpec: '3.12' | ||
|
|
||
| strategy: | ||
| runOnce: | ||
| deploy: | ||
| steps: | ||
| - checkout: self | ||
| - ${{ each artifact in parameters.CondaArtifacts }}: | ||
| - pwsh: | | ||
| Write-Host "${{ artifact.name }} is ${{ artifact.inBatch }}" | ||
| Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}} -Filter "*.conda" | ||
| workingDirectory: $(Pipeline.Workspace) | ||
| displayName: Output Visible Conda Artifact | ||
| displayName: Output Visible Conda Artifacts | ||
|
|
||
| - script: | | ||
| set -e | ||
| python -m pip install anaconda-client | ||
| displayName: Install anaconda-client | ||
|
|
||
| - pwsh: | | ||
| $packages = Get-ChildItem -Path "$(Pipeline.Workspace)/${{parameters.ArtifactName}}/noarch" -Filter "*.conda" | ||
| foreach ($package in $packages) { | ||
| Write-Host "Uploading: $($package.FullName)" | ||
JennyPng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $success = $false | ||
| for ($attempt = 1; $attempt -le 3; $attempt++) { | ||
| anaconda upload --user $env:CONDA_USERNAME --skip-existing $package.FullName | ||
| if ($LASTEXITCODE -eq 0) { | ||
| $success = $true | ||
| break | ||
| } | ||
| Write-Host "Attempt $attempt failed, retrying..." | ||
| Start-Sleep -Seconds 5 | ||
| } | ||
| if (-not $success) { | ||
| Write-Error "Failed to upload $($package.Name) after 3 attempts" | ||
| exit 1 | ||
| } | ||
| } | ||
| Write-Host "Uploaded all conda packages to Anaconda" | ||
| displayName: 'Publish all Conda packages to Anaconda' | ||
| env: | ||
| ANACONDA_API_TOKEN: $(conda-release-apikey) | ||
| CONDA_USERNAME: Microsoft | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.