tag:help.appveyor.com,2012-11-13:/discussions/questions/20054-installing-gnupg-for-testsAppVeyor: Discussion 2018-08-25T02:28:38Ztag:help.appveyor.com,2012-11-13:Comment/452061272018-05-01T21:19:15Z2018-05-01T21:19:16Zinstalling GnuPG for tests<div><p>Hi,</p>
<p>I don't know much about Windows and instrumenting AppVeyor, but I am using it for running tests on my open source project (<a href="https://github.com/sit-it/sit">https://github.com/sit-it/sit</a>) 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.</p>
<p>Any advice will be highly appreciated!</p></div>Yurii Rashkovskiitag:help.appveyor.com,2012-11-13:Comment/452061272018-05-01T22:17:34Z2018-05-01T22:17:34Zinstalling GnuPG for tests<div><p>Appveyor build machines come with <a href="https://www.appveyor.com/docs/build-configuration/#chocolatey">Chocolatey pre installed</a> so a good first stop would be to go <a href="https://chocolatey.org/packages?q=GnuPG">here</a> 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.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/452061272018-05-02T14:59:01Z2018-05-02T14:59:02Zinstalling GnuPG for tests<div><p>Owen,</p>
<p>Thank you so much for this advice. I tried to follow it, but the build hangs and times out here:</p>
<p>Installing gnupg-modern...<br>
Chocolatey timed out waiting for the command to finish. The timeout<br>
specified (or the default value) was '2700' seconds. Perhaps try a higher <code>--execution-timeout</code>? See <code>choco -h</code> for details.</p>
<p>Any thoughts?</p></div>Yurii Rashkovskiitag:help.appveyor.com,2012-11-13:Comment/452061272018-05-02T15:38:01Z2018-05-02T15:38:01Zinstalling GnuPG for tests<div><p>Can you try<br></p>
<pre>
<code>- cmd: appveyor-retry choco install gnupg-modern</code>
</pre>
and let me know if that helps.</div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/452061272018-05-02T20:30:26Z2018-05-02T20:30:28Zinstalling GnuPG for tests<div><p>Owen,</p>
<p>The problem with the timeout (45 minutes) trying to install gnupg-modern persists <a href="https://ci.appveyor.com/project/yrashk/sit/build/job/ehkjpn4nebcus0ai">https://ci.appveyor.com/project/yrashk/sit/build/job/ehkjpn4nebcus0ai</a></p>
<p>I am wondering if there's anything we can do to figure out the reason.</p></div>Yurii Rashkovskiitag:help.appveyor.com,2012-11-13:Comment/452061272018-05-03T19:12:16Z2018-05-03T19:12:16Zinstalling GnuPG for tests<div><p>I realized that the problem is that the installer tries to add to the machine <code>path</code> environment variable which makes a system dialog pop up notifying that the <code>path</code> variable is too large.<br>
Workaround is to modify that variable,<br></p>
<pre>
<code>- ps: |
$path = [Environment]::GetEnvironmentVariable("path", "machine")
$newPath = ($path.Split(';') | Where-Object { $_ -eq 'C:\ProgramData\chocolatey\bin' }) -join ';'
[Environment]::SetEnvironmentVariable("path", $newPath, "machine")</code>
</pre>
Do this before you run the <code>choco install gpg4win</code> command.<br>
However, i'm not sure if the removal of all those values in the <code>path</code> will affect your build. You may have to add what you need to the process path with a simple <code>SET PATH=%PATH%;<whatever-you-need></code></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/452061272018-05-03T19:17:57Z2018-05-03T19:17:57Zinstalling GnuPG for tests<div><p>Owen,</p>
<p>Thank you so much for your help trying to figure this out. I can see it wasn't easy to figure this out.</p>
<p>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?</p>
<p>Thank you.</p></div>Yurii Rashkovskiitag:help.appveyor.com,2012-11-13:Comment/452061272018-05-03T20:52:40Z2018-05-03T20:52:40Zinstalling GnuPG for tests<div><p>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 <code>SET PATH=%PATH%;<whatever-you-need></code> you are setting the process <code>path</code> variable not the variable for the machine.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/452061272018-05-03T23:01:14Z2018-05-03T23:35:07Zinstalling GnuPG for tests<div><p>I have to add you need to use <code>$env:path</code>, not just <code>$path</code> in PowerShell.</p>
<p><strong>UPDATE:</strong> disregard this, I misread the script</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/452061272018-05-04T19:45:27Z2018-05-04T19:45:28Zinstalling GnuPG for tests<div><p>Owen,</p>
<p>Thank you so much for your help. I finally managed to make the build to work: <a href="https://ci.appveyor.com/project/yrashk/sit/build/job/hmlyij2xd9jsxxef">https://ci.appveyor.com/project/yrashk/sit/build/job/hmlyij2xd9jsxxef</a> with this config <a href="https://github.com/sit-it/sit/blob/master/appveyor.yml">https://github.com/sit-it/sit/blob/master/appveyor.yml</a></p></div>Yurii Rashkovskiitag:help.appveyor.com,2012-11-13:Comment/452061272018-05-04T19:55:38Z2018-05-04T19:55:38Zinstalling GnuPG for tests<div><p>Great, thanks for the update!</p></div>Owen McDonnell