Skip to content

Commit d9f4352

Browse files
committed
GitHub Actions cross
Signed-off-by: CrazyMax <[email protected]>
1 parent 56e5910 commit d9f4352

7 files changed

Lines changed: 111 additions & 101 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,6 @@ version: 2
22

33
jobs:
44

5-
cross:
6-
working_directory: /work
7-
docker: [{image: 'docker:20.10-git'}]
8-
environment:
9-
DOCKER_BUILDKIT: 1
10-
BUILDX_VERSION: "v0.6.0"
11-
parallelism: 3
12-
steps:
13-
- checkout
14-
- setup_remote_docker:
15-
version: 20.10.6
16-
reusable: true
17-
exclusive: false
18-
- run:
19-
name: "Docker version"
20-
command: docker version
21-
- run:
22-
name: "Docker info"
23-
command: docker info
24-
- run: apk add make curl
25-
- run: mkdir -vp ~/.docker/cli-plugins/
26-
- run: curl -fsSL --output ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-amd64
27-
- run: chmod a+x ~/.docker/cli-plugins/docker-buildx
28-
- run: docker buildx version
29-
- run: docker context create buildctx
30-
- run: docker buildx create --use buildctx && docker buildx inspect --bootstrap
31-
- run: GROUP_INDEX=$CIRCLE_NODE_INDEX GROUP_TOTAL=$CIRCLE_NODE_TOTAL docker buildx bake cross --progress=plain
32-
- store_artifacts:
33-
path: /work/build
34-
355
test:
366
working_directory: /work
377
docker: [{image: 'docker:20.10-git'}]
@@ -112,6 +82,5 @@ workflows:
11282
version: 2
11383
ci:
11484
jobs:
115-
- cross
11685
- test
11786
- validate

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'master'
8+
- '[0-9]+.[0-9]{2}'
9+
tags:
10+
- 'v*'
11+
pull_request:
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
target:
20+
- cross
21+
- dynbinary-cross
22+
steps:
23+
-
24+
name: Checkout
25+
uses: actions/checkout@v2
26+
-
27+
name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v1
29+
-
30+
name: Run ${{ matrix.target }}
31+
uses: docker/bake-action@v1
32+
with:
33+
targets: ${{ matrix.target }}
34+
-
35+
name: Flatten artifacts
36+
working-directory: ./build
37+
run: |
38+
for dir in */; do
39+
base=$(basename "$dir")
40+
echo "Creating ${base}.tar.gz ..."
41+
tar -cvzf "${base}.tar.gz" "$dir"
42+
rm -rf "$dir"
43+
done
44+
-
45+
name: Upload artifacts
46+
uses: actions/upload-artifact@v2
47+
with:
48+
name: ${{ matrix.target }}
49+
path: ./build/*
50+
if-no-files-found: error

Makefile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44
all: binary
55

6-
76
_:=$(shell ./scripts/warn-outside-container $(MAKECMDGOALS))
87

98
.PHONY: clean
@@ -21,22 +20,30 @@ test: test-unit ## run tests
2120
test-coverage: ## run test coverage
2221
gotestsum -- -coverprofile=coverage.txt $(shell go list ./... | grep -vE '/vendor/|/e2e/')
2322

23+
.PHONY: lint
24+
lint: ## run all the lint tools
25+
golangci-lint run
26+
27+
.PHONY: shellcheck
28+
shellcheck: ## run shellcheck validation
29+
find scripts/ contrib/completion/bash -type f | grep -v scripts/winresources | grep -v '.*.ps1' | xargs shellcheck
30+
2431
.PHONY: fmt
2532
fmt:
2633
go list -f {{.Dir}} ./... | xargs gofmt -w -s -d
2734

2835
.PHONY: binary
29-
binary:
30-
docker buildx bake binary
36+
binary: ## build executable for Linux
37+
./scripts/build/binary
38+
39+
.PHONY: dynbinary
40+
dynbinary: ## build dynamically linked binary
41+
GO_LINKMODE=dynamic ./scripts/build/binary
3142

3243
.PHONY: plugins
3344
plugins: ## build example CLI plugins
3445
./scripts/build/plugins
3546

36-
.PHONY: cross
37-
cross:
38-
docker buildx bake cross
39-
4047
.PHONY: plugins-windows
4148
plugins-windows: ## build example CLI plugins for Windows
4249
./scripts/build/plugins-windows
@@ -45,10 +52,6 @@ plugins-windows: ## build example CLI plugins for Windows
4552
plugins-osx: ## build example CLI plugins for macOS
4653
./scripts/build/plugins-osx
4754

48-
.PHONY: dynbinary
49-
dynbinary: ## build dynamically linked binary
50-
USE_GLIBC=1 docker buildx bake dynbinary
51-
5255
vendor: vendor.conf ## check that vendor matches vendor.conf
5356
rm -rf vendor
5457
bash -c 'vndr |& grep -v -i clone | tee ./vndr.log'

README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,67 @@
1-
[![build status](https://circleci.com/gh/docker/cli.svg?style=shield)](https://circleci.com/gh/docker/cli/tree/master)
2-
[![Build Status](https://ci.docker.com/public/job/cli/job/master/badge/icon)](https://ci.docker.com/public/job/cli/job/master)
1+
# Docker CLI
32

4-
docker/cli
5-
==========
3+
[![PkgGoDev](https://img.shields.io/badge/go.dev-docs-007d9c?logo=go&logoColor=white)](https://pkg.go.dev/github.com/docker/cli)
4+
[![Build Status](https://img.shields.io/github/workflow/status/docker/cli/build?logo=github)](https://github.com/docker/cli/actions?query=workflow%3Abuild)
5+
[![CircleCI Status](https://img.shields.io/circleci/build/github/docker/cli/master?logo=circleci)](https://circleci.com/gh/docker/cli/tree/master)
6+
[![Jenkins Status](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.docker.com%2Fpublic%2Fjob%2Fcli%2Fjob%2Fmaster&logo=jenkins)](https://ci.docker.com/public/job/cli/job/master)
7+
[![Go Report Card](https://goreportcard.com/badge/github.com/docker/cli)](https://goreportcard.com/report/github.com/docker/cli)
8+
[![Codecov](https://codecov.io/gh/docker/cli/branch/master/graph/badge.svg)](https://codecov.io/gh/docker/cli)
9+
10+
## About
611

712
This repository is the home of the cli used in the Docker CE and
813
Docker EE products.
914

10-
Development
11-
===========
15+
## Development
1216

1317
`docker/cli` is developed using Docker.
1418

1519
Build CLI from source:
1620

17-
```
18-
$ docker buildx bake
21+
```shell
22+
docker buildx bake
1923
```
2024

2125
Build binaries for all supported platforms:
2226

23-
```
24-
$ docker buildx bake cross
27+
```shell
28+
docker buildx bake cross
2529
```
2630

2731
Build for a specific platform:
2832

29-
```
30-
$ docker buildx bake --set binary.platform=linux/arm64
33+
```shell
34+
docker buildx bake --set binary.platform=linux/arm64
3135
```
3236

3337
Build dynamic binary for glibc or musl:
3438

39+
```shell
40+
USE_GLIBC=1 docker buildx bake dynbinary
3541
```
36-
$ USE_GLIBC=1 docker buildx bake dynbinary
37-
```
38-
3942

4043
Run all linting:
4144

42-
```
43-
$ make -f docker.Makefile lint
45+
```shell
46+
docker buildx bake lint shellcheck
4447
```
4548

4649
List all the available targets:
4750

48-
```
49-
$ make help
51+
```shell
52+
make help
5053
```
5154

5255
### In-container development environment
5356

5457
Start an interactive development environment:
5558

56-
```
57-
$ make -f docker.Makefile shell
59+
```shell
60+
make -f docker.Makefile shell
5861
```
5962

60-
Legal
61-
=====
63+
## Legal
64+
6265
*Brought to you courtesy of our legal counsel. For more context,
6366
please see the [NOTICE](https://github.com/docker/cli/blob/master/NOTICE) document in this repo.*
6467

@@ -70,8 +73,8 @@ violate applicable laws.
7073

7174
For more information, please see https://www.bis.doc.gov
7275

73-
Licensing
74-
=========
76+
## Licensing
77+
7578
docker/cli is licensed under the Apache License, Version 2.0. See
7679
[LICENSE](https://github.com/docker/docker/blob/master/LICENSE) for the full
7780
license text.

docker-bake.hcl

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,16 @@ target "dynbinary" {
3232
}
3333
}
3434

35-
variable "GROUP_TOTAL" {
36-
default = "1"
37-
}
38-
39-
variable "GROUP_INDEX" {
40-
default = "0"
41-
}
42-
43-
function "platforms" {
44-
params = [USE_GLIBC]
45-
result = concat(["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x", "darwin/amd64", "darwin/arm64", "windows/amd64", "windows/arm", "windows/386"], USE_GLIBC!=""?[]:["windows/arm64"])
46-
}
47-
48-
function "glen" {
49-
params = [platforms, GROUP_TOTAL]
50-
result = ceil(length(platforms)/GROUP_TOTAL)
51-
}
52-
53-
target "_all_platforms" {
54-
platforms = slice(platforms(USE_GLIBC), GROUP_INDEX*glen(platforms(USE_GLIBC), GROUP_TOTAL),min(length(platforms(USE_GLIBC)), (GROUP_INDEX+1)*glen(platforms(USE_GLIBC), GROUP_TOTAL)))
35+
target "platforms" {
36+
platforms = concat(["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x", "darwin/amd64", "darwin/arm64", "windows/amd64", "windows/arm", "windows/386"], USE_GLIBC!=""?[]:["windows/arm64"])
5537
}
5638

5739
target "cross" {
58-
inherits = ["binary", "_all_platforms"]
40+
inherits = ["binary", "platforms"]
5941
}
6042

6143
target "dynbinary-cross" {
62-
inherits = ["dynbinary", "_all_platforms"]
44+
inherits = ["dynbinary", "platforms"]
6345
}
6446

6547
target "lint" {

docker.Makefile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ build_e2e_image:
4242
DOCKER_RUN_NAME_OPTION := $(if $(DOCKER_CLI_CONTAINER_NAME),--name $(DOCKER_CLI_CONTAINER_NAME),)
4343
DOCKER_RUN := docker run --rm $(ENVVARS) $(DOCKER_CLI_MOUNTS) $(DOCKER_RUN_NAME_OPTION)
4444

45-
binary: build_binary_native_image ## build the CLI
46-
$(DOCKER_RUN) $(BINARY_NATIVE_IMAGE_NAME)
45+
.PHONY: binary
46+
binary:
47+
docker buildx bake binary
4748

4849
build: binary ## alias for binary
4950

@@ -62,6 +63,10 @@ test-unit: build_docker_image ## run unit tests (using go test)
6263
.PHONY: test ## run unit and e2e tests
6364
test: test-unit test-e2e
6465

66+
.PHONY: cross
67+
cross:
68+
docker buildx bake cross
69+
6570
.PHONY: plugins-windows
6671
plugins-windows: build_cross_image ## build the example CLI plugins for Windows
6772
$(DOCKER_RUN) $(CROSS_IMAGE_NAME) make $@
@@ -70,6 +75,10 @@ plugins-windows: build_cross_image ## build the example CLI plugins for Windows
7075
plugins-osx: build_cross_image ## build the example CLI plugins for macOS
7176
$(DOCKER_RUN) $(CROSS_IMAGE_NAME) make $@
7277

78+
.PHONY: dynbinary
79+
dynbinary: ## build dynamically linked binary
80+
USE_GLIBC=1 docker buildx bake dynbinary
81+
7382
.PHONY: dev
7483
dev: build_docker_image ## start a build container in interactive mode for in-container development
7584
$(DOCKER_RUN) -it \
@@ -82,6 +91,10 @@ shell: dev ## alias for dev
8291
lint: ## run linters
8392
docker buildx bake lint
8493

94+
.PHONY: shellcheck
95+
shellcheck: ## run shellcheck validation
96+
docker buildx bake shellcheck
97+
8598
.PHONY: fmt
8699
fmt: ## run gofmt
87100
$(DOCKER_RUN) $(DEV_DOCKER_IMAGE_NAME) make fmt
@@ -102,10 +115,6 @@ manpages: build_docker_image ## generate man pages from go source and markdown
102115
yamldocs: build_docker_image ## generate documentation YAML files consumed by docs repo
103116
$(DOCKER_RUN) -it $(DEV_DOCKER_IMAGE_NAME) make yamldocs
104117

105-
.PHONY: shellcheck
106-
shellcheck: ## run shellcheck validation
107-
docker buildx bake shellcheck
108-
109118
.PHONY: test-e2e
110119
test-e2e: test-e2e-non-experimental test-e2e-experimental test-e2e-connhelper-ssh ## run all e2e tests
111120

dockerfiles/Dockerfile.cross

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

0 commit comments

Comments
 (0)