Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Job 'Environment: test=1' uploads artifact. Others wait while it finishes and download it.
- cmd: echo skip clone
secure: SlDEDtAKuvsy+VErEuc/4DxdhPeKu2WRqvYzEh/fiH4=
TimeOutMins: 2
jobToWait: 'Environment: test=1'
- test: 1
- test: 2
- ps: |
if ($env:APPVEYOR_JOB_NAME -eq $env:jobToWait) {
Get-Date > date.txt
Push-AppveyorArtifact .\date.txt # upload artifact for otjer job to download
if ($env:APPVEYOR_JOB_NAME -ne $env:jobToWait) {
write-host "Waiting for job `"$env:jobToWait`" to complete"
$headers = @{
"Authorization" = "Bearer $ApiKey"
"Content-type" = "application/json"
[datetime]$stop = ([datetime]::Now).AddMinutes($env:TimeOutMins)
[bool]$success = $false
while(!$success -and ([datetime]::Now) -lt $stop) {
$project = Invoke-RestMethod -Uri "$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG" -Headers $headers -Method GET
$jobToWaitJson = $ | where {$ -eq $env:jobToWait}
$success = $jobToWaitJson.status -eq "success"
$jobToWaitId = $jobToWaitJson.jobId;
if (!$success) {Start-sleep 5}
if (!$success) {throw "Job `"$env:jobToWait`" was not finished in $env:TimeOutMins minutes"}
if (!$jobToWaitId) {throw "Unable t get JobId for the job `"$env:jobToWait`""}
build: off
test: off

This comment has been minimized.

Copy link

commented Apr 29, 2018

For example the environment variable jobToWait: 'Environment: test=1' will be:

  • For Ubuntu: jobToWait: 'image: Ubuntu'
  • For Windows: jobToWait: 'image: Visual Studio 2017'

This comment has been minimized.

Copy link

commented Aug 23, 2018

I used matrix and did "Push-AppveyorArtifact" from 'ubuntu', then tried "Start-FileDownload" from 'Visual Studio 2017'.
Got error status code 404.

Do I need Token Api to get the file? How do I specify that for "Start-FileDownload" command?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.