Skip to content

Commit

Permalink
Delay updating binder until MCR image is available. (microsoft#287)
Browse files Browse the repository at this point in the history
* 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.
30 changes: 27 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
$Now = [DateTime]::Now;
$ImageTag = "${{ github.sha }}"
$RepoName = "public/quantum/samples"
$LocalTag = "${RepoName}:${ImageTag}"
$RemoteRepo = "${{ secrets.ACR_REGISTRY }}/${RepoName}"
Expand All @@ -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 {
Expand All @@ -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:
Expand Down

0 comments on commit 803eee0

Please sign in to comment.