AWS Copilot CLI

I need to install some dependencies that will be used across many projects. One of those dependencies is the AWS Copilot CLI. The goal is to have this installed and available just like the AWS CLI is.

How can I achieve this?

Thanks!

Hi Andre,

Thanks for getting in touch!

There are two ways to do this.

The first would be to make use of execution containers to run an image that includes the AWS copilot CLI and configure any steps that need this to run within that container.

The second option should be to create a new worker pool and static worker where you can install this CLI and then configure the relevant steps to use this worker pool instead of the dynamic workers.

Regards,
Paul

1 Like

Thanks @paul.calvert! I knew there would be a much better way to do what I wanted. Will give this a try!

Cheers

1 Like

I’ve got it working, thanks again! Now I seem to be making another beginner’s mistake as I’m not able to understand how Octopus extracts the content of my zip file. Here’s what I’ve got so far:

  1. I use Octopus Cloud
  2. My deployment target is an AWS account so everything happens on the Octopus Deploy Server (i.e. no tentacles)
  3. I use the “Deploy Package” step to extract my package contents
  4. I use a custom AWS CLI script which runs AWS copilot

Step number 3 doesn’t seem to extract the files automatically so I’m trying to unzip it. It seems that my package (zip file) is extracted to /home/Octopus/Files/.

Ideally, I just wanted a simple step that extracts the contents of my zip file in a known directory so I can just cd into it and execute step 4 above.

Any help would be appreciated!

When Deploy a Package runs it should download the package to the target, extract the contents of the package and then perform any necessary variable substitutions, transforms etc. Full details on this can be found here.

So, you should be able to locate a folder in /home/Octopus/Applications/ that contains the extracted files.

Because the extracted folder path will change based on the package version, environment etc when needing to make use of this location in later script steps a good option is to use the system variable Octopus.Action[_name_].Output.Package.InstallationDirectoryPath detailed here. This should give you the exact location without any additional effort.

This is exactly what I was after and did come across that before, however, when I run the below inline bash script, I get an error “no other directory” as the Octopus.Action[_name_].Output.Package.InstallationDirectoryPath seems to be empty.

install=$(get_octopusvariable "Octopus.Action[Extract Package].Output.Package.InstallationDirectoryPath")

echo "Files location: $install"

pushd $install

I think it is worth mentioning again that my deployment target is a Cloud Region so I 'm not sure if the mechanics of deploying a package remain the same.

It may be that the Cloud region deployment is altering the possible variables.

If you add a OctopusPrintEvaluatedVariables as a project variable with a value of True and run a new release\deployment it will output all available system variables.
Hopefully, it will list the variable you need for the package path.

1 Like

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