summaryrefslogtreecommitdiff
path: root/hack/validate
Commit message (Collapse)AuthorAgeFilesLines
* added alias validationJeyanthinath Muthuram2023-05-081-0/+2
| | | | Signed-off-by: Jeyanthinath Muthuram <jeyanthinath10@gmail.com>
* golangci-lint: enable importas linter to force consistent aliasesSebastiaan van Stijn2023-04-081-0/+11
| | | | | | | | | | | | This enforces the github.com/containerd/containerd/errdefs package to be aliased as "cerrdefs". Any other alias (or no alias used) results in a linting failure: integration/container/pause_test.go:9:2: import "github.com/containerd/containerd/errdefs" imported as "c8derrdefs" but must be "cerrdefs" according to config (importas) c8derrdefs "github.com/containerd/containerd/errdefs" ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* hack: introduce validate/no-moduleBjorn Neergaard2022-12-121-0/+17
| | | | | | | | | | | | Moby is not a Go module; to prevent anyone from mistakenly trying to convert it to one before we are ready, introduce a check (usable in CI and locally) for a go.mod file. This is preferable to trying to .gitignore the file as we can ensure that a mistakenly created go.mod is surfaced by Git-based tooling and is less likely to surprise a contributor. Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
* hack/validate/vendor: clean up license validation stepBjorn Neergaard2022-11-181-9/+10
| | | | Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
* hack/validate/vendor: split tidy from vendorBjorn Neergaard2022-11-181-31/+32
| | | | Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
* hack/validate: drop changelog-related stepsBjorn Neergaard2022-11-153-39/+0
| | | | Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
* Merge pull request #44296 from corhere/narrow-pkg-imports-validatorCory Snider2022-10-141-1/+6
|\ | | | | hack: allow pkg/ to import internal/ packages
| * hack: allow pkg/ to import internal/ packagesCory Snider2022-10-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | The pkg-imports validation prevents reusable library packages from depending on the whole daemon, accidentally or intentionally. The allowlist is overly restrictive as it also prevents us from reusing code in both pkg/ and daemon/ unless that code is also made into a reusable library package under pkg/. Allow pkg/ packages to import internal/ packages which do not transitively depend on disallowed packages. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | remove aliases for deprecated pkg/urlutilSebastiaan van Stijn2022-10-061-6/+0
|/ | | | | | | The aliases are included in the 22 release branch, so we can remove them from master. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #44129 from thaJeztah/enable_deprecated_checkSebastiaan van Stijn2022-09-271-1/+1
|\ | | | | Revert "validation: temporarily allows changes in integration-cli"
| * Revert "validation: temporarily allows changes in integration-cli"Sebastiaan van Stijn2022-09-101-1/+1
| | | | | | | | | | | | This reverts commit 7ed823ead91938e5cc8de7a42ff93a25abe73e7e. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | golangci-lint: update to v1.49.0Sebastiaan van Stijn2022-09-231-16/+5
|/ | | | | | | | | | | | Remove the "deadcode", "structcheck", and "varcheck" linters, as they are deprecated: WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validate: address SC2155 (shellcheck)Sebastiaan van Stijn2022-08-299-9/+9
| | | | | | | | | see https://github.com/koalaman/shellcheck/wiki/SC2155 Looking at how these were used, I don't think we even need to export them, so removing that. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validate: format vendor script with shfmtSebastiaan van Stijn2022-08-291-10/+10
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validate: add yamllint validationSebastiaan van Stijn2022-08-292-0/+30
| | | | | | | | | | | | | | | | validate other YAML files, such as the ones used in the documentation, and GitHub actions workflows, to prevent issues such as; - 30295c1750714d26f3c8fc9c3451f11ac351f2be - 8e8d9a36500fb07fa9d1b68539756b9a93d3509e With this patch: hack/validate/yamllint Congratulations! yamllint config file formatted correctly Congratulations! YAML files are formatted correctly Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validate: yamllint: ignore "truthy value should be one of" warningsSebastiaan van Stijn2022-08-291-0/+5
| | | | | | | | | | Suppresses warnings like: LANG=C.UTF-8 yamllint -c hack/validate/yamllint.yaml -f parsable .github/workflows/*.yml .github/workflows/ci.yml:7:1: [warning] truthy value should be one of [false, true] (truthy) .github/workflows/windows.yml:7:1: [warning] truthy value should be one of [false, true] (truthy) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validate: yamllint: set locale in config fileSebastiaan van Stijn2022-08-292-1/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validate: yamllint: use "parsable" outputSebastiaan van Stijn2022-08-291-1/+1
| | | | | | | | | | | | Before: 10030:81 error line too long (89 > 80 characters) (line-length) After: api/swagger.yaml:10030:81: [error] line too long (89 > 80 characters) (line-length) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validate: yamllint rename config-fileSebastiaan van Stijn2022-08-292-1/+1
| | | | | | | Don't make the file hidden, and add .yaml extension, so that editors pick up the right formatting :) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* logger/journald: remove journald_compat (for systemd < 209)Sebastiaan van Stijn2022-07-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was added in 6cdc4ba6cd5178037466c50ebe03a7eb111c43b1 in 2016, likely because at the time we were still building for CentOS 6 and Ubuntu 14.04. All currently supported distros appear to be on _at least_ 219 now, so it looks safe to remove this; ```bash docker run -it --rm centos:7 yum install -y systemd-devel pkg-config 'libsystemd >= 209' && echo "OK" || echo "KO" OK pkg-config --print-provides 'libsystemd' libsystemd = 219 pkg-config --print-provides 'libsystemd-journal' libsystemd-journal = 219 ``` And on a `debian:buster` (old stable) ```bash docker run -it --rm debian:buster apt-get update && apt-get install -y libsystemd-dev pkg-config pkg-config 'libsystemd >= 209' && echo "OK" || echo "KO" OK pkg-config --print-provides 'libsystemd' libsystemd = 241 pkg-config --print-provides 'libsystemd-journal' Package libsystemd-journal was not found in the pkg-config search path. Perhaps you should add the directory containing `libsystemd-journal.pc' to the PKG_CONFIG_PATH environment variable No package 'libsystemd-journal' found ``` OpenSUSE leap (I think that's built for s390x) ```bash docker run -it --rm docker.io/opensuse/leap:15 zypper install -y systemd-devel pkg-config 'libsystemd >= 209' && echo "OK" || echo "KO" OK pkg-config --print-provides 'libsystemd' libsystemd = 246 pkg-config --print-provides 'libsystemd-journal' Package libsystemd-journal was not found in the pkg-config search path. Perhaps you should add the directory containing `libsystemd-journal.pc' to the PKG_CONFIG_PATH environment variable No package 'libsystemd-journal' found ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* replace golint with revive, as it's deprecatedSebastiaan van Stijn2022-07-041-6/+2
| | | | | | WARN [runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Dockerfile: update golangci-lint to v1.46.2Sebastiaan van Stijn2022-07-041-2/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validation: temporarily allows changes in integration-cliCrazyMax2022-06-171-1/+1
| | | | Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
* pkg/urlutil: deprecate, and move to builder/remotecontext/urlutilSebastiaan van Stijn2022-04-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | pkg/urlutil (despite its poorly chosen name) is not really intended as a generic utility to handle URLs, and should only be used by the builder to handle (remote) build contexts. - IsURL() only does a very rudimentary check for http(s):// prefixes, without any other validation, but due to its name may give incorrect expectations. - IsGitURL() is written specifically with docker build remote git contexts in mind, and has handling for backward-compatibility, where strings that are not URLs, but start with "github.com/" are accepted. Because of the above, this patch: - moves the package inside builder/remotecontext, close to where it's intended to be used (ideally this would be part of build/remotecontext itself, but this package imports many other dependencies, which would introduce those as extra dependencies in the CLI). - deprecates pkg/urlutil, but adds aliases as there are some external consumers. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Dockerfile: update golangci-lint v1.44.0Sebastiaan van Stijn2022-02-081-15/+32
| | | | | | | | | Looks like this may be needed for Go 1.18 Also updating the golangci-lint configuration to account for updated exclusion rules. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* hack/vendor.sh: run "go mod tidy" before vendoringSebastiaan van Stijn2022-02-051-6/+0
| | | | | | | | | | | | | | | | | | The hack/vendor.sh script is used to (re)vendor dependencies. However, it did not run `go mod tidy` before doing so, wheras the vendor _validation_ script did. This could result in vendor validation failing if go mod tidy resulted in changes (which could be in `vendor.sum`). In "usual" situations, this could be easily done by the user (`go mod tidy` before running `go mod vendor`), but due to our (curent) uses of `vendor.mod`, and having to first set up a (dummy) `go.mod`, this is more complicated. Instead, just make the script do this, so that `hack/vendor.sh` will always produce the expected result. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* vendor: replace vndr with `go mod vendor`Ilya Dmitrichenko2022-01-181-7/+12
| | | | | | | | | | | - use `vendor.mod` instead of `go.mod` to avoid issues to do with use of CalVer, not SemVer - ensure most of the dependency versions do not change - only zookeeper client has to change (via docker/libkv#218) as previously used version is no longer maintained and has missing dependencies Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* hack: remove a workaround for go-toolsKazuyoshi Kato2021-12-271-5/+0
| | | | | | The false positive has been fixed. Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
* hack: do not exclude SQL-related checksKazuyoshi Kato2021-12-271-3/+0
| | | | | | moby doesn't have SQLs right now. Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
* hack: remove non-existent directories from golangci-lint's skip-dirsKazuyoshi Kato2021-12-271-3/+0
| | | | Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
* hack: use golangci-lint to find io/ioutilKazuyoshi Kato2021-12-231-1/+8
| | | | | | The package has been deprecated since Go 1.16. Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
* Fix up vndr toolingKevin Parsons2021-07-131-1/+1
| | | | | | | | | - Fix the error message in hack/validate/vendor to specify that hack/vendor.sh should be run instead of vndr. - Fix hack/vendor.sh to also match on Windows paths for the whitelist. This allows the script to be run on Windows via Git Bash. Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
* golangci.yml: do not limit max reported issuesSebastiaan van Stijn2021-06-101-0/+6
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* golangci.yml: skip some testsSebastiaan van Stijn2021-06-101-1/+10
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* golangci.yml: update regex for ignoring SA1019Sebastiaan van Stijn2021-06-101-2/+2
| | | | | | | | | | | | | | | | The message changed from "is deprecated" to "has been deprecated": client/hijack.go:85:16: SA1019: httputil.NewClientConn has been deprecated since Go 1.0: Use the Client or Transport in package net/http instead. (staticcheck) clientconn := httputil.NewClientConn(conn, nil) ^ integration/plugin/authz/authz_plugin_test.go:180:7: SA1019: httputil.NewClientConn has been deprecated since Go 1.0: Use the Client or Transport in package net/http instead. (staticcheck) c := httputil.NewClientConn(conn, nil) ^ integration/plugin/authz/authz_plugin_test.go:479:12: SA1019: httputil.NewClientConn has been deprecated since Go 1.0: Use the Client or Transport in package net/http instead. (staticcheck) client := httputil.NewClientConn(conn, nil) ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Fixup libnetwork lint errorsBrian Goff2021-06-012-1/+21
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* hack/vendor: add check for vendored archive/tarmoby2021-05-201-1/+2
| | | | | | Also allow re-vendoring using `./hack/vendor.sh archive/tar` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* hack/validate: skip DCO in "default"Sebastiaan van Stijn2021-05-171-1/+2
| | | | | | | | | | We perform a DCO check before we run all other tests, so we can skip it as part of the validate step. Leaving the line in for visibility, and in case we switch from Jenkins to (e.g.) GitHub actions. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* validate/toml: switch to github.com/pelletier/go-tomlSebastiaan van Stijn2021-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The github.com/BurntSushi/toml project is no longer maintained, and containerd is switching to this project instead, so start moving our code as well. This patch only changes the binary used during validation (tbh, we could probably remove this validation step, but leaving that for now). I manually verified that the hack/verify/toml still works by adding a commit that makes the MAINTAINERS file invalid; diff --git a/MAINTAINERS b/MAINTAINERS index b739e7e20c..81ababd8de 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23,7 +23,7 @@ # a subsystem, they are responsible for doing so and holding the # subsystem maintainers accountable. If ownership is unclear, they are the de facto owners. - people = [ + people = "akihirosuda", "anusha", "coolljt0725", Running `hack/verify/toml` was able to detect the broken format; hack/validate/toml (27, 4): keys cannot contain , characterThese files are not valid TOML: - MAINTAINERS Please reformat the above files as valid TOML Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* vendor: add local copy of archive/tarTonis Tiigi2020-04-241-1/+1
| | | | | | | | | This version avoids doing name lookups on creating tarball that should be avoided in to not hit loading glibc shared libraries. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> (cherry picked from commit aa6a9891b09cce3d9004121294301a30d45d998d) Signed-off-by: Tibor Vass <tibor@docker.com>
* run shfmtAkihiro Suda2020-03-0310-28/+28
| | | | | | git grep --name-only '^#!' | egrep -v '(vendor|\.go|Jenkinsfile)' | xargs shfmt -w -bn -ci -sr Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
* validate: add shfmtAkihiro Suda2020-03-032-0/+14
| | | | Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
* Vendor check to succeed even if copyright information is not foundChris Price2020-02-131-2/+1
| | | | | | | | | | | The documentation for validate_vendor_used in hack/validate/vendor states that a warning will be emitted if license information cannot be found in a vendored package. However, because the script is run with pipefail set (owing to the inclusion of the common validation script .validate) and `grep -c` is used, the entire script will fail whenever license information cannot be found in a vendored package. Signed-off-by: Chris Price <cprice@mirantis.com>
* hack/validate/deprecate-integration-cli: add integration-cli/*_api_*.goSebastiaan van Stijn2019-12-191-1/+1
| | | | | | | | | The intent of this check is to not add integration tests that use the CLI to test API functionality, so check for changes in "API" tests as well, now that the `integration/` suite has matured enough to develop new tests, or migrate existing ones. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* hack/validate: clean-up output, move golang-ci-lint to endSebastiaan van Stijn2019-12-198-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The golang-ci-lint takes longest to run, so do the other checks first; this also makes the output a bit more readable. While at it, fix some consistency issues in the output of the other checks. Before this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Congratulations! "./pkg/..." is safely isolated from internal code. The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All api changes are done the right way. Congratulations! All toml source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. After this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. Congratulations! Packages in "./pkg/..." are safely isolated from internal code. Congratulations! The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All API changes are done the right way. Congratulations! All TOML source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. Congratulations! No new tests were added to integration-cli. INFO Start validation with golang-ci-lint INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* hack/validate: allow forcing validationSebastiaan van Stijn2019-12-194-6/+6
| | | | | | | 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>
* hack/validate/deprecate-integration-cli: don't exit on successSebastiaan van Stijn2019-12-191-12/+12
| | | | | | | | The `hack/validate/deprecate-integration-cli` script exited on success. As a result, validation steps to run afterwards would not be executed. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* hack/validate/default: fix minor linting issueSebastiaan van Stijn2019-12-191-10/+10
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Revert "hack: temporarily disable deprecate-integration-cli"Sebastiaan van Stijn2019-12-191-1/+1
| | | | | | This reverts commit 5f67568bfd08a10f51a819cae8696f591881f26b. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #40074 from yedamao/fix-integration-cliAkihiro Suda2019-12-191-4/+0
|\ | | | | integration-cli: Fix `SA1019: httputil.ClientConn is deprecated`