Getting full container name from package reference

Hi There,

Hoping for some help with package references. I have an Azure web app that takes a configuration setting as a full docker container name. Something along the lines of {containerRegistryHostname}/{Repo}/{ImageName}:{VersionTag}

I’ve created my own step template starting from this : https://library.octopus.com/step-templates/850667b2-567d-46ba-a87d-d85dc31ebc83/actiontemplate-azure-web-app-set-app-settings

That includes a package reference, the variable for the package reference is : azureWebAppSettings.Package

I’ve setup Octopus with a connection to the container registry in the library.

I’ve added the step to my project and when I create a release Octopus can see the correct version of my container from the registry.

However I’m struggling getting the full registry hostname AND more importantly the package version as a variable from the PackageReference variable so that I can set it in my Azure webapp.

My azureWebAppSettings.settings parameter is set to this:

BatchContainerRegistryImageName=#{azureWebAppSettings.Package.FeedId}/#{azureWebAppSettings.Package.PackageId}:#{azureWebAppSettings.Package.PackageVersion}

But the output log is returning this once variable substitution has been performed:

BatchContainerRegistryImageName=Feeds-1186/rmtech/warp/warp-batch:

So my questions come down to this:

  • How do I get the full feed URL/Hostname of the feed from a package reference?
  • How do I get the selected package version from a package reference?

Thanks

Simon

Hi Simon,

I’ve copied here some output from some variables. Have a look at these as I think they’ll give you what you need. Customize for your scenario, obviously.

[Octopus.Action.Package[hello-world].Image] = 'index.docker.io/hello-world:latest'
[Octopus.Action.Package[hello-world].PackageId] = 'hello-world'
[Octopus.Action.Package[hello-world].PackageVersion] = 'latest'
[Octopus.Action.Package[hello-world].Registry] = 'index.docker.io'

Hope this helps! Please let us know if you have further questions.

Thanks,
Mark