tag:help.appveyor.com,2012-11-13:/discussions/problems/14165-problems-fetching-artifact-from-another-buildAppVeyor: Discussion 2018-10-19T08:18:46Ztag:help.appveyor.com,2012-11-13:Comment/452824152018-05-15T04:06:11Z2018-05-15T04:06:11ZProblems fetching artifact from another build<div><p>Please check <a href="https://help.appveyor.com/discussions/problems/13969-cant-use-curl-to-download-artifacts">this discussion</a> for explanation and solutions.</p>
<p>Also <a href="https://www.appveyor.com/blog/2015/11/04/deployment-projects/">this blog post</a> contains good example of downloading artifacts from different project.</p>
<p>Regarding side question, it would be great if you create separate issue, with specific build example.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/452824152018-05-15T04:12:44Z2018-05-15T04:12:44ZProblems fetching artifact from another build<div><p>So, I have had a read, and the one thing that stands out is that everyone is worrying about authorisation tokens. Is it the case that, if I don't have an authorisation token, I just can't download artifacts? If this is the case, is there a common workaround to avoid needing that?</p>
<p>Both projects are public, both on GitHub and on AppVeyor, so I didn't expect to need such things.</p></div>trejkaztag:help.appveyor.com,2012-11-13:Comment/452824152018-05-16T07:20:34Z2018-05-16T07:20:34ZProblems fetching artifact from another build<div><p>If you call API, you still have to authorize. Please see <a href="https://ci.appveyor.com/project/IlyaFinkelshteyn/projecta/build/1.0.1600">this</a> build and YAML below, created to do exactly what you need. Sure you have to use your own token and use it as a <a href="https://www.appveyor.com/docs/build-configuration/#secure-variables">secure variable</a>.</p>
<pre>
<code>version: 1.0.{build}
configuration:
- Release
- Debug
environment:
token: 14iltqlbh3um0c0ppj0h
build_script:
- ps: Invoke-RestMethod -Method Get -Uri "https://ci.appveyor.com/api/projects/trejkaz/openvr-inputemulator/artifacts/LibVRInputEmulator-$env:Configuration.zip?job=Configuration%3A%20$env:Configuration" -OutFile ".\LibVRInputEmulator-$env:Configuration.zip" -Headers @{ "Authorization" = "Bearer $env:token" }
test_script:
- cmd: dir *zip</code>
</pre></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/452824152018-05-17T04:03:50Z2018-05-17T04:03:50ZProblems fetching artifact from another build<div><p>At this point, then, I think it will be easier to just inline the first project's build into the second project's build.</p>
<p>There were various other errors that came up while trying to reuse the first project's build products anyway, which were beyond my knowledge of Windows-specific build issues. e.g., I didn't know that you can't link libraries from multiple versions of the compiler together, which in itself ruins most of my plans to share one project's builds with the other. One project wanted VS 2015 and the other wanted 2017, and linking the two together was apparently impossible. So the second project would have to rebuild the entire thing anyway, at which point I figured I would just give up trying to share artifacts.</p></div>trejkaz