Skip to content

Commit 960453f

Browse files
Merge branch 'v2' into 8768-avoid-pulling-same-image-multiple-times
2 parents e24d274 + 83744f7 commit 960453f

File tree

186 files changed

+5433
-1987
lines changed

Some content is hidden

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

186 files changed

+5433
-1987
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
.git/
21
bin/
32
dist/

.github/workflows/artifacts.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/generate-artifacts')
88
runs-on: ubuntu-latest
99
steps:
10-
- name: Set up Go 1.17
10+
- name: Set up Go 1.18
1111
uses: actions/setup-go@v2
1212
with:
13-
go-version: 1.17
13+
go-version: 1.18.3
1414
id: go
1515

1616
- name: Checkout code into the Go module directory
@@ -42,6 +42,12 @@ jobs:
4242
name: docker-compose-linux-amd64
4343
path: ${{ github.workspace }}/bin/docker-compose-linux-amd64
4444

45+
- name: Upload linux-ppc64le binary
46+
uses: actions/upload-artifact@v2
47+
with:
48+
name: docker-compose-linux-ppc64le
49+
path: ${{ github.workspace }}/bin/docker-compose-linux-ppc64le
50+
4551
- name: Upload windows-amd64 binary
4652
uses: actions/upload-artifact@v2
4753
with:

.github/workflows/ci.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
branches:
66
- v2
77
pull_request:
8+
workflow_dispatch:
9+
inputs:
10+
debug_enabled:
11+
description: 'To run with tmate enter "debug_enabled"'
12+
required: false
13+
default: "false"
814

915
jobs:
1016
lint:
@@ -13,16 +19,16 @@ jobs:
1319
env:
1420
GO111MODULE: "on"
1521
steps:
16-
- name: Set up Go 1.17
22+
- name: Set up Go 1.18
1723
uses: actions/setup-go@v2
1824
with:
19-
go-version: 1.17
25+
go-version: 1.18.3
2026
id: go
2127

2228
- name: Checkout code into the Go module directory
2329
uses: actions/checkout@v2
2430

25-
- name: Validate go-mod is up-to-date and license headers
31+
- name: Validate go-mod, license headers and docs are up-to-date
2632
run: make validate
2733

2834
- name: Run golangci-lint
@@ -40,10 +46,10 @@ jobs:
4046
env:
4147
GO111MODULE: "on"
4248
steps:
43-
- name: Set up Go 1.17
49+
- name: Set up Go 1.18
4450
uses: actions/setup-go@v2
4551
with:
46-
go-version: 1.17
52+
go-version: 1.18.3
4753
id: go
4854

4955
- name: Checkout code into the Go module directory
@@ -65,10 +71,10 @@ jobs:
6571
env:
6672
GO111MODULE: "on"
6773
steps:
68-
- name: Set up Go 1.17
74+
- name: Set up Go 1.18
6975
uses: actions/setup-go@v2
7076
with:
71-
go-version: 1.17
77+
go-version: 1.18.3
7278
id: go
7379

7480
- name: Setup docker CLI
@@ -90,7 +96,7 @@ jobs:
9096
- name: Build for local E2E
9197
env:
9298
BUILD_TAGS: e2e
93-
run: make -f builder.Makefile compose-plugin
99+
run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
94100

95101
- name: E2E Test in plugin mode
96102
run: make e2e-compose
@@ -101,10 +107,10 @@ jobs:
101107
env:
102108
GO111MODULE: "on"
103109
steps:
104-
- name: Set up Go 1.17
110+
- name: Set up Go 1.18
105111
uses: actions/setup-go@v2
106112
with:
107-
go-version: 1.17
113+
go-version: 1.18.3
108114
id: go
109115

110116
- name: Setup docker CLI
@@ -123,7 +129,17 @@ jobs:
123129
- name: Build for local E2E
124130
env:
125131
BUILD_TAGS: e2e
126-
run: make -f builder.Makefile compose-plugin
132+
run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
133+
134+
- name: Setup tmate session
135+
uses: mxschmitt/action-tmate@v3
136+
with:
137+
limit-access-to-actor: true
138+
github-token: ${{ secrets.GITHUB_TOKEN }}
139+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
127140

128141
- name: E2E Test in standalone mode
129-
run: make e2e-compose-standalone
142+
run: |
143+
rm -f /usr/local/bin/docker-compose
144+
cp bin/docker-compose /usr/local/bin
145+
make e2e-compose-standalone

.github/workflows/docs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Docs
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
open-pr:
9+
runs-on: ubuntu-latest
10+
steps:
11+
-
12+
name: Checkout docs repo
13+
uses: actions/checkout@v3
14+
with:
15+
token: ${{ secrets.GHPAT_DOCS_DISPATCH }}
16+
repository: docker/docker.github.io
17+
ref: master
18+
-
19+
name: Prepare
20+
run: |
21+
rm -rf ./_data/compose-cli/*
22+
-
23+
name: Build
24+
uses: docker/build-push-action@v3
25+
with:
26+
context: ${{ github.server_url }}/${{ github.repository }}.git#${{ github.event.release.name }}
27+
target: docs-reference
28+
outputs: ./_data/compose-cli
29+
-
30+
name: Update compose_version in _config.yml
31+
run: |
32+
sed -i "s|^compose_version\:.*|compose_version\: \"${{ github.event.release.name }}\"|g" _config.yml
33+
cat _config.yml | yq .compose_version
34+
-
35+
name: Commit changes
36+
run: |
37+
git add -A .
38+
-
39+
name: Create PR on docs repo
40+
uses: peter-evans/create-pull-request@923ad837f191474af6b1721408744feb989a4c27 # v4.0.4
41+
with:
42+
token: ${{ secrets.GHPAT_DOCS_DISPATCH }}
43+
commit-message: Update Compose reference API to ${{ github.event.release.name }}
44+
signoff: true
45+
branch: dispatch/compose-api-reference-${{ github.event.release.name }}
46+
delete-branch: true
47+
title: Update Compose reference API to ${{ github.event.release.name }}
48+
body: |
49+
Update the Compose reference API documentation to keep in sync with the latest release `${{ github.event.release.name }}`
50+
labels: area/Compose
51+
draft: false

.github/workflows/release.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
upload-release:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Set up Go 1.17
14+
- name: Set up Go 1.18
1515
uses: actions/setup-go@v2
1616
with:
17-
go-version: 1.17
17+
go-version: 1.18.3
1818
id: go
1919

2020
- name: Setup docker CLI
@@ -36,15 +36,16 @@ jobs:
3636
run: make GIT_TAG=${{ github.event.inputs.tag }} -f builder.Makefile cross
3737

3838
- name: Compute checksums
39-
run: cd bin; for f in *; do shasum --algorithm 256 $f > $f.sha256; done
39+
run: cd bin; for f in *; do shasum --binary --algorithm 256 $f | tee -a checksums.txt > $f.sha256; done
4040

4141
- name: License
4242
run: cp packaging/* bin/
4343

4444
- uses: ncipollo/release-action@v1
4545
with:
4646
artifacts: "bin/*"
47-
prerelease: true
47+
generateReleaseNotes: true
48+
draft: true
4849
commit: "v2"
4950
token: ${{ secrets.GITHUB_TOKEN }}
5051
tag: ${{ github.event.inputs.tag }}

.golangci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
run:
2+
concurrency: 2
13
linters:
2-
run:
3-
concurrency: 2
4-
skip-dirs:
5-
- tests/composefiles
64
enable-all: false
75
disable-all: true
86
enable:
97
- deadcode
8+
- depguard
109
- errcheck
1110
- gocyclo
1211
- gofmt
@@ -26,6 +25,13 @@ linters:
2625
- unused
2726
- varcheck
2827
linters-settings:
28+
depguard:
29+
list-type: blacklist
30+
include-go-root: true
31+
packages:
32+
# The io/ioutil package has been deprecated.
33+
# https://go.dev/doc/go1.16#ioutil
34+
- io/ioutil
2935
gocyclo:
3036
min-complexity: 16
3137
lll:

BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* [Docker Desktop](https://hub.docker.com/editions/community/docker-ce-desktop-mac)
99
* make
1010
* Linux:
11-
* [Docker 19.03 or later](https://docs.docker.com/engine/install/)
11+
* [Docker 20.10 or later](https://docs.docker.com/engine/install/)
1212
* make
1313

1414
### Building the CLI

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ don't get discouraged! Our contributor's guide explains
8383
<tr>
8484
<td>Community Slack</td>
8585
<td>
86-
The Docker Community has a dedicated Slack chat to discuss features and issues. You can sign-up <a href="https://dockercommunity.slack.com/ssb/redirect" target="_blank">with this link</a>.
86+
The Docker Community has a dedicated Slack chat to discuss features and issues. You can sign-up <a href="https://www.docker.com/docker-community" target="_blank">with this link</a>.
8787
</td>
8888
</tr>
8989
<tr>

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18-
ARG GO_VERSION=1.17-alpine
18+
ARG GO_VERSION=1.18.3-alpine
1919
ARG GOLANGCI_LINT_VERSION=v1.40.1-alpine
2020
ARG PROTOC_GEN_GO_VERSION=v1.4.3
2121

@@ -88,7 +88,7 @@ RUN --mount=target=. \
8888
make -f builder.Makefile test
8989

9090
FROM base AS check-license-headers
91-
RUN go get -u github.com/kunalkushwaha/ltag
91+
RUN go install github.com/kunalkushwaha/ltag@latest
9292
RUN --mount=target=. \
9393
make -f builder.Makefile check-license-headers
9494

@@ -105,3 +105,9 @@ COPY --from=make-go-mod-tidy /compose-cli/go.sum .
105105
FROM base AS check-go-mod
106106
COPY . .
107107
RUN make -f builder.Makefile check-go-mod
108+
109+
# docs-reference is a target used as remote context to update docs on release
110+
# with latest changes on docker.github.io.
111+
# see open-pr job in .github/workflows/docs.yml for more details
112+
FROM scratch AS docs-reference
113+
COPY docs/reference/*.yaml .

Makefile

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,19 @@ compose-plugin: ## Compile the compose cli-plugin
4343

4444
.PHONY: e2e-compose
4545
e2e-compose: ## Run end to end local tests in plugin mode. Set E2E_TEST=TestName to run a single test
46+
docker compose version
4647
go test $(TEST_FLAGS) -count=1 ./pkg/e2e
4748

4849
.PHONY: e2e-compose-standalone
4950
e2e-compose-standalone: ## Run End to end local tests in standalone mode. Set E2E_TEST=TestName to run a single test
50-
go test $(TEST_FLAGS) -count=1 --tags=standalone ./pkg/e2e
51+
docker-compose version
52+
go test $(TEST_FLAGS) -v -count=1 -parallel=1 --tags=standalone ./pkg/e2e
5153

54+
.PHONY: mocks
55+
mocks:
56+
mockgen -destination pkg/mocks/mock_docker_cli.go -package mocks github.com/docker/cli/cli/command Cli
57+
mockgen -destination pkg/mocks/mock_docker_api.go -package mocks github.com/docker/docker/client APIClient
58+
mockgen -destination pkg/mocks/mock_docker_compose_api.go -package mocks -source=./pkg/api/api.go Service
5259

5360
.PHONY: e2e
5461
e2e: e2e-compose e2e-compose-standalone ## Run end to end local tests in both modes. Set E2E_TEST=TestName to run a single test
@@ -78,6 +85,23 @@ lint: ## run linter(s)
7885
--build-arg GIT_TAG=$(GIT_TAG) \
7986
--target lint
8087

88+
.PHONY: docs
89+
docs: ## generate documentation
90+
$(eval $@_TMP_OUT := $(shell mktemp -d -t dockercli-output.XXXXXXXXXX))
91+
docker build . \
92+
--output type=local,dest=$($@_TMP_OUT) \
93+
-f ./docs/docs.Dockerfile \
94+
--target update
95+
rm -rf ./docs/internal
96+
cp -R "$($@_TMP_OUT)"/out/* ./docs/
97+
rm -rf "$($@_TMP_OUT)"/*
98+
99+
.PHONY: validate-docs
100+
validate-docs: ## validate the doc does not change
101+
@docker build . \
102+
-f ./docs/docs.Dockerfile \
103+
--target validate
104+
81105
.PHONY: check-dependencies
82106
check-dependencies: ## check dependency updates
83107
go list -u -m -f '{{if not .Indirect}}{{if .Update}}{{.}}{{end}}{{end}}' all
@@ -94,7 +118,7 @@ go-mod-tidy: ## Run go mod tidy in a container and output resulting go.mod and g
94118
validate-go-mod: ## Validate go.mod and go.sum are up-to-date
95119
@docker build . --target check-go-mod
96120

97-
validate: validate-go-mod validate-headers ## Validate sources
121+
validate: validate-go-mod validate-headers validate-docs ## Validate sources
98122

99123
pre-commit: validate check-dependencies lint compose-plugin test e2e-compose
100124

0 commit comments

Comments
 (0)