Commit Graph

66 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 3f3ecb94c5
Makefile: add completion target
Add a "completion" target to install the generated completion
scripts inside the dev-container. As generating this script
depends on the docker binary, it calls "make binary" first.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-08 10:58:56 -05:00
Sebastiaan van Stijn 48b5efee03
Dockerfile: update mvdan/gofumpt to v0.6.0
- full diff: https://github.com/mvdan/gofumpt/compare/v0.4.0...v0.6.0
- v0.6.0 release notes: https://github.com/mvdan/gofumpt/releases/tag/v0.6.0
- v0.5.0 release notes: https://github.com/mvdan/gofumpt/releases/tag/v0.5.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-03-17 13:48:13 +01:00
Kevin Alvarez 79c9e527a3
docs: generate markdown
Keep frontmatter for docker, dockerd and index markdown files.
Also needs to move cli.md > docker.md before generation and
then move it back because cli.md is needed for yaml generation on docs
website: https://github.com/docker/cli/pull/3924#discussion_r1059986605

Signed-off-by: Kevin Alvarez <crazy-max@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-06 22:36:47 +01:00
Sebastiaan van Stijn c2f1671595
Use gofumpt if available, and enable gofumpt linter
gofumpt provides a supserset of gofmt / go fmt, but not every developer may have
it installed, so for situations where it's not available, fall back to gofmt.

As our code has been formatted with gofumpt already, in most cases contributions
will follow those formatting rules, but in some cases there may be a difference,
which would already be flagged by manual code review, but let's also enable the
gofumpt linter.

With this change, `make fmt` will use gofumpt is available; gofumpt has been
added to the dev-container, so `make -f docker.Makefile fmt` will always use it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-30 19:14:36 +02:00
Sebastiaan van Stijn 94e08f2e2d
Makefile: don't warn "outside container" for some targets
This change allows some make targets to be ran outside the dev-container for
easier discovery and use:

- `make clean` can be used on the host (as artifacts created from within the
  development container are usually stored on the host).
- `make help` was already allowed
- `make dev` and `make shell` are added to the regular Makefile, to make it
  easier to create and start the development container.
- When attempting to run `make dev` from within the development container, a
  message is printed, and the target is cancelled:

      root@docker-cli-dev$ make dev
      you are already in the dev container

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-06 19:10:53 +02:00
Sebastiaan van Stijn 258640ab49
Makefile: add missing help messages for some targets
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-06 18:34:51 +02:00
Sebastiaan van Stijn 4cd2d9ddd2
Change "COMPANY_NAME" to "PACKAGER_NAME"
The COMPANY_NAME currently sets the "CompanyName" field in the metadata
of Windows binaries. Our intent of this field is this field to contain
information about the company/party that produced the binary.

Also from [FileVersionInfo.CompanyName][FileVersionInfo.CompanyName]:

> Gets the name of the company that produced the file

Based on the above, "PACKAGER_NAME" is a bit more generic, and clearer
on intent, and we may at some point re-use this same information to
propagate equivalent fields on other platforms (rpms, debs)

[FileVersionInfo.CompanyName]: https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.fileversioninfo.companyname

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-27 10:09:50 +02:00
CrazyMax f160fd3e31
remove circleci
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-02-25 17:11:17 +01:00
CrazyMax 7dc35c03fc
validate manpages target
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-02-25 17:11:17 +01:00
CrazyMax a650f4ddd0
switch to cli-docs-tool for yaml docs generation
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
switch to cli-docs-tool and validate yamldocs

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-02-25 17:11:16 +01:00
CrazyMax 7e560ae76f
vendor with go mod
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-12-16 21:16:01 +01:00
CrazyMax 4d93717ae5
ci: github actions test workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-12-07 14:50:22 +01:00
CrazyMax 62ea2bf1aa
GitHub Actions e2e tests
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-11-17 17:18:25 +01:00
CrazyMax 75284bd1d1
Use goversioninfo to create Windows Version Info
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-11 16:54:22 +02:00
CrazyMax d9f4352c26
GitHub Actions cross
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-26 18:01:55 +02:00
Sebastiaan van Stijn 818564af51
cli/compose: use go1.16 native embed functionality for schemas
This allows us to drop the `//go:generate` and use of the github.com/mjibson/esc
utility.

worth noting that Go's native "embed" does not compress files. We could compress
these files as part of a build / validate step (which would add some complexity
when updating these files) if this is a concern, but not sure if the additional
complexity is warranted.

Comparing before/after sizes (see below);

    macOS: 54125840 - 54005264 = 120576 (+120.58 kB)
    Linux: 52393231 - 52277701 = 115530 (+115.53 kB)

Before:

    ls -l build/
    total 208736
    lrwxr-xr-x  1 sebastiaan  staff        19 Aug 15 09:36 docker@ -> docker-linux-amd64
    -rwxr-xr-x  1 sebastiaan  staff  54005264 Aug 15 09:35 docker-darwin-amd64*
    -rwxr-xr-x  1 sebastiaan  staff  52277701 Aug 15 09:36 docker-linux-amd64*

After:

    ls -l build/
    total 208960
    lrwxr-xr-x  1 sebastiaan  staff        18 Aug 15 09:32 docker@ -> docker-linux-amd64
    -rwxr-xr-x  1 sebastiaan  staff  54125840 Aug 15 09:31 docker-darwin-amd64*
    -rwxr-xr-x  1 sebastiaan  staff  52393231 Aug 15 09:32 docker-linux-amd64*

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-15 10:04:13 +02:00
CrazyMax 698c155478
GitHub Actions for lint
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-08-05 08:44:21 +02:00
Tonis Tiigi 706e857a90 remove unused targets
More can be removed/refactored but avoiding a huge change.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-04-06 00:21:10 -07:00
Madhur Batra 55451d3c75 Add checks for dependencies that are not vendored.
`make vendor` fails if any dependency is not vendored.

Signed-off-by: Madhur Batra <madhurbatra097@gmail.com>
2020-07-06 09:23:19 +00:00
Sebastiaan van Stijn 5bc1f24dfd
Add docker-compose schema v3.9
This is currently just a copy of the v3.8 schema, in preparation
of new features to be added in the new schema.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-30 10:58:05 +02:00
Ian Campbell e1a7b56308 Allow control over dirs passed to e2e and unit tests
Allows e.g.:

    $ make -f docker.Makefile TESTDIRS=./cli/command/trust/... test-unit

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-03-11 16:02:55 +00:00
Ian Campbell 023559b98c Allow flags to be passed to e2e and unit tests
This allows e.g.

    $ make -f docker.Makefile fmt test-e2e-non-experimental TESTFLAGS="-test.run TestRunGoodArgument|TestRunGood"

As well as adding the var to `$(ENVVARS)` we also need to use that when
invocking the e2e image, the existing `$(DOCKER_RUN)` is not used here because
the bind mounts differ. The other variables included in `$(ENVVARS)` are
harmless when running the e2e tests.

The `${TESTFLAGS}` envvar is already understood by `scripts/test/e2e/run`.

Note that since this modifies `$(ENVVARS)` this is now also available to the unit
test target too, so add the use to the invocation so it takes effect.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-03-11 15:59:27 +00:00
Silvin Lubecki 277f61415e Better coverage output, removing unnecessary unit scripts.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2019-02-01 11:16:20 +01:00
Ian Campbell e96240427f Add basic framework for writing a CLI plugin
That is, the helper to be used from the plugin's `main`.

Also add a `helloworld` plugin example and build integration.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-29 11:26:40 +00:00
Sebastiaan van Stijn cbb699ab9c
Makefile: make help: fix newline wrapping, and missing targets
This patch adds support for multiple newlines and removes the 1-space
indentation of wrapped lines.

Given these targets:

```Makefile
.PHONY: foobar
foobar: ## runs the foobar lorum ipsum.\nand so pn\nand so on
	echo foobar
```

Before this change, the output of `make help` was

```
foobar               runs the foobar lorum ipsum.
                      and so pn\nand so on
```

After this change, the output is:

```
foobar               runs the foobar lorum ipsum.
                     and so pn
                     and so on
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-10 13:30:03 +01:00
Sebastiaan van Stijn 5ab93bc8ef
Fix some missing targets in "make help"
The `make help` output was missing some targets (`fmt`, `test-unit`,
`test-e2e`).

Note that some targets are still hidden (`test-e2e-experimental`,
`test-e2e-non-experimental`, `test-e2e-connhelper-ssh`) as they're likely not
usually run separate from `test-e2e`.

Before this patch:

    make -f docker.Makefile help

    binary               build the CLI
    build                alias for binary
    clean                clean build artifacts
    cross                build the CLI for macOS and Windows
    binary-windows       build the CLI for Windows
    binary-osx           build the CLI for macOS
    dev                  start a build container in interactive mode for in-container development
    shell                alias for dev
    lint                 run linters
    vendor               download dependencies (vendor/) listed in vendor.conf
    dynbinary            build the CLI dynamically linked
    authors              generate AUTHORS file from git history
    manpages             generate man pages from go source and markdown
    yamldocs             generate documentation YAML files consumed by docs repo
    shellcheck           run shellcheck validation
    help                 print this help

With this patch applied:

    make -f docker.Makefile help

    binary               build the CLI
    build                alias for binary
    clean                clean build artifacts
    test-unit            run unit tests (using go test)
    cross                build the CLI for macOS and Windows
    binary-windows       build the CLI for Windows
    binary-osx           build the CLI for macOS
    dev                  start a build container in interactive mode for in-container development
    shell                alias for dev
    lint                 run linters
    fmt                  run gofmt
    vendor               download dependencies (vendor/) listed in vendor.conf
    dynbinary            build the CLI dynamically linked
    authors              generate AUTHORS file from git history
    manpages             generate man pages from go source and markdown
    yamldocs             generate documentation YAML files consumed by docs repo
    shellcheck           run shellcheck validation
    test-e2e             run all e2e tests
    help                 print this help

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-10 13:27:20 +01:00
Ian Campbell 7c8ee78eaf build: Add a `fmt` target which runs `gofmt` on all files.
Signed-off-by: Ian Campbell <ijc@docker.com>
2018-12-10 13:19:41 +00:00
Daniel Hiltgen b7ec4a42d9 Review comments
Address code review comemnts and purge additional dead code.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
(cherry picked from commit f250152bf4)
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-09-21 15:43:00 -07:00
Daniel Hiltgen fd2f1b3b66 Add engine commands built on containerd
This new collection of commands supports initializing a local
engine using containerd, updating that engine, and activating
the EE product

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2018-08-20 09:42:05 -07:00
Marco Vedovati 760ca04709 Add `help` and remove `watch` targets in docker.Makefile
* Add the `help` target to document make targets when building using a
container
* Remove the `watch` target (filewatcher was removed with c0588a9c) from
docker.Makefile and Makefile

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2018-07-31 14:38:51 +02:00
Daniel Nephin a6dedd1a12 Fix vendor validation
vendor/ must be removed first, otherwise files added to vendor/ but not vendor.conf
will not cause the validation to fail

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-02-02 11:01:05 -08:00
Sebastiaan van Stijn 02e7b18fde
Add AUTHORS file and script
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-01-02 17:00:22 +01:00
Eli Uriegas 51080d6148 Add a way to just build windows and osx
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-09-19 16:48:31 -07:00
Eli Uriegas d53c8de06b Re-adds test target to the Makefile
The test target existed before, this is to provide a legacy interface to
allow easy testing for downstream Docker CE.

Without this we would need separate Makefiles/Jenkinsfiles for releases
past 17.07. Later on this target could also be used to test both unit
tests and integration tests at the same time.

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-08-31 10:32:00 -07:00
Daniel Nephin 26418a12fb Add scripts for setting up e2e test environment.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 10:35:56 -04:00
Daniel Nephin 058733969c Set DISABLE_WARN_OUTSIDE_CONTAINER in the Dockerfile so that we don't spend 10s sleeping in CI
also add time to validate check

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-15 14:34:43 -04:00
Daniel Nephin 12a7387c8e Add a warning when make is run outside of a container.
The warning can be disabled by setting the environment variable

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-26 15:58:15 -04:00
Jean-Pierre Huynh 649a5864f3 Update README and add help target to make
Signed-off-by: Jean-Pierre Huynh <jean-pierre.huynh@ounet.fr>
2017-07-21 16:57:06 +01:00
Jean-Pierre Huynh b2fc35aefa Add shellcheck for bash completion
Signed-off-by: Jean-Pierre Huynh <jean-pierre.huynh@ounet.fr>
2017-07-13 22:24:08 +01:00
Tibor Vass dc81def89c fix manpages script
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-06-06 05:00:10 +00:00
Tibor Vass ff615dbc4d Add scripts and targets for manpages and yamldocs
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-06-05 19:10:44 +00:00
Daniel Nephin f6d148c632 Upload coverage report from outside of test container.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-19 17:37:38 -04:00
Vincent Demeester d79d903864 Add test-coverage & codecov target and update circleci
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-19 17:22:37 -04:00
Daniel Nephin 73ebb07df5 Remove @ from Makefiles.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-17 15:56:19 -04:00
John Stephens b28c4822cc Merge pull request #90 from dnephin/add-windows-autogen
Add windows resources to binary
2017-05-17 11:59:54 -07:00
Daniel Nephin 8a6ad48d2b Add windows resources to binary.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 18:03:03 -04:00
Daniel Nephin 74c06a140b Support running unit tests when files are saved.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 17:02:58 -04:00
Daniel Nephin 60b2dd3e23 Update the README
Remove referenced to developing on the host, we shouldn't support it.

Move script/validate to scripts/validate to be consistent.
Set the default target to be binary instead of clean.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-15 14:07:30 -04:00
Daniel Nephin a787cbc93b Support building a dynbinary
Cleanup dynbinary and binary builds

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-12 13:34:06 -04:00
Daniel Nephin bcc46e75ab Merge pull request #56 from dnephin/add-compose-bindata-check
Add CI validation for compose bindata
2017-05-10 15:49:06 -04:00