forked from microsoft/Quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delay updating binder until MCR image is available. (microsoft#287)
* Delay updating binder until MCR image is available. * Print out diagnostics on spinlock. * Remove trigger used in tests.
- Loading branch information
Chris Granade
authored
Jan 8, 2020
1 parent
c580cf9
commit 803eee0
Showing
1 changed file
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -23,7 +23,7 @@ jobs: | |
$Now = [DateTime]::Now; | ||
$ImageTag = "${{ github.sha }}" | ||
$RepoName = "public/quantum/samples" | ||
$LocalTag = "${RepoName}:${ImageTag}" | ||
$RemoteRepo = "${{ secrets.ACR_REGISTRY }}/${RepoName}" | ||
|
@@ -33,14 +33,38 @@ jobs: | |
docker tag $LocalTag "${RemoteRepo}:latest" | ||
docker push "${RemoteRepo}:latest" | ||
shell: pwsh | ||
- name: Wait for image to publish | ||
run: | | ||
function Get-Tags() { | ||
Invoke-WebRequest https://mcr.microsoft.com/v2/quantum/samples/tags/list ` | ||
| Select-Object -ExpandProperty Content ` | ||
| ConvertFrom-Json ` | ||
| Select-Object -ExpandProperty tags ` | ||
| Write-Output; | ||
} | ||
$ImageAvailable = $false; | ||
$ImageTag = "${{ github.sha }}"; | ||
$CheckInterval = 30; # [seconds] | ||
while (-not $ImageAvailable) { | ||
if ($ImageTag -in (Get-Tags)) { | ||
Write-Host "##[info] Image $ImageTag now available on mcr.microsoft.com, proceeding." | ||
$ImageAvailable = $true; | ||
} else { | ||
Write-Host "##[info] Image $ImageTag not yet available on mcr.microsoft.com, waiting $CheckInterval seconds."; | ||
} | ||
Start-Sleep -Seconds $CheckInterval; | ||
} | ||
shell: pwsh | ||
- name: Update Binder configuration | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
$ThisCommit = "${{ github.sha }}" | ||
git checkout ⭐binder | ||
git reset --hard $ThisCommit | ||
$Dockerfile = Get-Content ./Dockerfile; | ||
$Dockerfile ` | ||
| ForEach-Object { | ||
|
@@ -55,7 +79,7 @@ jobs: | |
git add Dockerfile | ||
git commit -m "Updated Binder to use $ThisCommit." | ||
shell: pwsh | ||
|
||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
|