Skip to content

Commit e623b5c

Browse files
Merge branch 'v2' into 8768-avoid-pulling-same-image-multiple-times
2 parents 960453f + 359133b commit e623b5c

File tree

127 files changed

+2994
-2378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2994
-2378
lines changed

.github/workflows/artifacts.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 33 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,48 @@ on:
1111
description: 'To run with tmate enter "debug_enabled"'
1212
required: false
1313
default: "false"
14-
14+
env:
15+
GO_VERSION: 1.18.5
16+
DOCKER_CLI_VERSION: 20.10.17
1517
jobs:
1618
lint:
1719
name: Lint
1820
runs-on: ubuntu-latest
19-
env:
20-
GO111MODULE: "on"
2121
steps:
22-
- name: Set up Go 1.18
23-
uses: actions/setup-go@v2
24-
with:
25-
go-version: 1.18.3
26-
id: go
27-
2822
- name: Checkout code into the Go module directory
29-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3
24+
25+
- name: Set up Go ${{ env.GO_VERSION }}
26+
uses: actions/setup-go@v3
27+
with:
28+
go-version: ${{ env.GO_VERSION }}
29+
cache: true
3030

3131
- name: Validate go-mod, license headers and docs are up-to-date
3232
run: make validate
3333

3434
- name: Run golangci-lint
3535
env:
3636
BUILD_TAGS: e2e
37-
uses: golangci/golangci-lint-action@v2
37+
uses: golangci/golangci-lint-action@v3
3838
with:
39+
version: v1.47.3
3940
args: --timeout=180s
4041

4142
# only on main branch, costs too much for the gain on every PR
4243
validate-cross-build:
4344
name: Validate cross build
4445
runs-on: ubuntu-latest
4546
if: github.ref == 'refs/heads/main'
46-
env:
47-
GO111MODULE: "on"
4847
steps:
49-
- name: Set up Go 1.18
50-
uses: actions/setup-go@v2
51-
with:
52-
go-version: 1.18.3
53-
id: go
54-
5548
- name: Checkout code into the Go module directory
56-
uses: actions/checkout@v2
49+
uses: actions/checkout@v3
5750

58-
- uses: actions/cache@v2
51+
- name: Set up Go ${{ env.GO_VERSION }}
52+
uses: actions/setup-go@v3
5953
with:
60-
path: ~/go/pkg/mod
61-
key: go-${{ hashFiles('**/go.sum') }}
54+
go-version: ${{ env.GO_VERSION }}
55+
cache: true
6256

6357
# Ensure we don't discover cross platform build issues at release time.
6458
# Time used to build linux here is gained back in the build for local E2E step
@@ -68,28 +62,21 @@ jobs:
6862
build-plugin:
6963
name: Build and tests in plugin mode
7064
runs-on: ubuntu-latest
71-
env:
72-
GO111MODULE: "on"
7365
steps:
74-
- name: Set up Go 1.18
75-
uses: actions/setup-go@v2
66+
- name: Checkout code into the Go module directory
67+
uses: actions/checkout@v3
68+
69+
- name: Set up Go ${{ env.GO_VERSION }}
70+
uses: actions/setup-go@v3
7671
with:
77-
go-version: 1.18.3
78-
id: go
72+
go-version: ${{ env.GO_VERSION }}
73+
cache: true
7974

8075
- name: Setup docker CLI
8176
run: |
82-
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
77+
curl https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_CLI_VERSION}.tgz | tar xz
8378
sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
8479
85-
- name: Checkout code into the Go module directory
86-
uses: actions/checkout@v2
87-
88-
- uses: actions/cache@v2
89-
with:
90-
path: ~/go/pkg/mod
91-
key: go-${{ hashFiles('**/go.sum') }}
92-
9380
- name: Test
9481
run: make -f builder.Makefile test
9582

@@ -104,28 +91,21 @@ jobs:
10491
build-standalone:
10592
name: Build and tests in standalone mode
10693
runs-on: ubuntu-latest
107-
env:
108-
GO111MODULE: "on"
10994
steps:
110-
- name: Set up Go 1.18
111-
uses: actions/setup-go@v2
95+
- name: Checkout code into the Go module directory
96+
uses: actions/checkout@v3
97+
98+
- name: Set up Go ${{ env.GO_VERSION }}
99+
uses: actions/setup-go@v3
112100
with:
113-
go-version: 1.18.3
114-
id: go
101+
go-version: ${{ env.GO_VERSION }}
102+
cache: true
115103

116104
- name: Setup docker CLI
117105
run: |
118-
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
106+
curl https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_CLI_VERSION}.tgz | tar xz
119107
sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
120108
121-
- name: Checkout code into the Go module directory
122-
uses: actions/checkout@v2
123-
124-
- uses: actions/cache@v2
125-
with:
126-
path: ~/go/pkg/mod
127-
key: go-${{ hashFiles('**/go.sum') }}
128-
129109
- name: Build for local E2E
130110
env:
131111
BUILD_TAGS: e2e

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ jobs:
4040
uses: peter-evans/create-pull-request@923ad837f191474af6b1721408744feb989a4c27 # v4.0.4
4141
with:
4242
token: ${{ secrets.GHPAT_DOCS_DISPATCH }}
43+
push-to-fork: docker-tools-robot/docker.github.io
4344
commit-message: Update Compose reference API to ${{ github.event.release.name }}
4445
signoff: true
4546
branch: dispatch/compose-api-reference-${{ github.event.release.name }}
4647
delete-branch: true
4748
title: Update Compose reference API to ${{ github.event.release.name }}
4849
body: |
4950
Update the Compose reference API documentation to keep in sync with the latest release `${{ github.event.release.name }}`
50-
labels: area/Compose
5151
draft: false

.github/workflows/pr-closed.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/rebase.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout the latest code
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
1313
with:
1414
token: ${{ secrets.GITHUB_TOKEN }}
1515
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo

.github/workflows/release.yaml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,26 @@ on:
66
tag:
77
description: "Release Tag"
88
required: true
9-
9+
env:
10+
GO_VERSION: 1.18.5
1011
jobs:
1112
upload-release:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- name: Set up Go 1.18
15-
uses: actions/setup-go@v2
15+
- name: Checkout code into the Go module directory
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Go ${{ env.GO_VERSION }}
19+
uses: actions/setup-go@v3
1620
with:
17-
go-version: 1.18.3
18-
id: go
21+
go-version: ${{ env.GO_VERSION }}
22+
cache: true
1923

2024
- name: Setup docker CLI
2125
run: |
22-
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
26+
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.17.tgz | tar xz
2327
sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
2428
25-
- name: Checkout code into the Go module directory
26-
uses: actions/checkout@v2
27-
28-
- uses: actions/cache@v2
29-
with:
30-
path: ~/go/pkg/mod
31-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
32-
restore-keys: |
33-
${{ runner.os }}-go-
34-
3529
- name: Build
3630
run: make GIT_TAG=${{ github.event.inputs.tag }} -f builder.Makefile cross
3731

.golangci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ linters:
77
- deadcode
88
- depguard
99
- errcheck
10+
- gocritic
1011
- gocyclo
1112
- gofmt
1213
- goimports
@@ -32,6 +33,17 @@ linters-settings:
3233
# The io/ioutil package has been deprecated.
3334
# https://go.dev/doc/go1.16#ioutil
3435
- io/ioutil
36+
gocritic:
37+
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
38+
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
39+
enabled-tags:
40+
- diagnostic
41+
- opinionated
42+
- style
43+
disabled-checks:
44+
- paramTypeCombine
45+
- unnamedResult
46+
- whyNoLint
3547
gocyclo:
3648
min-complexity: 16
3749
lll:

BUILDING.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,51 @@ make test
3434

3535
If you need to update a golden file simply do `go test ./... -test.update-golden`.
3636

37-
### End to end tests
37+
### End-to-end tests
38+
To run e2e tests, the Compose CLI binary need to be build. All the commands to run e2e tests propose a version
39+
with the prefix `build-and-e2e` to first build the CLI before executing tests.
3840

39-
To run the end to end tests, run:
41+
42+
Note that this requires a local Docker Engine to be running.
43+
44+
#### Whole end-to-end tests suite
45+
46+
To execute both CLI and standalone e2e tests, run :
47+
48+
```console
49+
make e2e
50+
```
51+
52+
Or if you need to build the CLI, run:
53+
```console
54+
make build-and-e2e
55+
```
56+
57+
#### Plugin end-to-end tests suite
58+
59+
To execute CLI plugin e2e tests, run :
4060

4161
```console
4262
make e2e-compose
4363
```
4464

45-
Note that this requires a local Docker Engine to be running.
65+
Or if you need to build the CLI, run:
66+
```console
67+
make build-and-e2e-compose
68+
```
69+
70+
#### Standalone end-to-end tests suite
71+
72+
To execute the standalone CLI e2e tests, run :
73+
74+
```console
75+
make e2e-compose-standalone
76+
```
77+
78+
Or if you need to build the CLI, run:
79+
```console
80+
make build-and-e2e-compose-standalone
81+
```
4682

4783
## Releases
4884

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ Fork the repository and make changes on your fork in a feature branch:
124124
issue.
125125

126126
Submit unit tests for your changes. Go has a great test framework built in; use
127-
it! Take a look at existing tests for inspiration. [Run the full test
128-
suite](README.md) on your branch before
129-
submitting a pull request.
127+
it! Take a look at existing tests for inspiration. Also end-to-end tests are
128+
available. Run the full test suite, both unit tests and e2e tests on your
129+
branch before submitting a pull request. See [BUILDING.md](BUILDING.md) for
130+
instructions to build and run tests.
130131

131132
Write clean code. Universally formatted code promotes ease of writing, reading,
132133
and maintenance. Always run `gofmt -s -w file.go` on each changed file before

0 commit comments

Comments
 (0)