[英]azure pipeline how to trigger build from jenkins server and copy files from with self-hosted linux agent to hosted agent and build on hosted agent
[英]In the azure build pipeline, how to cleanup the docker images (created as part of the pipeline) from self hosted agent once it is pushed?
這個答案可能會遲到,但它就在這里。
我使用這種流程來清理代理中的圖像(以及更多):
- job: DockerCleanBuildAndTest
displayName: Docker Build and Test
workspace:
clean: all
steps:
- task: DockerCompose@0
displayName: Clean
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: ${{ variables['container-registry-name'] }}
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a Docker Compose command'
dockerComposeCommand: down
detached: false
- task: DockerCompose@0
displayName: Run Tests
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: ${{ variables['container-registry-name'] }}
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a Docker Compose command'
dockerComposeCommand: 'run all-tests'
detached: false
也許在你的情況下,它會是這樣的:
- job: DockerCleanBuildAndTest
displayName: Docker Build and Test
workspace:
clean: all
steps:
- task: DockerCompose@0
displayName: Clean
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: ${{ variables['container-registry-name'] }}
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a Docker Compose command'
dockerComposeCommand: rm # <---
detached: false
- task: DockerCompose@0
displayName: Run Tests
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: ${{ variables['container-registry-name'] }}
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a Docker Compose command'
dockerComposeCommand: 'run all-tests'
detached: false
參考: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/docker-compose?view=azure-devops
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.