Difficulty retrieving ECR package version from script or K8s template

I am using Octopus Deploy to deploy container images to EKS from an ECR repo using the built-in “Deploy Kubernetes containers” step. This works fine. Let’s call this Step A.

My ECR image name is along the lines of environment/app/service (sic), with the slashes in it.

I would like to deploy another Kubernetes resource (a Job) using the “Deploy raw Kubernetes YAML” step.

In this step I would like to refer to the version of the package from Step A that is being deployed as part of this release.

From the Octopus doco I believe I should be able to refer to the package version in a deployment step using the package name as an index, eg
Octopus.Action.Package[environment/app/service].PackageVersion

But this does not seem to resolve to anything.

Please advise how I can retrieve the package version of an ECR image being deployed to EKS.

Thanks,

Conor

Hi Conor,

Thanks for getting in touch!

I have a feeling that the package system variable you are using only applies to Deploy a Package type steps and may not be used on container steps.

The best option here would be to add a project variable named OctopusPrintEvaluatedVariables with a value of true and then create a new release and deployment.
This variable will output all evaluated variables and their values to the deployment task log; you can then take a look through that to see if there is one that stores the relevant container version.

Regards,
Paul

Thanks Paul, yep, that’s a great suggestion, that helped me move forward.

2 Likes

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