installing GnuPG for tests

Yurii Rashkovskii's Avatar

Yurii Rashkovskii

01 May, 2018 09:19 PM

Hi,

I don't know much about Windows and instrumenting AppVeyor, but I am using it for running tests on my open source project (https://github.com/sit-it/sit) and I am wondering how I can modify appveyor.yml to install GnuPG, as some upcoming tests will require its presence. It seems to be available by default on Travis CI, but I am not sure how to do this here.

Any advice will be highly appreciated!

  1. Support Staff 1 Posted by Owen McDonnell on 01 May, 2018 10:17 PM

    Owen McDonnell's Avatar

    Appveyor build machines come with Chocolatey pre installed so a good first stop would be to go here to see if they have a package that suits your requirements. If so, its an easy one line addition to your appveyor.yml install section.

  2. 2 Posted by Yurii Rashkovsk... on 02 May, 2018 02:59 PM

    Yurii Rashkovskii's Avatar

    Owen,

    Thank you so much for this advice. I tried to follow it, but the build hangs and times out here:

    Installing gnupg-modern...
    Chocolatey timed out waiting for the command to finish. The timeout
     specified (or the default value) was '2700' seconds. Perhaps try a
     higher `--execution-timeout`? See `choco -h` for details.

    Any thoughts?

  3. Support Staff 3 Posted by Owen McDonnell on 02 May, 2018 03:38 PM

    Owen McDonnell's Avatar

    Can you try

    - cmd: appveyor-retry choco install gnupg-modern
    
    and let me know if that helps.
  4. 4 Posted by Yurii Rashkovsk... on 02 May, 2018 08:30 PM

    Yurii Rashkovskii's Avatar

    Owen,

    The problem with the timeout (45 minutes) trying to install gnupg-modern persists https://ci.appveyor.com/project/yrashk/sit/build/job/ehkjpn4nebcus0ai

    I am wondering if there's anything we can do to figure out the reason.

  5. Support Staff 5 Posted by Owen McDonnell on 03 May, 2018 07:12 PM

    Owen McDonnell's Avatar

    I realized that the problem is that the installer tries to add to the machine path environment variable which makes a system dialog pop up notifying that the path variable is too large.
    Workaround is to modify that variable,

    - ps: |
            $path = [Environment]::GetEnvironmentVariable("path", "machine")
            $newPath = ($path.Split(';') | Where-Object { $_ -eq 'C:\ProgramData\chocolatey\bin' }) -join ';'
            [Environment]::SetEnvironmentVariable("path", $newPath, "machine")
    
    Do this before you run the choco install gpg4win command.
    However, i'm not sure if the removal of all those values in the path will affect your build. You may have to add what you need to the process path with a simple SET PATH=%PATH%;<whatever-you-need>
  6. 6 Posted by Yurii Rashkovsk... on 03 May, 2018 07:17 PM

    Yurii Rashkovskii's Avatar

    Owen,

    Thank you so much for your help trying to figure this out. I can see it wasn't easy to figure this out.

    Any advice on how to proceed, provided that I still need gpg to be in the PATH... I assume doing SET PATH as you recommended will bring it over the max length again?

    Thank you.

  7. Support Staff 7 Posted by Owen McDonnell on 03 May, 2018 08:52 PM

    Owen McDonnell's Avatar

    The installer itself will put gpg in the in the path (that is what was preventing the installer from exiting in the first place!). Furthermore, when you set the path with SET PATH=%PATH%;<whatever-you-need> you are setting the process path variable not the variable for the machine.

  8. Support Staff 8 Posted by Ilya Finkelshte... on 03 May, 2018 11:01 PM

    Ilya Finkelshteyn's Avatar

    I have to add you need to use $env:path, not just $path in PowerShell.

    UPDATE: disregard this, I misread the script

  9. 9 Posted by Yurii Rashkovsk... on 04 May, 2018 07:45 PM

    Yurii Rashkovskii's Avatar

    Owen,

    Thank you so much for your help. I finally managed to make the build to work: https://ci.appveyor.com/project/yrashk/sit/build/job/hmlyij2xd9jsxxef with this config https://github.com/sit-it/sit/blob/master/appveyor.yml

  10. Support Staff 10 Posted by Owen McDonnell on 04 May, 2018 07:55 PM

    Owen McDonnell's Avatar

    Great, thanks for the update!

  11. 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