Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting multiple compose files with context menu "Compose Up" should execute them in a single command #1749

Closed
slavdok opened this issue Mar 12, 2020 · 4 comments
Assignees

Comments

@slavdok
Copy link

slavdok commented Mar 12, 2020

Maybe related to #569, but different.

It's now fixed that doing Command Palette > Docker: Compose Up will detect if there is an docker-compose.override.yml file, and will include that by running docker-compose up without specifying a file.

However when I select docker-compose.yml from Explorer View > Right click > Compose up, it still runs docker-compose -f "$file" up. This is probably by design.

But what if I have docker-compose.yml, docker-compose.override.yml and docker-qa.yml files. I would like to select 2 in the Explorer view (it supports that now), the default and the qa one, then Right click > Compose up, and would like to see docker-compose -f "docker-compose.yml" -f "docker-qa.yml" up command executed.

Instead right now it launches each individually.
If this infringes on anyone's workflow, maybe make it a configurable option, like -d and --build

@bwateratmsft
Copy link
Collaborator

@slavdok I had thought of this also when working on the compose command customization, so you certainly aren't alone, but I didn't want to change the behavior present.

One challenge is knowing the order to put them in--I don't think VSCode gives us any hint as to what order they were selected in, and alphabetical wouldn't always be right.

@slavdok
Copy link
Author

slavdok commented Mar 12, 2020

One challenge is knowing the order to put them in

Solution one: just like #569 fix, is to assume correct filenames, so docker-compose.yml first, the rest second (in alphabetical order). If docker-compose.yml is not present, revert to current behaviour.

Solution two: use the same functionality as selecting files for compare, where you mark one file first, then individually mark the second file for compare (I am sure at that point, VSCode knows which was first)

Thanks for looking into this

@bwateratmsft
Copy link
Collaborator

In the meantime, if you're hitting this issue pretty consistently for a single project or if you have a consistent pattern of files, you could customize the Compose command using this new mechanism for 1.0.0: https://code.visualstudio.com/docs/containers/reference#_command-customization

For example, you could create two compose-up commands:

    "docker.commands.composeUp": [
        {
            "label": "Compose up with QA",
            "template": "docker-compose ${configurationFile} -f docker-qa.yml up ${detached} ${build}"
        },
        {
            "label": "Compose up without QA",
            "template": "docker-compose ${configurationFile} up ${detached} ${build}"
        }
    ]

When you right-click the main docker-compose.yml file in this instance and do compose up, it will prompt you to choose between the above two templates, remembering your previous choice. You could make this a workspace setting if this is applicable to a particular project only.

@bwateratmsft bwateratmsft added this to the 1.2.0 milestone Mar 13, 2020
@dbreshears dbreshears modified the milestones: 1.2.0, 1.1.0 Mar 20, 2020
@dbreshears dbreshears modified the milestones: 1.2.0, 1.3.0 Apr 14, 2020
@dbreshears dbreshears added the P1 label May 12, 2020
@ravipal
Copy link
Contributor

ravipal commented May 18, 2020

@ravipal ravipal closed this as completed May 18, 2020
@bwateratmsft bwateratmsft removed this from the 1.3.0 milestone May 21, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants