AWS CodePipeline to trigger Octopus Deploy release

I’m wondering if it’s possible to use an AWS CodeBuild step to trigger an OctopusDeploy release by connecting to my on-prem API from within the yaml build step.

So if I create an Ubuntu build agent, I would assume the yaml build would need to install octo.exe and then I can pass variables into a call to the API?

Hi Andrew,

Thanks for getting in touch!

That sounds workable. As long as you can execute the Octo CLI you should be able to create or deploy a release.
It may be easier to use the create-release command with the --deployTo=VALUE argument rather than the deploy-release command as the latter requires a specific release version to be passed in.

Full details on each command and available arguments are available here:

Regards,
Paul

Thanks! I’ve found what looks like the install command I need to run in my yaml file and it looks like it’s doing something with an api key in there. I’ve already got an api key ready to go so would I need to change anything from this install statement?

sudo apt update && sudo apt install --no-install-recommends gnupg curl ca-certificates apt-transport-https &&
curl -sSfL https://apt.octopus.com/public.key | sudo apt-key add - &&
sudo sh -c “echo deb https://apt.octopus.com/ stable main > /etc/apt/sources.list.d/octopus.com.list” &&
sudo apt update && sudo apt install octopuscli=7.4.3124

You shouldn’t need to change anything in that section. Looks like it is the standard download and install.

Your API key would be needed as an argument when running the relevant command within octo.exe.

Great. I’ve got the command ready so will see how I get on. Thanks!

1 Like

I’m getting a failure and not really sure why. Here’s the actions part of the yaml script and I’ve attached the log. CodeBuild didn’t like the sudo so I removed it and also used apt-get.
It gets as far as install octopuscli=7.4.3124 but fails. It looks like the last thing it’s doing is waiting for user input but then it clears a similar request further up the chain so not sure if that’s actually the problem.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
apt-get update && apt-get install --no-install-recommends gnupg curl ca-certificates apt-transport-https &&
curl -sSfL https://apt.octopus.com/public.key | apt-key add - &&
sh -c “echo deb https://apt.octopus.com/ stable main > /etc/apt/sources.list.d/octopus.com.list” &&
apt-get update && apt-get install octopuscli=7.4.3124
mv octopuscli /usr/local/bin/
chmod +x /usr/local/bin/octopuscli

od_fail.txt (9.1 KB)

I just needed a -y and it’s working now.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.