Commit Graph

104 Commits

Author SHA1 Message Date
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 bea6c0d242
validate authors target
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-02-25 17:03:25 +01:00
Sebastiaan van Stijn 242857dd81
update/remove various tests and options related to kubernetes support
Remove various tests and utilities related to testing kubernetes support

Also removing the Kubernetes and DefaultStackOrchestrator from CreateOptions
and UpdateOptions, instead updating the flags to not be bound to a variable.

This might break some consumers of those options, but given that they've become
non-functional, that's probably ok (otherwise they may ignore the deprecation
warning and end up with non-functional code).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-24 17:53:18 +01:00
Sebastiaan van Stijn 5c4a395c52
scripts/vendor: run go mod tidy when vendoring
There was some debate about this, and wether or not tidy should be run
when vendoring, but without this, validation failed after running
`make vendor`, and manually doing a `go mod tidy` is complicated
(due to the `vendor.mod`, and because the cache is not inside the
build-cache, not on the host).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-28 11:35:36 +01:00
Sebastiaan van Stijn a4787cfc27
Merge pull request #3387 from crazy-max/vendor-gomod
vendor with go mod
2022-01-13 15:00:26 +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 5fab1b2b10
ensure version quad for goversioninfo
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-12-10 10:50:23 +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 dbac826815
Fix checkout behavior and FileVersion
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-12 10:48:31 +02: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
Silvin Lubecki aa949f2ad5
Merge pull request #3211 from crazy-max/gha
GitHub Actions for lint
2021-08-05 14:11:23 +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
Sebastiaan van Stijn c509ef7104
yamldocs: various improvements
- make sure the target directory is created if missing
- add support for custom ID's in headings through `<a>` tags (e.g.
  `<a name=heading2></a>`). This allows use of custom anchors that
  work both on GitHub (GFM doesn't support extended MarkDown), and
  in Jekyll (which does).
- add code to cleanup markdown for use in our docs:
    - remove absolute URLs to https://docs.docker.com
    - remove tabs in MarkDown, and convert them to 4 spaces. This
      prevents the YAML conversion from switching between "short"
      and "long" syntax. Tabs in code examples also don't always
      work well, so using spaces doesn't hurt for that.
- refactor some code for readability, and to be less "hacky" (still
  lots to be improved though)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-30 20:43:22 +02:00
Sebastiaan van Stijn a477a727fc
Update to go1.16.6
Keeping the dockerfiles/Dockerfile.cross image at 1.13, as we don't
have more current versions of that image. However, I don't think it's
still used, so we should remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-29 11:52:02 +02:00
Brian Goff 43dc024002
Merge pull request #2855 from Foxboron/morten/reprobuilds 2021-07-23 09:41:51 -07:00
Brian Goff 83e9eeb8a0 scripts: Allow skipping windres when WINDRES= (empty string)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
2021-04-13 21:29:54 +00:00
Tibor Vass 2c40960ba1 scripts: use WINDRES env var if set
This allows setting WINDRES to mingw's windres.

For the record, mingw's windres needs --use-temp-file for a weird reason:
in that case, it keeps preprocessor arguments intact (including quotes),
without it, mingw's windres calls popen, which happens to pass the entire
command to sh -c, stripping quotes after evaluation and causing a syntax
error in mingw's windres.

To use mingw's windres, set WINDRES to:
- `x86_64-w64-mingw32-windres` on 64 bit
- `i686-w64-mingw32-windres` on 32 bit

Signed-off-by: Tibor Vass <tibor@docker.com>
2021-04-13 16:55:00 +00:00
Tibor Vass 6e45f4bfe2 scripts: fix VERSION_QUAD corner case in windows resource
When the git checkout is dirty on top of a git tag (i.e., v20.10.6.m),
the VERSION_QUAD was keeping a trailing comma.
Now the trailing comma is stripped.

Signed-off-by: Tibor Vass <tibor@docker.com>
2021-04-13 16:52:53 +00:00
Tonis Tiigi 26b633d37b set default version from git
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-04-06 00:21:10 -07:00
Tonis Tiigi 8b822c9219 update windows resources generation
New solution is not hardcoded to amd64 but integrates
with the cross toolchain and support creating arm binaries.

Go has been updated so that ASLR works

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-04-06 00:20:59 -07:00
Tonis Tiigi 6423da8dcd dockerfile based binary building
Using cross compilation toolchains that work from any platform
Adds darwin/arm64 support and bake targets. Static and dynamic
binary targets are available, both with glibc and musl.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-04-06 00:20:21 -07:00
Arnaud Rebillout 6e2607c6a6 Rename bin/md2man to bin/go-md2man
In the recent PR !2877, some code was added to check if md2man is
already installed in the build environment. This is to cater to the
needs of Linux distributions.

However it turns out that Linux distributions install md2man as
bin/go-md2man instead of bin/md2man, hence the PR !2877 doesn't help
much.

This commit fixes it by settling on using the binary name go-md2man.

For reference, here the file list of the package go-md2man in several
distributions:

- Debian: <https://packages.debian.org/sid/amd64/go-md2man/filelist>
- Ubuntu: <https://packages.ubuntu.com/hirsute/amd64/go-md2man/filelist>
- Fedora: <https://fedora.pkgs.org/31/fedora-x86_64/golang-github-cpuguy83-md2man-2.0.0-0.4.20190624gitf79a8a8.fc31.x86_64.rpm.html>
- ArchLinux: <https://www.archlinux.org/packages/community/x86_64/go-md2man/>

Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
2020-12-16 10:20:00 +07:00
Morten Linderud 29bd82ba14
generate-man.sh: Only build md2man if it's not installed
Distributions uses generate-man.sh to create man pages, however it only
assumes a container environment and attempts to build binaries towards
`/go` which might be an illegal path in `fakeroot`.

This patch ensures we only build `md2man` from the vendored sources if
the command is not present. This allows distributions to supply thier
packaged `md2man`.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2020-12-09 23:06:18 +01:00
Morten Linderud 9d40c7464e
scripts/build/.variables: Support SOURCE_DATE_EPOCH
Repeated builds of docker is currently unreproducible as the embedded
time does not support SOURCE_DATE_EPOCH. This patch ensures we check for
the defined variable before utilizing current date.

This has been fixed previously with manpages as well

2d7091aaeb

Signed-off-by: Morten Linderud <morten@linderud.pw>
2020-11-29 16:07:46 +01:00
Sebastiaan van Stijn 43bc718895
Dockerfiles: update shellcheck v0.7.1
full diff: https://github.com/koalaman/shellcheck/compare/v0.7.0...v0.7.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-20 15:46:07 +02:00
Paul Mulders 05eebb8ccf scripts/make.ps1: actually define the CommitSuffix parameter
Signed-off-by: Paul Mulders <justinkb@gmail.com>
2020-07-10 14:36:22 +02: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
Xiaodong Liu eeafa40154 -buildmode=pie is not supported for the mips arch
reference: 4c99c81326

Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
2020-05-12 09:14:36 +08:00
Sebastiaan van Stijn df5cedfc81
vendor: spf13/cobra v1.0.0, go-md2man v2.0.0, blackfriday v2.0.1
full diff: https://github.com/spf13/cobra/compare/v0.0.3...v1.0.0

Notable Changes

- Fish completion (including support for Go custom completion)
- API (urgent): Rename BashCompDirectives to ShellCompDirectives
- Remove/replace SetOutput on Command - deprecated
- Custom completions coded in Go (instead of Bash)
- Partial Revert of 922
- Correct documentation for InOrStdin
- Apply formatting to templates
- Revert change so help is printed on stdout again
- Update md2man to v2.0.0
- update viper to v1.4.0
- Update cmd/root.go example in README.md

vendor: update cpuguy83/go-md2man v2.0.0

full diff: https://github.com/cpuguy83/go-md2man/compare/v1.0.8...v2.0.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-04 17:00:46 +02:00
Sebastiaan van Stijn 7d407207c3
Merge pull request #2362 from silvin-lubecki/fix-windows-exentension
Add an exe extension to windows binary during cross build.
2020-03-03 17:22:55 +01:00
Stefan Scherer b1fd38fa77
Update Windows ico
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2020-03-02 13:02:29 +01:00
Silvin Lubecki 40aa020534 Add an exe extension to windows binary during cross build.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2020-02-27 15:34:23 +01:00
Sebastiaan van Stijn d443b74091
Merge pull request #1856 from arthrp/master
Forcing the creation of tmp directory
2020-01-20 14:04:39 +01:00
Sebastiaan van Stijn ef37a8a57c
Fix "make build" (non-containerized) on macOS
macOS doesn't ship with the GNU version of `date`, which
causes the command to fail if the `--rfc-3339 ns` format option
is used.

Given that we don't need the build-time with nanosecond precision,
this patch changes the format used, so that the CLI binary can be
built on the host (outside of a container);

Before this change, `make binary` would fail:

    DISABLE_WARN_OUTSIDE_CONTAINER=1 make binary
    WARNING: binary creates a Linux executable. Use cross for macOS or Windows.
    ./scripts/build/binary
    make: *** [binary] Error 1

With this change, the binary can be built on the host:

    DISABLE_WARN_OUTSIDE_CONTAINER=1 make binary
    WARNING: binary creates a Linux executable. Use cross for macOS or Windows.
    ./scripts/build/binary
    Building statically linked build/docker-darwin-amd64

While the previous version formatted (and parsed) the date with nanoseconds precision,
that level of precision is not actually used;

```go
func reformatDate(buildTime string) string {
	t, errTime := time.Parse(time.RFC3339Nano, buildTime)
	if errTime == nil {
		return t.Format(time.ANSIC)
	}
	return buildTime
}
```

Both the old, and new input will yield the same output:

```go
fmt.Println(reformatDate("2019-12-31T13:41:44.846741804+00:00"))
// Tue Dec 31 13:41:44 2019

fmt.Println(reformatDate("2019-12-31T13:41:44Z"))
// Tue Dec 31 13:41:44 2019
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-12-31 15:06:11 +01:00
Arthur e5c86dbcf3 Forcing the creation of tmp directory so that build doesn't fail when it already exists
Signed-off-by: Arthur Peka <arthur.peka@outlook.com>
2019-05-12 21:09:07 +03:00
Brian Goff 15130e3043 Support GOARM and windows .exe in binary target
This just makes it easier to build a targeted binary for the
goos/goach/goarm version.

This of course will not work for all cases but is nice to get things
going.
Specifically cross-compiling pkcs for yubikey support requires some
extra work whichis not tackled here.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2019-05-06 10:43:18 -07:00
Tibor Vass 086df60bab
Merge pull request #1692 from thaJeztah/remove_bashisms
Remove some bashisms
2019-03-21 16:17:49 -07:00
Stefan Scherer 69754ea952
Fix Windows LDFLAGS to use cli version package
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2019-03-20 15:33:17 -07:00
Sebastiaan van Stijn 6d59892b66
Merge pull request #1704 from ijc/allow-passing-args-to-e2e-tests
Allow flags to be passed to e2e tests
2019-03-19 13:37:28 +01:00
Silvin Lubecki 651ccc0711
Merge pull request #1713 from thaJeztah/fix_plugin_test
Fix: plugin-tests discarding current environment
2019-03-14 16:22:05 +01: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
Sebastiaan van Stijn 6c4fbb7738
Fix: plugin-tests discarding current environment
By default, exec uses the environment of the current process, however,
if `exec.Env` is not `nil`, the environment is discarded:

e73f489494/src/os/exec/exec.go (L57-L60)

> If Env is nil, the new process uses the current process's environment.

When adding a new environment variable, prepend the current environment,
to make sure it is not discarded.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-04 20:18:24 +01:00
Sebastiaan van Stijn 5aeb7a0f55
Remove some bashisms
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-26 15:31:12 +01:00
Sebastiaan van Stijn ff107b313a
Update to shellcheck v0.6.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-26 15:12:52 +01:00
Sebastiaan van Stijn 388646eab0
Use official shellcheck image
This patch switches the shellcheck image to use the official image
from Docker Hub.

Note that this does not yet update shellcheck to the latest version (v0.5.x);
Shellcheck v0.4.7 added some new checks, which makes CI currently fail, so will
be done in a follow-up PR. Instead, the v0.4.6 version is used in this PR, which
is closest to the same version as was installed in the image before this change;

```
docker run --rm docker-cli-shell-validate shellcheck --version
ShellCheck - shell script analysis tool
version: 0.4.4
license: GNU General Public License, version 3
website: http://www.shellcheck.net
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-26 15:10:38 +01: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
Silvin Lubecki 3bd3996f72 Use gotest.tools/gotestsum binary to run unit and e2e tests and simplify the output.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2019-02-01 11:16:20 +01:00
Ian Campbell 5db336798c Add some simple e2e tests for executing CLI plugins
To help with this add a bad plugin which produces invalid metadata and arrange
for it to be built in the e2e container.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-01-30 13:44:05 +00: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