0

Our organization currently uses TeamCity for CI and I am assessing the feasibility of changing over to Azure DevOps.

So far I've been able to figure out equivalent functionality for most elements, but I'm currently stuck on one particular feature: https://www.jetbrains.com/help/teamcity/docker-support.html#Docker+Images+Clean-up

TeamCity allows me to tell a docker repository to remove an image when the build that pushed it is removed - either by retention policies or manually. I can't figure out how to do the equivalent. I've looked for options on the Docker task as well as tried to find a way to run an activity on pipeline run removal but I can't find anything.

Thoughts?

wtigotw
  • 28
  • 3
  • I afraid there is not equivalent feature in azure devops. You can check out below workaround and submit a feature request. – Levi Lu-MSFT Mar 09 '21 at 10:02

1 Answers1

0

I am afraid there is no out of box feature in azure devops to achieve this. However, you can try creating a scheduled pipeline to check if there is any build being deleted via using rest api, and delete the docker image accordingly. See below:

1, Create a scheduled pipeline to run on a daily or weekly base.

2, Add script tasks to call azure devops rest api (Build List rest api) to get the current builds. See example here to call rest api in devops pipeline. Then compare the current builds with the builds list retrieved in the previous pipeline run(See step 3, the previous builds list can be downloaded if it was published as artifacts).

3, You can save the current builds list in a json file and publish it as the build artifacts via publish build artifact task. So that it can be downloaded and compared against the builds list from the next pipeline run.

You can also submit a feature request to Microsoft development regarding this issue.

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43