Problems fetching artifact from another build

trejkaz's Avatar

trejkaz

15 May, 2018 12:14 AM

I was trying to fetch a file yesterday which definitely exists, by doing this:

install:
  - appveyor DownloadFile "https://ci.appveyor.com/api/projects/trejkaz/OpenVR-InputEmulator/artifacts/lib_vrinputemulator/%CONFIGURATION%/LibVRInputEmulator.zip?job=Configuration%3A+%CONFIGURATION%"

But of course it doesn't fetch the file, and the appveyor tool provides absolutely no useful output to diagnose what went wrong. (What would have helped: if it printed out the URL it was trying to fetch, I would have seen the escaping problem.)

So after switching to curl to hopefully get some better diagnostics, I eventually arrived at:

install:
  - curl -fLv -o LibVRInputEmulator.zip "https://ci.appveyor.com/api/projects/trejkaz/OpenVR-InputEmulator/artifacts/lib_vrinputemulator/%CONFIGURATION%/LibVRInputEmulator.zip?job=Configuration%%%%3A+%CONFIGURATION%"

This hits the first URL, which gives me a 302, and then the second URL gives me a 404. You can see that result here:

https://ci.appveyor.com/project/trejkaz/vrplayspacemover/build/1.0....

When I visit the URL it got redirected to, indeed it was 404. So it's as if something in the appveyor backend generated me the wrong URL for my request. When I visited the original URL in my browser, though, it downloaded the file. So at this point, I have no idea why the build environment is finding it so hard to download a file.

I have tried with and without escaping of the slashes in the artifact URL and nothing has worked so far, so I guess I'm resorting to asking how this is supposed to work.

Side-question: Is it possible to have the leading subfolders stripped from artifact paths? It would make builds more stable in the future, as the path to the subfolder could be renamed at any point.

  1. Support Staff 1 Posted by Ilya Finkelshte... on 15 May, 2018 04:06 AM

    Ilya Finkelshteyn's Avatar

    Please check this discussion for explanation and solutions.

    Also this blog post contains good example of downloading artifacts from different project.

    Regarding side question, it would be great if you create separate issue, with specific build example.

  2. 2 Posted by trejkaz on 15 May, 2018 04:12 AM

    trejkaz's Avatar

    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?

    Both projects are public, both on GitHub and on AppVeyor, so I didn't expect to need such things.

  3. Support Staff 3 Posted by Ilya Finkelshte... on 16 May, 2018 07:20 AM

    Ilya Finkelshteyn's Avatar

    If you call API, you still have to authorize. Please see this build and YAML below, created to do exactly what you need. Sure you have to use your own token and use it as a secure variable.

    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
    
  4. 4 Posted by trejkaz on 17 May, 2018 04:03 AM

    trejkaz's Avatar

    At this point, then, I think it will be easier to just inline the first project's build into the second project's build.

    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.

  5. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:28 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac