0

Does Azure Docker-Compose V0 Task support building individual service instead of building all the services?

Below is the yaml dump of docker compose task. I want to build the individual service from the environment variable. But this always builds all the images.

steps:
- task: DockerCompose@0
  displayName: 'Run a Docker Compose command'
  inputs:
    containerregistrytype: 'Container Registry'
    dockerComposeFile: 'pathto/docker-compose.yml'
    dockerComposeCommand: build
    arguments: '$(ProjectName)'

Build output with debug flag=true

[debug]arguments:
[debug]   -f
[debug]   /pathToCompose/docker-compose.yml
[debug]   -f
[debug]   /myagent/.docker-compose.1583974576607.yml
[debug]   -p
[debug]   repository
[debug]   build
/usr/sbin/docker-compose -f /pathToCompose/docker-compose.yml -f /myagent/.docker-compose.1583974576607.yml -p repository build

1 Answer 1

1

Does Azure Docker-Compose V0 Task support building individual service instead of building all the services?

Yes, it does.

Just specify the service name you want to build in argument of task, which is what you were trying.

You need set system.debug to true in variables tab, then confirm your detailed log to confirm whether $(ProjectName) value was passed successfully. Because in debug log, we print the complete command:

enter image description here

newsfeed is one of my service name.


Update on 3/13/2020:

The Arguments blank of task definition is work for Build service images action, which means you can input your actual arguments there only after the Build service images action selected:

enter image description here

The Arguments blank does not work along with Run a Docker Compose command action.

When you choose that action, the method of argument applied should look like this:

enter image description here

Only this, the argument can be available for task.

enter image description here

Sign up to request clarification or add additional context in comments.

6 Comments

From the log I dont see the service being passed as argument in my case. Even if I hard code the service name its not passed to docker-compose per log. (attached compose log with path updated)
Also one thing I see different between my log and above is I got -p repository build instead of -p Docker build not sure why this is different. I am using the Devops web interface for configuration not sure if thats causing any difference.
@user3279954. It's okay, Docker just my repository name:-) . From the log part you shared, it represent our system does not detect out your argument value(seems). For sure, did you check another line? I point here: imgur.com/a/hczt8ne What's the value of yours?
Ah okie I see. argument doesnt seem to be passed on to docker-compose, cross checked with the logs tried --parallel, Individual service name hardcoded or from environment variable. Is there any way to identify why arguments are not passed on ? imgur.com/a/4QS4bAE (config while --parallel arg)
@user3279954, that Arguments blank is work for Build service images action, not for Run a Docker Compose command action. If you want to apply arguments with Run a Docker Compose command action, you should configure it like this: imgur.com/a/BkmKVFr. Updated more details into answer.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.