2017-04-27 17:07:51 -04:00
|
|
|
version: 2
|
2017-06-14 18:44:06 -04:00
|
|
|
|
2017-04-27 17:07:51 -04:00
|
|
|
jobs:
|
2017-06-14 18:44:06 -04:00
|
|
|
|
|
|
|
lint:
|
2017-05-03 20:55:52 -04:00
|
|
|
working_directory: /work
|
2018-07-13 05:26:07 -04:00
|
|
|
docker: [{image: 'docker:18.03-git'}]
|
2017-04-27 17:07:51 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
2017-06-15 18:00:36 -04:00
|
|
|
- setup_remote_docker:
|
2018-07-13 05:46:31 -04:00
|
|
|
version: 18.03.1-ce
|
2017-06-15 18:00:36 -04:00
|
|
|
reusable: true
|
|
|
|
exclusive: false
|
2017-06-09 15:50:42 -04:00
|
|
|
- run:
|
|
|
|
command: docker version
|
2017-05-02 16:40:29 -04:00
|
|
|
- run:
|
|
|
|
name: "Lint"
|
2017-05-02 15:10:03 -04:00
|
|
|
command: |
|
Do not patch Dockerfiles in CI
When building the Dockerfiles for development, those images are mainly used to
create a reproducible build-environment. The source code is bind-mounted into
the image at runtime; there is no need to create an image with the actual
source code, and copying the source code into the image would lead to a new
image being created for each code-change (possibly leading up to many "dangling"
images for previous code-changes).
However, when building (and using) the development images in CI, bind-mounting
is not an option, because the daemon is running remotely.
To make this work, the circle-ci script patched the Dockerfiles when CI is run;
adding a `COPY` to the respective Dockerfiles.
Patching Dockerfiles is not really a "best practice" and, even though the source
code does not and up in the image, the source would still be _sent_ to the daemon
for each build (unless BuildKit is used).
This patch updates the makefiles, circle-ci script, and Dockerfiles;
- When building the Dockerfiles locally, pipe the Dockerfile through stdin.
Doing so, prevents the build-context from being sent to the daemon. This speeds
up the build, and doesn't fill up the Docker "temp" directory with content that's
not used
- Now that no content is sent, add the COPY instructions to the Dockerfiles, and
remove the code in the circle-ci script to "live patch" the Dockerfiles.
Before this patch is applied (with cache):
```
$ time make -f docker.Makefile build_shell_validate_image
docker build -t docker-cli-shell-validate -f ./dockerfiles/Dockerfile.shellcheck .
Sending build context to Docker daemon 41MB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
2.75 real 0.45 user 0.56 sys
```
After this patch is applied (with cache)::
```
$ time make -f docker.Makefile build_shell_validate_image
cat ./dockerfiles/Dockerfile.shellcheck | docker build -t docker-cli-shell-validate -
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
0.33 real 0.07 user 0.08 sys
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-28 19:06:10 -05:00
|
|
|
docker build -f dockerfiles/Dockerfile.lint --tag cli-linter:$CIRCLE_BUILD_NUM .
|
2017-06-15 18:00:36 -04:00
|
|
|
docker run --rm cli-linter:$CIRCLE_BUILD_NUM
|
2017-06-14 18:44:06 -04:00
|
|
|
|
|
|
|
cross:
|
|
|
|
working_directory: /work
|
2018-07-13 05:26:07 -04:00
|
|
|
docker: [{image: 'docker:18.03-git'}]
|
2017-06-15 18:00:36 -04:00
|
|
|
parallelism: 3
|
2017-06-14 18:44:06 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
2017-06-15 18:00:36 -04:00
|
|
|
- setup_remote_docker:
|
2018-07-13 05:46:31 -04:00
|
|
|
version: 18.03.1-ce
|
2017-06-15 18:00:36 -04:00
|
|
|
reusable: true
|
|
|
|
exclusive: false
|
2017-05-02 15:10:03 -04:00
|
|
|
- run:
|
2017-05-03 20:55:52 -04:00
|
|
|
name: "Cross"
|
2017-05-02 16:40:29 -04:00
|
|
|
command: |
|
Do not patch Dockerfiles in CI
When building the Dockerfiles for development, those images are mainly used to
create a reproducible build-environment. The source code is bind-mounted into
the image at runtime; there is no need to create an image with the actual
source code, and copying the source code into the image would lead to a new
image being created for each code-change (possibly leading up to many "dangling"
images for previous code-changes).
However, when building (and using) the development images in CI, bind-mounting
is not an option, because the daemon is running remotely.
To make this work, the circle-ci script patched the Dockerfiles when CI is run;
adding a `COPY` to the respective Dockerfiles.
Patching Dockerfiles is not really a "best practice" and, even though the source
code does not and up in the image, the source would still be _sent_ to the daemon
for each build (unless BuildKit is used).
This patch updates the makefiles, circle-ci script, and Dockerfiles;
- When building the Dockerfiles locally, pipe the Dockerfile through stdin.
Doing so, prevents the build-context from being sent to the daemon. This speeds
up the build, and doesn't fill up the Docker "temp" directory with content that's
not used
- Now that no content is sent, add the COPY instructions to the Dockerfiles, and
remove the code in the circle-ci script to "live patch" the Dockerfiles.
Before this patch is applied (with cache):
```
$ time make -f docker.Makefile build_shell_validate_image
docker build -t docker-cli-shell-validate -f ./dockerfiles/Dockerfile.shellcheck .
Sending build context to Docker daemon 41MB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
2.75 real 0.45 user 0.56 sys
```
After this patch is applied (with cache)::
```
$ time make -f docker.Makefile build_shell_validate_image
cat ./dockerfiles/Dockerfile.shellcheck | docker build -t docker-cli-shell-validate -
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
0.33 real 0.07 user 0.08 sys
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-28 19:06:10 -05:00
|
|
|
docker build -f dockerfiles/Dockerfile.cross --tag cli-builder:$CIRCLE_BUILD_NUM .
|
2017-06-15 18:00:36 -04:00
|
|
|
name=cross-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX
|
|
|
|
docker run \
|
|
|
|
-e CROSS_GROUP=$CIRCLE_NODE_INDEX \
|
|
|
|
--name $name cli-builder:$CIRCLE_BUILD_NUM \
|
|
|
|
make cross
|
|
|
|
docker cp \
|
|
|
|
$name:/go/src/github.com/docker/cli/build \
|
|
|
|
/work/build
|
2017-06-14 18:44:06 -04:00
|
|
|
- store_artifacts:
|
|
|
|
path: /work/build
|
|
|
|
|
|
|
|
test:
|
|
|
|
working_directory: /work
|
2018-07-13 05:26:07 -04:00
|
|
|
docker: [{image: 'docker:18.03-git'}]
|
2017-06-14 18:44:06 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
2017-06-15 18:00:36 -04:00
|
|
|
- setup_remote_docker:
|
2018-07-13 05:46:31 -04:00
|
|
|
version: 18.03.1-ce
|
2017-06-15 18:00:36 -04:00
|
|
|
reusable: true
|
|
|
|
exclusive: false
|
2017-05-03 20:55:52 -04:00
|
|
|
- run:
|
2017-05-18 10:42:05 -04:00
|
|
|
name: "Unit Test with Coverage"
|
2017-05-03 20:55:52 -04:00
|
|
|
command: |
|
2019-02-01 05:56:27 -05:00
|
|
|
mkdir -p test-results/unit-tests
|
Do not patch Dockerfiles in CI
When building the Dockerfiles for development, those images are mainly used to
create a reproducible build-environment. The source code is bind-mounted into
the image at runtime; there is no need to create an image with the actual
source code, and copying the source code into the image would lead to a new
image being created for each code-change (possibly leading up to many "dangling"
images for previous code-changes).
However, when building (and using) the development images in CI, bind-mounting
is not an option, because the daemon is running remotely.
To make this work, the circle-ci script patched the Dockerfiles when CI is run;
adding a `COPY` to the respective Dockerfiles.
Patching Dockerfiles is not really a "best practice" and, even though the source
code does not and up in the image, the source would still be _sent_ to the daemon
for each build (unless BuildKit is used).
This patch updates the makefiles, circle-ci script, and Dockerfiles;
- When building the Dockerfiles locally, pipe the Dockerfile through stdin.
Doing so, prevents the build-context from being sent to the daemon. This speeds
up the build, and doesn't fill up the Docker "temp" directory with content that's
not used
- Now that no content is sent, add the COPY instructions to the Dockerfiles, and
remove the code in the circle-ci script to "live patch" the Dockerfiles.
Before this patch is applied (with cache):
```
$ time make -f docker.Makefile build_shell_validate_image
docker build -t docker-cli-shell-validate -f ./dockerfiles/Dockerfile.shellcheck .
Sending build context to Docker daemon 41MB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
2.75 real 0.45 user 0.56 sys
```
After this patch is applied (with cache)::
```
$ time make -f docker.Makefile build_shell_validate_image
cat ./dockerfiles/Dockerfile.shellcheck | docker build -t docker-cli-shell-validate -
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
0.33 real 0.07 user 0.08 sys
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-28 19:06:10 -05:00
|
|
|
docker build -f dockerfiles/Dockerfile.dev --tag cli-builder:$CIRCLE_BUILD_NUM .
|
2019-01-31 11:31:40 -05:00
|
|
|
docker run \
|
|
|
|
-e GOTESTSUM_JUNITFILE=/tmp/junit.xml \
|
|
|
|
--name \
|
2017-06-15 18:00:36 -04:00
|
|
|
test-$CIRCLE_BUILD_NUM cli-builder:$CIRCLE_BUILD_NUM \
|
|
|
|
make test-coverage
|
2019-01-31 11:31:40 -05:00
|
|
|
docker cp \
|
|
|
|
test-$CIRCLE_BUILD_NUM:/tmp/junit.xml \
|
2019-02-01 05:56:27 -05:00
|
|
|
./test-results/unit-tests/junit.xml
|
2017-06-14 18:44:06 -04:00
|
|
|
- run:
|
|
|
|
name: "Upload to Codecov"
|
|
|
|
command: |
|
2017-06-15 18:00:36 -04:00
|
|
|
docker cp \
|
|
|
|
test-$CIRCLE_BUILD_NUM:/go/src/github.com/docker/cli/coverage.txt \
|
|
|
|
coverage.txt
|
2017-05-18 10:42:05 -04:00
|
|
|
apk add -U bash curl
|
2017-08-15 13:17:20 -04:00
|
|
|
curl -s https://codecov.io/bash | bash || \
|
|
|
|
echo 'Codecov failed to upload'
|
2019-01-31 11:31:40 -05:00
|
|
|
- store_test_results:
|
|
|
|
path: test-results
|
2017-06-14 18:44:06 -04:00
|
|
|
|
|
|
|
validate:
|
|
|
|
working_directory: /work
|
2018-07-13 05:26:07 -04:00
|
|
|
docker: [{image: 'docker:18.03-git'}]
|
2017-06-14 18:44:06 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
2017-06-15 18:00:36 -04:00
|
|
|
- setup_remote_docker:
|
2018-07-13 05:46:31 -04:00
|
|
|
version: 18.03.1-ce
|
2017-06-15 18:00:36 -04:00
|
|
|
reusable: true
|
|
|
|
exclusive: false
|
2017-05-02 16:40:29 -04:00
|
|
|
- run:
|
2017-06-14 16:42:58 -04:00
|
|
|
name: "Validate Vendor, Docs, and Code Generation"
|
2017-05-02 16:40:29 -04:00
|
|
|
command: |
|
2017-06-06 15:02:28 -04:00
|
|
|
rm -f .dockerignore # include .git
|
Do not patch Dockerfiles in CI
When building the Dockerfiles for development, those images are mainly used to
create a reproducible build-environment. The source code is bind-mounted into
the image at runtime; there is no need to create an image with the actual
source code, and copying the source code into the image would lead to a new
image being created for each code-change (possibly leading up to many "dangling"
images for previous code-changes).
However, when building (and using) the development images in CI, bind-mounting
is not an option, because the daemon is running remotely.
To make this work, the circle-ci script patched the Dockerfiles when CI is run;
adding a `COPY` to the respective Dockerfiles.
Patching Dockerfiles is not really a "best practice" and, even though the source
code does not and up in the image, the source would still be _sent_ to the daemon
for each build (unless BuildKit is used).
This patch updates the makefiles, circle-ci script, and Dockerfiles;
- When building the Dockerfiles locally, pipe the Dockerfile through stdin.
Doing so, prevents the build-context from being sent to the daemon. This speeds
up the build, and doesn't fill up the Docker "temp" directory with content that's
not used
- Now that no content is sent, add the COPY instructions to the Dockerfiles, and
remove the code in the circle-ci script to "live patch" the Dockerfiles.
Before this patch is applied (with cache):
```
$ time make -f docker.Makefile build_shell_validate_image
docker build -t docker-cli-shell-validate -f ./dockerfiles/Dockerfile.shellcheck .
Sending build context to Docker daemon 41MB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
2.75 real 0.45 user 0.56 sys
```
After this patch is applied (with cache)::
```
$ time make -f docker.Makefile build_shell_validate_image
cat ./dockerfiles/Dockerfile.shellcheck | docker build -t docker-cli-shell-validate -
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
0.33 real 0.07 user 0.08 sys
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-28 19:06:10 -05:00
|
|
|
docker build -f dockerfiles/Dockerfile.dev --tag cli-builder-with-git:$CIRCLE_BUILD_NUM .
|
2017-06-15 18:00:36 -04:00
|
|
|
docker run --rm cli-builder-with-git:$CIRCLE_BUILD_NUM \
|
2017-08-15 14:32:44 -04:00
|
|
|
make ci-validate
|
2019-03-18 08:07:22 -04:00
|
|
|
no_output_timeout: 15m
|
2017-06-29 09:10:04 -04:00
|
|
|
shellcheck:
|
|
|
|
working_directory: /work
|
2018-07-13 05:26:07 -04:00
|
|
|
docker: [{image: 'docker:18.03-git'}]
|
2017-06-29 09:10:04 -04:00
|
|
|
steps:
|
|
|
|
- checkout
|
2018-07-13 05:46:31 -04:00
|
|
|
- setup_remote_docker:
|
|
|
|
version: 18.03.1-ce
|
|
|
|
reusable: true
|
|
|
|
exclusive: false
|
2017-06-29 09:10:04 -04:00
|
|
|
- run:
|
|
|
|
name: "Run shellcheck"
|
|
|
|
command: |
|
Do not patch Dockerfiles in CI
When building the Dockerfiles for development, those images are mainly used to
create a reproducible build-environment. The source code is bind-mounted into
the image at runtime; there is no need to create an image with the actual
source code, and copying the source code into the image would lead to a new
image being created for each code-change (possibly leading up to many "dangling"
images for previous code-changes).
However, when building (and using) the development images in CI, bind-mounting
is not an option, because the daemon is running remotely.
To make this work, the circle-ci script patched the Dockerfiles when CI is run;
adding a `COPY` to the respective Dockerfiles.
Patching Dockerfiles is not really a "best practice" and, even though the source
code does not and up in the image, the source would still be _sent_ to the daemon
for each build (unless BuildKit is used).
This patch updates the makefiles, circle-ci script, and Dockerfiles;
- When building the Dockerfiles locally, pipe the Dockerfile through stdin.
Doing so, prevents the build-context from being sent to the daemon. This speeds
up the build, and doesn't fill up the Docker "temp" directory with content that's
not used
- Now that no content is sent, add the COPY instructions to the Dockerfiles, and
remove the code in the circle-ci script to "live patch" the Dockerfiles.
Before this patch is applied (with cache):
```
$ time make -f docker.Makefile build_shell_validate_image
docker build -t docker-cli-shell-validate -f ./dockerfiles/Dockerfile.shellcheck .
Sending build context to Docker daemon 41MB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
2.75 real 0.45 user 0.56 sys
```
After this patch is applied (with cache)::
```
$ time make -f docker.Makefile build_shell_validate_image
cat ./dockerfiles/Dockerfile.shellcheck | docker build -t docker-cli-shell-validate -
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
0.33 real 0.07 user 0.08 sys
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-28 19:06:10 -05:00
|
|
|
docker build -f dockerfiles/Dockerfile.shellcheck --tag cli-validator:$CIRCLE_BUILD_NUM .
|
2017-06-29 09:10:04 -04:00
|
|
|
docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
|
2017-08-15 14:32:44 -04:00
|
|
|
make shellcheck
|
2017-06-14 18:44:06 -04:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
ci:
|
|
|
|
jobs:
|
|
|
|
- lint
|
|
|
|
- cross
|
|
|
|
- test
|
|
|
|
- validate
|
2017-06-29 09:10:04 -04:00
|
|
|
- shellcheck
|