Teamcity get all docker images tags and set as parameter
Hello TeamCity community,
I'm trying to integrate TeamCity with a Docker registry via their respective APIs.
The goal is:
- Regularly fetch all available Docker image tags from a given repository
- Dynamically populate a `select`-type parameter in TeamCity
- So that when triggering a build, users can choose a tag from a dropdown list of valid image tags
Currently, I’m using a script to call the Docker Registry HTTP API (v2) and the TeamCity REST API to update the parameter.
It works in general, but there are some caveats:
- TeamCity doesn’t always preserve the `select` parameter type when updating via REST
- The REST API seems to ignore the `type=select` unless it’s defined manually in the UI first
Do you know a better or more stable way to implement this?
Maybe a recommended pattern using Snapshot Dependencies or Artifact Dependencies, or some DSL trick?
I’d love to hear if there’s a best practice for this scenario.
Thanks in advance!
Please sign in to leave a comment.
Hi! Updating existing select parameter values or creating a new select parameter with a set of values via the REST API is a viable solution. The same can also be achieved using Kotlin DSL, but the REST API should be equally reliable.
If you can consistently reproduce the issue where TeamCity does not preserve the
select
parameter type when updating via REST API, please share the steps to reproduce it.For now, the issue of ignoring
type=select
could be due to a payload problem or incorrect request parameters. I tested it using curl (see the listing below), and it worked as expected.payload.json: