diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index d4217e0c..9d6ad7cd 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -26,7 +26,7 @@ jobs: go-version-file: ${{ matrix.directory }}/go.mod - name: Install linter - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0 + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.1 - name: Lint working-directory: ${{ matrix.directory }} run: make lint diff --git a/.golangci.yaml b/.golangci.yaml index 576feff2..80bff1e0 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -24,11 +24,9 @@ linters: disable-all: true enable: # Default linters. - - deadcode - ineffassign - - structcheck - typecheck - - varcheck + - unused # Extra linters. - asciicheck @@ -41,3 +39,13 @@ linters: - gocritic - gofumpt - misspell + - nolintlint + +issues: + # Show all errors. + max-issues-per-linter: 0 + max-same-issues: 0 + + exclude: + # TODO use %w in the future. + - "non-wrapping format verb for fmt.Errorf" # errorlint diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..1c7f6fc8 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +docs/.helm +docs/_data/sidebars +werf.yaml +docs/_data/breadcrumbs.yml \ No newline at end of file diff --git a/Taskfile.dist.yaml b/Taskfile.dist.yaml index 10b1ca60..789d472c 100644 --- a/Taskfile.dist.yaml +++ b/Taskfile.dist.yaml @@ -2,6 +2,14 @@ version: "3" silent: true +vars: + version: "0.0.0" + os: "{{OS}}" + arch: '{{ternary "arm64" ARCH (eq ARCH "arm")}}' + mode: '{{ternary "cgo" "go" (eq .os "linux")}}' + cgoTags: "dfrunsecurity dfrunnetwork dfrunmount dfssh containers_image_openpgp osusergo exclude_graphdriver_devicemapper netgo no_devmapper static_build cni" + goTags: "dfrunsecurity dfrunnetwork dfrunmount dfssh containers_image_openpgp" + tasks: sign: desc: 'Sign last version tag + origin/main and push signatures. Important vars: "refs".' @@ -15,3 +23,53 @@ tasks: git signatures show {{.CLI_ARGS}} $ref done - git signatures push {{.CLI_ARGS}} + lint: + desc: 'Run all linters in parallel. Important vars: "paths".' + deps: + - lint:golangci-lint + + lint:golangci-lint:cgo: + desc: 'Lint with golangci-lint for cgo. Important vars: "paths".' + cmds: + - golangci-lint run --build-tags="{{.cgoTags}}" {{.CLI_ARGS}} {{.paths | default "./..."}} + env: + CGO_ENABLED: "1" + + lint:golangci-lint:go: + desc: 'Lint with golangci-lint without cgo. Important vars: "paths".' + cmds: + - golangci-lint run --build-tags="{{.goTags}}" {{.CLI_ARGS}} {{.paths | default "./..."}} + env: + CGO_ENABLED: "0" + + _lint:golangci-lint:cgo-and-go: + cmds: + - task: lint:golangci-lint:cgo + vars: + paths: "{{.paths}}" + - task: lint:golangci-lint:go + vars: + paths: "{{.paths}}" + + _lint:golangci-lint:go: + deps: + - task: lint:golangci-lint:go + vars: + paths: "{{.paths}}" + + lint:golangci-lint: + desc: 'Lint with golangci-lint (with and without cgo). Important vars: "paths".' + deps: + - task: _lint:golangci-lint:{{ternary "cgo-and-go" "go" (eq .mode "cgo")}} + vars: + paths: "{{.paths}}" + + lint:prettier: + desc: "Check if prettier-formatted." + deps: + - lint:prettier:yaml + + lint:prettier:yaml: + desc: "Check if yaml files are prettier-formatted." + cmds: + - prettier -c "**/*.yaml" "**/*.yml" diff --git a/client/trdl.yaml b/client/trdl.yaml index 3b191d7b..71b429df 100644 --- a/client/trdl.yaml +++ b/client/trdl.yaml @@ -1,4 +1,4 @@ docker_image: golang:1.20.2-alpine3.17@sha256:4e6bc0eafc261b6c8ba9bd9999b6698e8cefbe21e6d90fbc10c34599d75dc608 commands: -- go install github.com/mitchellh/gox@8c3b2b9e647dc52457d6ee7b5adcf97e2bafe131 -- cd client && ./scripts/ci/build_release_v2.sh {{ .Tag }} && cp -a release-build/{{ .Tag }}/* /result + - go install github.com/mitchellh/gox@8c3b2b9e647dc52457d6ee7b5adcf97e2bafe131 + - cd client && ./scripts/ci/build_release_v2.sh {{ .Tag }} && cp -a release-build/{{ .Tag }}/* /result diff --git a/client/trdl_channels.yaml b/client/trdl_channels.yaml index f7a3aa77..ca7731d6 100644 --- a/client/trdl_channels.yaml +++ b/client/trdl_channels.yaml @@ -1,7 +1,7 @@ groups: -- name: "0" - channels: - - name: alpha - version: 0.7.0 - - name: stable - version: 0.7.0 + - name: "0" + channels: + - name: alpha + version: 0.7.0 + - name: stable + version: 0.7.0 diff --git a/docs/_config.yml b/docs/_config.yml index d3c98eb0..2d6f9aed 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -10,26 +10,26 @@ site_description: Deliver your software continuously & securely. github_repo_path: /werf/trdl exclude: -- .gitignore -- Gemfile -- Gemfile.lock -- werf.yaml -- pages_ru/ + - .gitignore + - Gemfile + - Gemfile.lock + - werf.yaml + - pages_ru/ highlighter: rouge plugins: -- jekyll-assets + - jekyll-assets markdown: kramdown kramdown: - input: GFM - hard_wrap: false - syntax_highlighter: rouge + input: GFM + hard_wrap: false + syntax_highlighter: rouge breadcrumbs: root: - hide: false # show breadcrumbs on root/home page + hide: false # show breadcrumbs on root/home page image: false # Show image or title text hometext: "Home" diff --git a/docs/_config_ru.yml b/docs/_config_ru.yml index da83279b..1ecddc8c 100644 --- a/docs/_config_ru.yml +++ b/docs/_config_ru.yml @@ -4,14 +4,14 @@ site_lang: ru site_description: Инструмент безопасной доставки вашего кода пользователям. exclude: -- .gitignore -- Gemfile -- Gemfile.lock -- werf.yaml -- pages_en/ + - .gitignore + - Gemfile + - Gemfile.lock + - werf.yaml + - pages_en/ include: -- pages_ru/ + - pages_ru/ breadcrumbs: hometext: "Начало" diff --git a/docs/_data/trdl.yml b/docs/_data/trdl.yml index a933eab8..cb8f4b46 100644 --- a/docs/_data/trdl.yml +++ b/docs/_data/trdl.yml @@ -10,4 +10,4 @@ directives: required: true description: en: Build instructions. The instructions can use the `{{ .Tag }}` pattern, which is replaced by a git tag - ru: Сборочные инструкции. В инструкциях можно использовать шаблон `{{ .Tag }}`, который заменяется на собираемый git-tag \ No newline at end of file + ru: Сборочные инструкции. В инструкциях можно использовать шаблон `{{ .Tag }}`, который заменяется на собираемый git-tag diff --git a/docs/_data/trdl_channels.yml b/docs/_data/trdl_channels.yml index 74555a31..9929db75 100644 --- a/docs/_data/trdl_channels.yml +++ b/docs/_data/trdl_channels.yml @@ -25,4 +25,4 @@ directives: required: true description: en: Existing version - ru: Существующая версия \ No newline at end of file + ru: Существующая версия diff --git a/e2e/tests/flow/_fixtures/complete_cycle/docker-compose.yaml b/e2e/tests/flow/_fixtures/complete_cycle/docker-compose.yaml index d15e476f..6f295c28 100644 --- a/e2e/tests/flow/_fixtures/complete_cycle/docker-compose.yaml +++ b/e2e/tests/flow/_fixtures/complete_cycle/docker-compose.yaml @@ -8,7 +8,7 @@ services: - "9000" command: server /data networks: - - minio-net + - minio-net mc: image: minio/mc@sha256:f78c05169b54f191ab407a8e4d746a2b1f65a047936ba0e51885504912c9595e @@ -17,4 +17,4 @@ services: environment: MC_HOST_main: http://minioadmin:minioadmin@minio:9000 networks: - - minio-net + - minio-net diff --git a/e2e/tests/flow/_fixtures/complete_cycle/trdl.yaml b/e2e/tests/flow/_fixtures/complete_cycle/trdl.yaml index 1d7e4cfd..5ac157c0 100644 --- a/e2e/tests/flow/_fixtures/complete_cycle/trdl.yaml +++ b/e2e/tests/flow/_fixtures/complete_cycle/trdl.yaml @@ -3,4 +3,4 @@ commands: - mkdir -p /result/any-any/bin - printf "echo {{ .Tag }}\n" > /result/any-any/bin/script.sh - mkdir -p /result/windows-any/bin - - printf "@echo off\necho {{ .Tag }}\n" > /result/windows-any/bin/script.bat \ No newline at end of file + - printf "@echo off\necho {{ .Tag }}\n" > /result/windows-any/bin/script.bat diff --git a/server/trdl.yaml b/server/trdl.yaml index f5d532cf..0a11e0c1 100644 --- a/server/trdl.yaml +++ b/server/trdl.yaml @@ -1,4 +1,4 @@ docker_image: golang:1.20.2-alpine3.17@sha256:4e6bc0eafc261b6c8ba9bd9999b6698e8cefbe21e6d90fbc10c34599d75dc608 commands: -- go install github.com/mitchellh/gox@8c3b2b9e647dc52457d6ee7b5adcf97e2bafe131 -- cd server && ./scripts/ci/build_release.sh {{ .Tag }} && cp -a release-build/{{ .Tag }}/* /result + - go install github.com/mitchellh/gox@8c3b2b9e647dc52457d6ee7b5adcf97e2bafe131 + - cd server && ./scripts/ci/build_release.sh {{ .Tag }} && cp -a release-build/{{ .Tag }}/* /result diff --git a/server/trdl_channels.yaml b/server/trdl_channels.yaml index f7a3aa77..ca7731d6 100644 --- a/server/trdl_channels.yaml +++ b/server/trdl_channels.yaml @@ -1,7 +1,7 @@ groups: -- name: "0" - channels: - - name: alpha - version: 0.7.0 - - name: stable - version: 0.7.0 + - name: "0" + channels: + - name: alpha + version: 0.7.0 + - name: stable + version: 0.7.0