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

chore(deps): bump github.com/docker/compose/v2 from 2.23.3 to 2.24.0 in /modules/compose #2096

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0a891a3
chore(deps): bump github.com/docker/compose/v2 in /modules/compose
dependabot[bot] Jan 12, 2024
62d7e65
chore: bump buildx to rc-2
mdelapenya Jan 12, 2024
7111e7f
chore: use compose-go v2
mdelapenya Jan 14, 2024
d605b39
fix: resolve breaking changes using the right type
mdelapenya Jan 14, 2024
fbadf8f
fix: use non-deprecated list options
mdelapenya Jan 14, 2024
a2c3f98
chore: proper deprecation commands for LocalDockerCompose
mdelapenya Jan 14, 2024
242ff5a
chore: use require for Up errors
mdelapenya Jan 15, 2024
196efc3
chore: fix validation for modern compose version
mdelapenya Jan 17, 2024
7bc7b95
Merge branch 'main' into dependabot/go_modules/modules/compose/github…
mdelapenya Jan 17, 2024
497ce80
chore: remove unused variable
mdelapenya Jan 17, 2024
9502533
chore: remove named return
mdelapenya Jan 17, 2024
cd578ed
chore: simplify
mdelapenya Jan 17, 2024
5ad25a0
chore: use non-deprecated options
mdelapenya Jan 17, 2024
49391ae
chore: resolve golangci lints
mdelapenya Jan 17, 2024
07844f2
fix: assert.Len
mdelapenya Jan 17, 2024
c70a6c9
fix: wrong replace
mdelapenya Jan 17, 2024
d9ec85e
Merge branch 'main' into dependabot/go_modules/modules/compose/github…
mdelapenya Jan 20, 2024
b7ec95d
chore: bump compose dependencies
mdelapenya Jan 20, 2024
f32b0fe
fix: honour compose unicity
mdelapenya Jan 20, 2024
6e3e152
fix: lint applied reversely
mdelapenya Jan 20, 2024
843e114
fix: length
mdelapenya Jan 20, 2024
3b5efbc
fix: wrong copy&paste
mdelapenya Jan 20, 2024
3ef8a49
Merge branch 'main' into dependabot/go_modules/modules/compose/github…
mdelapenya Jan 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:

- name: golangci-lint
# TODO: Remove each example/module once it passes the golangci-lint
if: ${{ inputs.platform == 'ubuntu-latest' && inputs.go-version == '1.20.x' && !contains(fromJSON('["modules/compose"]'), inputs.project-directory) }}
if: ${{ inputs.platform == 'ubuntu-latest' && inputs.go-version == '1.20.x' }}
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
Expand Down
16 changes: 6 additions & 10 deletions modules/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"path/filepath"
"runtime"
"strings"
"sync"

"github.com/compose-spec/compose-go/types"
"github.com/compose-spec/compose-go/v2/types"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/flags"
"github.com/docker/compose/v2/pkg/api"
Expand All @@ -24,10 +23,7 @@ const (
envComposeFile = "COMPOSE_FILE"
)

var (
composeLogOnce sync.Once
ErrNoStackConfigured = errors.New("no stack files configured")
)
var ErrNoStackConfigured = errors.New("no stack files configured")

type composeStackOptions struct {
Identifier string
Expand Down Expand Up @@ -77,9 +73,9 @@ type ComposeStack interface {
ServiceContainer(ctx context.Context, svcName string) (*testcontainers.DockerContainer, error)
}

// DockerCompose defines the contract for running Docker Compose
// Deprecated: DockerCompose is the old shell escape based API
// use ComposeStack instead
// DockerCompose defines the contract for running Docker Compose
type DockerCompose interface {
Down() ExecError
Invoke() ExecError
Expand Down Expand Up @@ -138,16 +134,16 @@ func NewDockerComposeWith(opts ...ComposeStackOption) (*dockerCompose, error) {
return composeAPI, nil
}

// Deprecated: NewLocalDockerCompose returns a DockerCompose compatible instance which is superseded
// by ComposeStack use NewDockerCompose instead to get a ComposeStack compatible instance
//
// NewLocalDockerCompose returns an instance of the local Docker Compose, using an
// array of Docker Compose file paths and an identifier for the Compose execution.
//
// It will iterate through the array adding '-f compose-file-path' flags to the local
// Docker Compose execution. The identifier represents the name of the execution,
// which will define the name of the underlying Docker network and the name of the
// running Compose services.
//
// Deprecated: NewLocalDockerCompose returns a DockerCompose compatible instance which is superseded
// by ComposeStack use NewDockerCompose instead to get a ComposeStack compatible instance
func NewLocalDockerCompose(filePaths []string, identifier string, opts ...LocalDockerComposeOption) *LocalDockerCompose {
dc := &LocalDockerCompose{
LocalDockerComposeOptions: &LocalDockerComposeOptions{
Expand Down
20 changes: 11 additions & 9 deletions modules/compose/compose_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"strings"
"sync"

"github.com/compose-spec/compose-go/cli"
"github.com/compose-spec/compose-go/types"
"github.com/compose-spec/compose-go/v2/cli"
"github.com/compose-spec/compose-go/v2/types"
"github.com/docker/cli/cli/command"
"github.com/docker/compose/v2/pkg/api"
types2 "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -180,10 +180,12 @@ func (d *dockerCompose) Down(ctx context.Context, opts ...StackDownOption) error
return d.composeService.Down(ctx, d.name, options.DownOptions)
}

func (d *dockerCompose) Up(ctx context.Context, opts ...StackUpOption) (err error) {
func (d *dockerCompose) Up(ctx context.Context, opts ...StackUpOption) error {
d.lock.Lock()
defer d.lock.Unlock()

var err error

d.project, err = d.compileProject()
if err != nil {
return err
Expand All @@ -203,11 +205,11 @@ func (d *dockerCompose) Up(ctx context.Context, opts ...StackUpOption) (err erro
if len(upOptions.Services) != len(d.project.Services) {
sort.Strings(upOptions.Services)

filteredServices := make(types.Services, 0, len(d.project.Services))
filteredServices := types.Services{}

for i := range d.project.Services {
if idx := sort.SearchStrings(upOptions.Services, d.project.Services[i].Name); idx < len(upOptions.Services) && upOptions.Services[idx] == d.project.Services[i].Name {
filteredServices = append(filteredServices, d.project.Services[i])
for _, srv := range upOptions.Services {
if srvConfig, ok := d.project.Services[srv]; ok {
filteredServices[srv] = srvConfig
}
}

Expand Down Expand Up @@ -288,7 +290,7 @@ func (d *dockerCompose) lookupContainer(ctx context.Context, svcName string) (*t
return container, nil
}

listOptions := types2.ContainerListOptions{
listOptions := container.ListOptions{
All: true,
Filters: filters.NewArgs(
filters.Arg("label", fmt.Sprintf("%s=%s", api.ProjectLabel, d.name)),
Expand Down
Loading
Loading