Help setting up NuGet/Chocolatey deployment

adbertram's Avatar

adbertram

30 Jul, 2021 09:45 PM

I have a project where I create a Chocolatey package from a build. I want to automatically install this NuGet package onto a test VM and run some tests after it's installed.

I've:
- configured the build to publish a ZIP and NuGet package artifact
- set up the AppVeyor agent environment
- installed the AppVeyor Deployment Agent on the EC2 VM instance using the environment access key
- added the following to appveyor.yml.

```
deploy:
  - provider: Environment
    name: test
```

I've also tried using deploy_script but couldn't figure out how to get it to run my deploy.ps1 script.

At the end of the day, all I need is to send the generated NuGet package to my AppVeyor agent and run a PowerShell script on the deployment agent and then run some Pester tests afterward.

Can anyone help?

  1. Support Staff 1 Posted by Feodor Fitsner on 30 Jul, 2021 11:14 PM

    Feodor Fitsner's Avatar

    Hi Adam,

    Provided you can trigger a run of arbirtrary PowerShell script on the server side with the help of Deployment Agent a NuGet package can be downloaded from AppVeyor's NuGet feed.

    At minimum your zip should contain deploy.ps1 which will be run on agent side and zip must be configured as windows application. You don't need any files in that zip except deploy.ps1.

    In that deploy.ps1 you can download NuGet package from AppVeyor feed directly (nuget CLI or cURL with Basic auth) and do your tests. You have a bunch of environment variables in the script to relate to the specific build: https://www.appveyor.com/docs/deployment/agent/#running-powershell-...

    Let me know if that sounds like what you need.

  2. 2 Posted by adbertram on 31 Jul, 2021 06:16 PM

    adbertram's Avatar

    This gets me closer. Thank you. What if the artifact name is dynamic? I
    can't add it to the AppVeyor Agent environment.

  3. 3 Posted by adbertram on 31 Jul, 2021 06:22 PM

    adbertram's Avatar

    Also, is there a way to connect to the agent after the PowerShell script
    ran and invoke some Pesters tests on the agent?

  4. Support Staff 4 Posted by Feodor Fitsner on 31 Jul, 2021 06:57 PM

    Feodor Fitsner's Avatar

    It's not artifact name, but artifact "deployment" name which is constant.

    Could you please elaborate on the second question? As I understand you can put all the logic into deploy.ps1 or you need to run something in between?

  5. 5 Posted by adbertram on 31 Jul, 2021 08:54 PM

    adbertram's Avatar

    Thanks! I believe I've got the artifact deployment figured out now.

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