Skip to content

Commit

Permalink
Bug fix for pipeline downloading incorrect package ver (Azure#20294)
Browse files Browse the repository at this point in the history
* Bug fix: pipeline to download correct package ver

* Update clean version

* Update clean version

* Cleanup

* Cleanup

* Cleanup

* Cleanup

* Comments added

* Testing

* Final-Version
  • Loading branch information
ckairen authored and hildurhodd committed Aug 26, 2021
1 parent e2423bc commit b5acdd0
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions eng/pipelines/templates/jobs/smoke.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ jobs:
timeoutInMinutes: 5

- pwsh: |
$packages = Get-ChildItem "$(Pipeline.Workspace)/${{ parameters.ArtifactName }}/*.zip"
$packages = Get-ChildItem "$(Pipeline.Workspace)/${{ parameters.ArtifactName }}/${{ parameters.Artifact.name }}/*.zip"
Write-Host "Artifacts found:"
$artifacts = $packages | ForEach-Object {
if ($_.Name -match "([a-zA-Z\-]+)\-(.*).zip") {
Write-Host "$($matches[1]): $($matches[2])"
return @{ "name" = $matches[1]; "version" = $matches[2] }
}
}
$dependencies = Get-Content $env:REQUIREMENTS | ForEach-Object {
$dependencies = Get-Content $(requirements) | ForEach-Object {
$line = $_
if ($line -match "([a-zA-Z\-]+)(\W+)(.*)") {
$override = ($artifacts | Where-Object { $_.Name -eq $matches[1] }).Version
Expand All @@ -179,36 +179,44 @@ jobs:
return $line
}
$dependencies | Out-File $env:REQUIREMENTS
$dependencies | Out-File $(requirements)
displayName: Override requirements with pipeline build artifact versions
env:
REQUIREMENTS: $(requirements)
- pwsh: pip install -r "$env:REQUIREMENTS" --no-deps --upgrade
# Retry for pip install due to delay in package availability after publish
# The package is expected to be available for download/installation within 10 minutes
- pwsh: |
$ErrorActionPreference = "Continue"
while ($retries++ -lt 15) {
Write-Host "pip install -r $(requirements) --no-deps --upgrade --no-cache-dir"
pip install -r "$(requirements)" --no-deps --upgrade --no-cache-dir
if ($LASTEXITCODE) {
if ($retries -ge 15) {
exit $LASTEXITCODE
}
Write-Host "Installation failed, retrying in 1 minute..."
sleep 60
} else {
break
}
}
displayName: Install requirements without dependencies
env:
REQUIREMENTS: $(requirements)
- ${{ if eq(parameters.Daily, true) }}:
- pwsh: |
pip install -r "$env:REQUIREMENTS" --pre --no-deps --upgrade `
pip install -r "$(requirements)" --pre --no-deps --upgrade `
--index-url https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple
displayName: Install requirements from dev feed without dependencies
env:
REQUIREMENTS: $(requirements)
- pwsh: pip install -r $(Build.SourcesDirectory)/common/smoketest/requirements_async.txt
displayName: "Install requirements_async.txt"
condition: and(succeeded(), ne(variables['SkipAsyncInstall'], true))

- pwsh: |
python $(Build.SourcesDirectory)/common/smoketest/dependencies.py -r "$env:REQUIREMENTS" `
python $(Build.SourcesDirectory)/common/smoketest/dependencies.py -r "$(requirements)" `
| Out-File $(Build.SourcesDirectory)/common/smoketest/requirements_dependencies.txt
displayName: Create dependency list from installed packages
env:
REQUIREMENTS: $(requirements)
- script: pip install -r $(Build.SourcesDirectory)/common/smoketest/requirements_dependencies.txt
displayName: Install package dependencies from PyPI
Expand Down

0 comments on commit b5acdd0

Please sign in to comment.