Image download for BYOC on Cloud fails

ProphetLamb's Avatar

ProphetLamb

23 Feb, 2022 11:28 AM

I am in a `sudo pwsh` session and followed the instructions for setting up the machine.
```
Install-Module AppVeyorBYOC -Scope CurrentUser -Force; Import-Module AppVeyorBYOC
Connect-AppVeyorToComputer -AppVeyorUrl https://ci.appveyor.com -ApiToken Nonononononoo -v
```
And receive the following output:
```
Checking AppVeyor API access...
VERBOSE: GET with 0-byte payload
VERBOSE: received 7954-byte response of content type text/html
VERBOSE: GET with 0-byte payload
VERBOSE: received 15370-byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: GET with 0-byte payload
VERBOSE: received 304-byte response of content type application/json
VERBOSE: Content encoding: utf-8
Configuring 'Process' build cloud in AppVeyor
VERBOSE: GET with 0-byte payload
VERBOSE: received 304-byte response of content type application/json
VERBOSE: Content encoding: utf-8
AppVeyor cloud 'ubuntu-carannante-4gb-hel1-1' already exists.
Reading Host Agent authorization token from the existing cloud.
VERBOSE: GET with 0-byte payload
VERBOSE: received 415-byte response of content type application/json
VERBOSE: Content encoding: utf-8

Ensure build worker image is available for AppVeyor projects
VERBOSE: GET with 0-byte payload
VERBOSE: received 61-byte response of content type application/json
VERBOSE: Content encoding: utf-8
AppVeyor build worker image 'Linux' already exists.

Installing AppVeyor Host Agent
OS: Linux
Downloading appveyor-host-agent.deb...
Connect-AppVeyorToComputer: Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
PS /home/appveyor>
```
We can rwx in the home directory and all subdirectories.
The PowerShell error is related to the destination of the download being invalid, but the script does not log what it actually yeeted into `DownloadFile`. How do I go about debugging/fixing the script? Do I need to specify some `$Env:APPVEYOR_IMG_DOWNLOAD_PATH` or similar variable?

  1. Support Staff 1 Posted by Feodor Fitsner on 23 Feb, 2022 05:41 PM

    Feodor Fitsner's Avatar

    I don't think you need sudo pwsh. Try without sudo.

    Also, try downloading https://www.appveyor.com/downloads/appveyor/appveyor-host-agent.deb from that VM, to exclude network factor.

  2. 2 Posted by ProphetLamb on 24 Feb, 2022 09:12 AM

    ProphetLamb's Avatar

    Thanks for the reply. Sadly your answer didn't quite help me fix the issue.
    First I curled the image you specified, it works. We now have the working directory with the image. Now the next question arises. How can I force the ps script to use the downloaded image?
    One interesting little tidbit is that there seems to be an issue with the ssl cert on the appveyor side of things as `curl -L https://help.appveyor.com/discussions/problems/31523/r?go=aHR0cHM6Ly93d3cuYXBwdmV5b3IuY29tL2Rvd25sb2Fkcy9hcHB2ZXlvci9hcHB2ZXlvci1ob3N0LWFnZW50LmRlYg%3D%3D` yields
    ```
    curl: (60) SSL certificate problem: unable to get local issuer certificate
    More details here: https://curl.haxx.se/docs/sslcerts.html
    ```
    SSL seems to work just fine on the actual site `curl -L -o appveyor-host-agent.deb https://www.appveyor.com/downloads/appveyor/appveyor-host-agent.deb`. So that should not be a problem. The download works.

    Interacting with docker requires sudo context. As such the script was unable to interact with the container when executing form `pwsh` only. Except from the cout
    ```
    Pulling base Docker image appveyor/build-image:minimal-ubuntu-20.04
    Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=appveyor%2Fbuild-image&tag=minimal-ubuntu-20.04: dial unix /var/run/docker.sock: connect: permission denied
    No custom image has been built - just tagging 'appveyor/build-image:minimal-ubuntu-20.04' image as 'appveyor-byoc-linux'
    Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/appveyor/build-image:minimal-ubuntu-20.04/tag?repo=appveyor-byoc-linux&tag=latest: dial unix /var/run/docker.sock: connect: permission denied

    Ensure build worker image is available for AppVeyor projects
    AppVeyor build worker image 'Linux' already exists.

    Installing AppVeyor Host Agent
    OS: Linux
    Downloading appveyor-host-agent.deb...
    Connect-AppVeyorToDocker: Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
    ```

    Still we do not actually know what the issue is, as there is no specific error message provided by the script.

  3. Support Staff 3 Posted by Feodor Fitsner on 24 Feb, 2022 05:28 PM

    Feodor Fitsner's Avatar

    In what data center was that VM created?

  4. 4 Posted by ProphetLamb on 26 Feb, 2022 10:19 AM

    ProphetLamb's Avatar

    The VPS is managed by Hetzner clould.

    | --- | --- |
    | Datacenter | hel1-dc2 |
    | City | Helsinki |
    | Country | Finland |
    | Network zone | eu-central |

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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