Commit Graph

310 Commits

Author SHA1 Message Date
Paweł Gronowski
8411ecb5e3 Makefile: Add BIND_GIT variable
Defining BIND_GIT will bind mount the common .git directory into the dev
container.
This makes it possible to run some hack/* scripts which rely on `git`
when running the container in a git worktree.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-07 16:05:20 +02:00
Brian Goff
72eb615490 Makefile: bundles is not PHONY
This was changed recently so that the bundles target is always run, but
`mkdir bundles` fails when bundles exists...

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2024-05-03 21:01:12 +00:00
imalasong
194cbd6e7d Makefile: refactoring .PHONY
Signed-off-by: xiaochangbai <704566072@qq.com>
2024-04-09 09:26:31 +08:00
Sebastiaan van Stijn
25c9e6e8df Makefile: generate-files: fix check for empty TMP_OUT
commit c655b7dc78 added a check to make sure
the TMP_OUT variable was not set to an empty value, as such a situation would
perform an `rm -rf /**` during cleanup.

However, it was a bit too eager, because Makefile conditionals (`ifeq`) are
evaluated when parsing the Makefile, which happens _before_ the make target
is executed.

As a result `$@_TMP_OUT` was always empty when the `ifeq` was evaluated,
making it not possible to execute the `generate-files` target.

This patch changes the check to use a shell command to evaluate if the var
is set to an empty value.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-03-15 17:54:54 +01:00
Paweł Gronowski
8761bffcaf Makefile: Pass PAGER/GIT_PAGER variable
Allow to override the PAGER/GIT_PAGER variables inside the container.
Use `cat` as pager when running in Github Actions (to avoid things like
`git diff` stalling the CI).

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-02-20 11:52:58 +01:00
voloder
c655b7dc78 Assert temp output directory is not an empty string
Signed-off-by: voloder <110066198+voloder@users.noreply.github.com>
2024-01-19 22:45:54 +01:00
Sebastiaan van Stijn
49f3e7d233 Dockerfile: remove APT_MIRROR build-arg
This option was originally added in 8ec8564691,
at which time the upstream debian package repositories were not always
reliable, so using a mirror helped with CI stability and performance.

Debian's package repositories are a lot more reliable now, so there's no
longer a need to use a mirror.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-04 13:52:58 +01:00
Derek McGowan
06a640084f Fix graphdriver lookup in makefile
When graphdriver is not provided the graphdriver is looked up
from docker info, but without quotes it may fail and set the
graphdriver to an incorrect value.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-20 14:46:43 -07:00
Paweł Gronowski
c2004fb8c4 hack: Add TEST_IGNORE_CGROUP_CHECK
Add env variable that allows to run integration-cli tests with cgroup v2 enabled.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-09-08 13:41:03 +02:00
Brian Goff
e8dc902781 Wire up tests to support otel tracing
Integration tests will now configure clients to propagate traces as well
as create spans for all tests.

Some extra changes were needed (or desired for trace propagation) in the
test helpers to pass through tracing spans via context.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-09-07 18:38:22 +00:00
Djordje Lukic
ebb9fade23 makefile: use info -f to get the current storage driver
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-08-31 09:36:48 +02:00
Bjorn Neergaard
d125823d3f hack: use long SHA for DOCKER_GITCOMMIT
This better aligns to GHA/CI settings, and is in general a better
practice in the year 2023.

We also drop the 'unsupported' fallback for `git rev-parse` in the
Makefile; we have a better fallback behavior for an empty
DOCKER_GITCOMMIT in `hack/make.sh`.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-08-18 14:42:51 -06:00
Paweł Gronowski
48cc28e4ef hack/integration: Add TEST_INTEGRATION_FAIL_FAST
Before this change, integration test would fail fast and not execute all
test suites when one suite fails.
Change this behavior into opt-in enabled by TEST_INTEGRATION_FAIL_FAST
variable.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-07-24 16:54:31 +02:00
Bjorn Neergaard
bcea83ab9b Makefile: pass through APT_MIRROR
This aligns `docker build` as invoked by the Makefile with both `docker
buildx bake` as invoked by the Makefile and directly by the user.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-07-17 10:18:14 -06:00
CrazyMax
7c697f58f2 Makefile: remove unused BUILD_APT_MIRROR
BUILD_APT_MIRROR added in https://github.com/moby/moby/pull/26375
is not used anymore.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-06-29 00:11:45 +02:00
Brian Goff
e1c92184f0 Merge pull request #44526 from crazy-max/rm-dockerfile-e2e
remove Dockerfile.e2e
2023-06-10 10:53:51 -07:00
Paweł Gronowski
17c99f7164 Dockerfile: Use separate cli for shell and integration-cli
Use separate cli for integration-cli to allow use newer CLI for
interactive dev shell usage.

Both versions can be overriden with DOCKERCLI_VERSION or
DOCKERCLI_INTEGRATION_VERSION. Binary is downloaded from
download.docker.com if it's available, otherwise it's built from the
source.

For backwards compatibility DOCKER_CLI_PATH overrides BOTH clis.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-06-05 15:25:21 +02:00
CrazyMax
5efe72415d remove Dockerfile.e2e
Dockerfile.e2e is not used anymore. Integration tests run
through the main Dockerfile.

Also removes the daemon OS/Arch detection script that is not
necessary anymore. It was used to select the Dockerfile based
on the arch like Dockerfile.arm64 but we don't have those
anymore. Was also used to check referenced frozen images
in the Dockerfile.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-05-29 11:03:48 +02:00
Kevin Alvarez
7daaa00120 hack: generated files update and validation
Adds a Dockerfile and make targets to update and validate
generated files (proto, seccomp default profile)

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-05-29 03:28:35 +02:00
Sebastiaan van Stijn
dc11d2a2d8 remove deprecated devicemapper storage-driver
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-20 23:51:54 +02:00
CrazyMax
b565b496ba Dockerfile: rename dev stages
Also remove DEV_IMAGE bake var that is not used

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-01 18:03:03 +01:00
CrazyMax
8086f40123 Dockerfile: use TARGETPLATFORM to build Docker
Better support for cross compilation so we can fully rely
on `--platform` flag of buildx for a seamless integration.

This removes unnecessary extra cross logic in the Dockerfile,
DOCKER_CROSSPLATFORMS and CROSS vars and some hack scripts as well.

Non-sandboxed build invocation is still supported and dev stages
in the Dockerfile have been updated accordingly.

Bake definition and GitHub Actions workflows have been updated
accordingly as well.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-01 18:03:01 +01:00
CrazyMax
bade242ddd Makefile: always use buildx
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-11-25 23:22:53 +01:00
Sebastiaan van Stijn
7ff0f654fb daemon: add TEST_INTEGRATION_USE_SNAPSHOTTER for CI
This allows us to run CI with the containerd snapshotter enabled, without
patching the daemon.json, or changing how tests set up daemon flags.

A warning log is added during startup, to inform if this variable is set,
as it should only be used for our integration tests.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-17 15:13:53 +02:00
CrazyMax
a73d78f8d5 ci(test): validate job matrix
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-09-09 02:24:17 +02:00
CrazyMax
807c849431 ci(test): send coverage to codecov
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-09-08 12:12:03 +02:00
CrazyMax
df731c745a integration: TestNetworkLoopbackNat is broken on GitHub Runner
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-09-07 22:52:34 +02:00
CrazyMax
2e04be3fb9 ci: gha test workflow for integration and unit test
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-09-07 22:52:34 +02:00
Ben Langfeld
5dcaad0dd3 Upgrades buildx to 0.9.1
v0.9.0 included regressions. Release notes: https://github.com/docker/buildx/releases/tag/v0.9.1

Signed-off-by: Ben Langfeld <blangfeld@powerhrg.com>
2022-08-25 19:14:16 -03:00
Sebastiaan van Stijn
f27b74f0f7 Makefile: update buildx to v0.9.0
release notes: https://github.com/docker/buildx/releases/tag/v0.9.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-17 14:55:39 +02:00
Sebastiaan van Stijn
219374e2cd Merge pull request #43275 from kponichtera/43274-delve-debugger
Added Delve debugger to the development container
2022-05-10 18:34:45 +02:00
Konrad Ponichtera
7d328ea1d6 Added Delve debugger to the development container (including instructions in the contribution guide).
Signed-off-by: Konrad Ponichtera <konpon96@gmail.com>
2022-04-26 20:14:06 +02:00
CrazyMax
1efda78f2b use go-winres for windows build and cleanup autogen and winresources
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-04-14 19:52:36 +02:00
CrazyMax
fd2143e0b0 use go-winres for cross to create Windows resources
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-04-14 19:52:35 +02:00
Sebastiaan van Stijn
ae7d3efafd Makefile: update buildx to v0.8.2
release notes: https://github.com/docker/buildx/releases/tag/v0.8.2

Notable changes:

- Update Compose spec used by buildx bake to v1.2.1 to fix parsing ports definition
- Fix possible crash on handling progress streams from BuildKit v0.10
- Fix parsing groups in buildx bake when already loaded by a parent group

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-04 11:03:52 +02:00
Sebastiaan van Stijn
3bd74488fd Makefile: use volume for go mod cache when running dev-container
This allows the modules to be cached when vendoring modules from within
the dev container.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-18 15:46:06 +01:00
Sebastiaan van Stijn
4145c81d82 Merge pull request #42880 from thaJeztah/makefile_proxy_vars
Makefile: remove passing proxy env-vars
2021-09-27 13:30:39 +02:00
Sebastiaan van Stijn
25381123d3 Makefile: update bfirsh/redoc to 1.14.0, and fix swagger warnings
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-09-24 17:23:55 +02:00
Sebastiaan van Stijn
ec9c8545f8 Makefile: remove passing proxy env-vars
Docker 17.07 and up allow the CLI to be configured to set default proxy
env-vars to be used (both as build-arg and as env for docker run), see
docker/cli#93, so setting these here should be redundant. If someone
needs these env-vars set, they should be configured in the cli's
`~/.docker/config.json` instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-09-24 15:55:56 +02:00
Sebastiaan van Stijn
22316ff1d8 Makefile: update buildx version to v0.6.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-20 00:58:13 +02:00
Sebastiaan van Stijn
8de724390e Makefile: do not tag docker-dev image with GIT_BRANCH
When building the dev image, the Makefile generates a tag-name for the image,
based on the current git branch. As a result of this naming, old images will
collect on a developer's machine (especially when building from different
branches, for example when reviewing pull requests):

    REPOSITORY   TAG                                                 IMAGE ID       CREATED        SIZE
    docker-dev   HEAD                                                9785a8fb82f5   30 hours ago   2.13GB
    docker-dev   master                                              9785a8fb82f5   30 hours ago   2.13GB
    docker-dev   seccomp-closer-to-oci                               9785a8fb82f5   30 hours ago   2.13GB
    docker-dev   move-stackdump                                      06882c142bfd   2 days ago     2.13GB
    docker-dev   add-dns-to-docker-info                              2961ed1b99bd   10 days ago    2.13GB
    docker-dev   add-platform-info                                   2961ed1b99bd   10 days ago    2.13GB
    docker-dev   rata-seccomp-new-fields                             2961ed1b99bd   10 days ago    2.13GB
    docker-dev   swagger-wip                                         2961ed1b99bd   10 days ago    2.13GB
    docker-dev   system-df-types                                     2961ed1b99bd   10 days ago    2.13GB
    docker-dev   use-oci-platform                                    2961ed1b99bd   10 days ago    2.13GB
    docker-dev   update-swagger-fork                                 3eeedecca85a   2 weeks ago    2.13GB
    docker-dev   remove-lcow-step5-alternative                       51f9720bbc19   2 weeks ago    2.13GB
    docker-dev   update-s390x-ubuntu-2004                            51f9720bbc19   2 weeks ago    2.13GB
    docker-dev   fix-image-shared-size                               09e9aa46694a   2 weeks ago    2.13GB
    docker-dev   remove-discovery                                    11823223ae83   3 weeks ago    2.13GB
    docker-dev   daemon-config                                       355643e371b0   4 weeks ago    2.12GB
    docker-dev   jenkins-windows-containerd                          68199214b860   4 weeks ago    2.11GB
    docker-dev   unfork-buildkit                                     68199214b860   4 weeks ago    2.11GB
    docker-dev   warn-on-non-matching-platform                       bc014b94017f   5 weeks ago    2.11GB
    docker-dev   remove-lcow                                         3a43c0900282   6 weeks ago    2.11GB
    docker-dev   remove-lcow-part5                                   3a43c0900282   6 weeks ago    2.11GB
    docker-dev   remove-lcow-step3                                   3a43c0900282   6 weeks ago    2.11GB
    docker-dev   remove-lcow-step4                                   3a43c0900282   6 weeks ago    2.11GB
    docker-dev   seccomp-unconfined-daemon                           3a43c0900282   6 weeks ago    2.11GB
    docker-dev   update-authors                                      3a43c0900282   6 weeks ago    2.11GB
    docker-dev   payall4u-fix-creating-sandbox-when-disable-bridge   114c0f2ceb17   6 weeks ago    2.12GB
    docker-dev   catch-almost-all                                    f437d2bc512b   8 weeks ago    2.12GB
    docker-dev   bin-criu                                            c72894ae66f3   2 months ago   2.12GB
    docker-dev   bump-golang-1-14                                    395932141809   2 months ago   2.14GB
    docker-dev   upstream-systemd-units                              d0cb07f9473c   2 months ago   2.12GB
    docker-dev   bump-criu                                           6ed9e8fcf59f   2 months ago   2.12GB

This images are a bit of a pain to clean up, and because they are tagged,
`docker image prune` or `docker system prune` doesn't help (unless `--all` is
used).

Looking at the background of this naming, a found that it was originally added
in a95712899e, after a discussion on PR 3471.
At the time, the image name was used to check if the image needed building, and
otherwise building was skipped in the makefile.

This is no longer the case; the image is built unconditionally, and the build-
cache helps (where possible) speed up rebuilding the image.

In _theory_ having unique names would allow for multiple dev containers (from
different branches) to be started in parallel, but in most situations, the
source-code will be mounted (`BIND_MOUNT=.`), so I'm not sure if that should
be a compelling reason to keep the current naming.

This patch removes the unique tag, and will always tag the image locally as
`docker-dev:latest`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-17 17:52:45 +02:00
Sebastiaan van Stijn
151ec207b9 Makefile: install buildx from binary release, instead of building
This was originally added in 833444c0d6,
at which time buildx did not yet have a release, so we had to build
from source.

Now that buildx has binary releases on GitHub, we should be able to
consume those binaries instead of building.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-05-18 17:25:22 +02:00
Sebastiaan van Stijn
a4400d328c Makefile: remove empty targets, and slight refactor
The empty `binary:`, `dynbinary:`, and `cross:` targets at the top were
only useful to provide the description for `make help`.

This patch splits the actual `binary`, `dynbinary`, and `cross` targets
to separate lines, introducing some slight duplicated code, but making
it slightly easier to read (and removing the "empty" targets).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-01 16:48:07 +02:00
Brian Goff
9688ca59b3 Rename newer build_shell target to build
These two targets seem interchangeable, just that the old `build` target
always built the `final` Dockerfile target even if the source was going
to be bind mounted anyway.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-04-02 15:48:43 -07:00
Akihiro Suda
5bf33adba2 hack: support $DOCKER_ROOTLESS for testing rootless
```
$ DOCKER_EXPERIMENTAL=1 DOCKER_ROOTLESS=1 TEST_SKIP_INTEGRATION_CLI=1 \
 make test-integration
```

test-integration-cli is unsupported currently.
Also, tests that spawn custom daemon (testutil/daemon) are skipped.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-03-10 05:49:45 +09:00
Akihiro Suda
a3292263a3 integration: use systemd when $DOCKER_SYSTEMD is set
Fix #40492

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-03-04 03:03:38 +09:00
Brian Goff
5dffe74df2 Fix windows cross builds.
Windows still writes to the autogen directory, but the source code is
mounted in as read-only.
In order to do enable this without taking a massive hit in doing an rw
mount (for the source code) we mount a tmpfs into the build at the
autogen dir.
In order for this to work the directory must alreay exist, so we create
it before entering the build.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-01-30 15:43:23 -08:00
Sebastiaan van Stijn
545e81714b hack/validate: allow forcing validation
This introduces a FORCE_VALIDATE environment variable, which allows
forcing some validation steps, even if no changes were detected.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-12-19 18:03:55 +01:00
Brian Goff
c057825cf5 Pass VERSION variable to binary build targets.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-10-30 10:07:45 -07:00
Brian Goff
e7d2d853f6 Make binary output targets use own build cmd
The binary targets now use buildkit to build/output binaries instead of
doing it in a DOCKER_RUN_DOCKER container. With that change caused
issues when trying to call multiple make targets such as `make binary
cross` since those targets are updating the variables (with conflicting
data) used by the shared `build` prerequisite.

This change has those binary output targets call `docker build` (or
`buildx build`) directly since that is the action they are preforming
and no longer have any pre-reqs.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-10-30 10:07:45 -07:00