From a062a4ca078a6b3b3f119edf86e5f80620e67a55 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 31 Oct 2022 22:12:56 +0400 Subject: [PATCH] chore: rekres, rename Rename Go module, rekres, fix linting, rename main branch. Signed-off-by: Andrey Smirnov --- .codecov.yml | 20 ++++---- .conform.yaml | 17 ++++--- .drone.yml | 64 +++++++++++++++++++++++- .golangci.yml | 53 +++++++++++++------- .license-header.go.txt | 3 ++ Dockerfile | 51 +++++++++++++------ Makefile | 84 ++++++++++++++++++++++++++------ README.md | 2 +- go.mod | 16 +++--- go.sum | 37 +++++++------- hack/git-chglog/CHANGELOG.tpl.md | 26 ---------- hack/git-chglog/config.yaml | 32 ------------ hack/release.sh | 24 +++++---- hack/release.toml | 11 +++++ procfs/cmdline.go | 18 ++++--- procfs/cmdline_test.go | 14 +++--- 16 files changed, 297 insertions(+), 175 deletions(-) create mode 100644 .license-header.go.txt delete mode 100644 hack/git-chglog/CHANGELOG.tpl.md delete mode 100644 hack/git-chglog/config.yaml create mode 100644 hack/release.toml diff --git a/.codecov.yml b/.codecov.yml index b2394ff..14c234f 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,18 +1,18 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty. +# Generated on 2022-10-31T18:09:29Z by kres 03328da. codecov: -require_ci_to_pass: false + require_ci_to_pass: false coverage: -status: - project: - default: - target: 50% - threshold: 0.5% - base: auto - if_ci_failed: success - patch: off + status: + project: + default: + target: 50% + threshold: 0.5% + base: auto + if_ci_failed: success + patch: off comment: false diff --git a/.conform.yaml b/.conform.yaml index f20d787..f09c222 100644 --- a/.conform.yaml +++ b/.conform.yaml @@ -1,12 +1,16 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty. +# Generated on 2022-10-31T18:09:29Z by kres 03328da. +--- policies: - type: commit spec: dco: true - gpg: false + gpg: + required: true + identity: + gitHubOrganization: siderolabs spellcheck: locale: US maximumOfOneCommit: true @@ -19,16 +23,15 @@ policies: required: true conventional: types: ["chore","docs","perf","refactor","style","test","release"] - scopes: ["*"] + scopes: [".*"] - type: license spec: skipPaths: - .git/ + - testdata/ includeSuffixes: - .go excludeSuffixes: - .pb.go - header: | - // This Source Code Form is subject to the terms of the Mozilla Public - // License, v. 2.0. If a copy of the MPL was not distributed with this - // file, You can obtain one at http://mozilla.org/MPL/2.0/. + - .pb.gw.go + header: "// This Source Code Form is subject to the terms of the Mozilla Public\u000A// License, v. 2.0. If a copy of the MPL was not distributed with this\u000A// file, You can obtain one at http://mozilla.org/MPL/2.0/.\u000A" diff --git a/.drone.yml b/.drone.yml index 499e219..e020064 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,7 @@ --- # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty. +# Generated on 2022-10-31T18:09:29Z by kres 03328da. kind: pipeline type: kubernetes @@ -122,9 +122,59 @@ steps: depends_on: - base +- name: release-notes + pull: always + image: autonomy/build-container:latest + commands: + - make release-notes + volumes: + - name: outer-docker-socket + path: /var/outer-run + - name: docker-socket + path: /var/run + - name: buildx + path: /root/.docker/buildx + - name: ssh + path: /root/.ssh + when: + event: + - tag + depends_on: + - unit-tests + - coverage + - lint + +- name: release + pull: always + image: plugins/github-release + settings: + api_key: + from_secret: github_token + checksum: + - sha256 + - sha512 + draft: true + files: + - _out/* + note: _out/RELEASE_NOTES.md + volumes: + - name: outer-docker-socket + path: /var/outer-run + - name: docker-socket + path: /var/run + - name: buildx + path: /root/.docker/buildx + - name: ssh + path: /root/.ssh + when: + event: + - tag + depends_on: + - release-notes + services: - name: docker - image: docker:19.03-dind + image: docker:20.10-dind entrypoint: - dockerd commands: @@ -157,6 +207,12 @@ volumes: temp: medium: memory +trigger: + branch: + exclude: + - renovate/* + - dependabot/* + --- kind: pipeline type: kubernetes @@ -184,6 +240,10 @@ steps: - failure trigger: + branch: + exclude: + - renovate/* + - dependabot/* status: - success - failure diff --git a/.golangci.yml b/.golangci.yml index 6f53570..7f00d04 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty. - +# Generated on 2022-10-31T18:09:29Z by kres 03328da. # options for analysis running run: @@ -22,7 +21,6 @@ output: uniq-by-line: true path-prefix: "" - # all available settings of specific linters linters-settings: dogsled: @@ -38,9 +36,16 @@ linters-settings: lines: 60 statements: 40 gci: - local-prefixes: github.com/talos-systems/go-procfs + local-prefixes: github.com/siderolabs/go-procfs gocognit: min-complexity: 30 + ireturn: + allow: + - anon + - error + - empty + - stdlib + - github.com\/talos-systems\/kres\/internal\/dag.Node nestif: min-complexity: 5 goconst: @@ -60,7 +65,7 @@ linters-settings: gofmt: simplify: true goimports: - local-prefixes: github.com/talos-systems/go-procfs + local-prefixes: github.com/siderolabs/go-procfs golint: min-confidence: 0.8 gomnd: @@ -75,8 +80,6 @@ linters-settings: lll: line-length: 200 tab-width: 4 - maligned: - suggest-new: true misspell: locale: US ignore-words: [] @@ -93,7 +96,7 @@ linters-settings: require-explanation: false require-specific: true rowserrcheck: {} - testpackage: + testpackage: {} unparam: check-exported: false unused: @@ -112,25 +115,41 @@ linters-settings: allow-separated-leading-comment: false gofumpt: extra-rules: false + cyclop: + # the maximal code complexity to report + max-complexity: 20 linters: enable-all: true + disable-all: false + fast: false disable: + - exhaustruct + - exhaustivestruct + - forbidigo + - funlen - gas - - typecheck - gochecknoglobals - gochecknoinits - - funlen - godox - - gomnd - goerr113 + - gomnd + - gomoddirectives + - ireturn - nestif - - wrapcheck + - nonamedreturns + - nosnakecase - paralleltest - - exhaustivestruct - disable-all: false - fast: false - + - tagliatelle + - thelper + - typecheck + - varnamelen + - wrapcheck + # abandoned linters for which golangci shows the warning that the repo is archived by the owner + - interfacer + - maligned + - golint + - scopelint issues: exclude: [] @@ -139,10 +158,8 @@ issues: exclude-case-sensitive: false max-issues-per-linter: 10 max-same-issues: 3 - new: false severity: default-severity: error - case-sensitive: false diff --git a/.license-header.go.txt b/.license-header.go.txt new file mode 100644 index 0000000..66e0819 --- /dev/null +++ b/.license-header.go.txt @@ -0,0 +1,3 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/Dockerfile b/Dockerfile index e31243f..85f8a39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,34 +2,46 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty. +# Generated on 2022-10-31T18:09:29Z by kres 03328da. ARG TOOLCHAIN +# cleaned up specs and compiled versions +FROM scratch AS generate + # runs markdownlint -FROM node:14.8.0-alpine AS lint-markdown -RUN npm i -g markdownlint-cli@0.23.2 -RUN npm i sentences-per-line@0.2.1 +FROM docker.io/node:19.0.0-alpine3.16 AS lint-markdown WORKDIR /src +RUN npm i -g markdownlint-cli@0.32.2 +RUN npm i sentences-per-line@0.2.1 COPY .markdownlint.json . COPY ./README.md ./README.md -RUN markdownlint --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules /node_modules/sentences-per-line/index.js . +RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js . # base toolchain image FROM ${TOOLCHAIN} AS toolchain -RUN apk --update --no-cache add bash curl build-base +RUN apk --update --no-cache add bash curl build-base protoc protobuf-dev # build tools -FROM toolchain AS tools +FROM --platform=${BUILDPLATFORM} toolchain AS tools ENV GO111MODULE on -ENV CGO_ENABLED 0 +ARG CGO_ENABLED +ENV CGO_ENABLED ${CGO_ENABLED} ENV GOPATH /go -RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /bin v1.33.0 +ARG GOLANGCILINT_VERSION +RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \ + && mv /go/bin/golangci-lint /bin/golangci-lint ARG GOFUMPT_VERSION -RUN cd $(mktemp -d) \ - && go mod init tmp \ - && go get mvdan.cc/gofumpt/gofumports@${GOFUMPT_VERSION} \ - && mv /go/bin/gofumports /bin/gofumports +RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \ + && mv /go/bin/gofumpt /bin/gofumpt +RUN go install golang.org/x/vuln/cmd/govulncheck@latest \ + && mv /go/bin/govulncheck /bin/govulncheck +ARG GOIMPORTS_VERSION +RUN go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \ + && mv /go/bin/goimports /bin/goimports +ARG DEEPCOPY_VERSION +RUN go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \ + && mv /go/bin/deep-copy /bin/deep-copy # tools and sources FROM tools AS base @@ -43,8 +55,11 @@ RUN --mount=type=cache,target=/go/pkg go list -mod=readonly all >/dev/null # runs gofumpt FROM base AS lint-gofumpt -RUN find . -name '*.pb.go' | xargs -r rm -RUN FILES="$(gofumports -l -local github.com/talos-systems/go-procfs .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumports -w -local github.com/talos-systems/go-procfs .':\n${FILES}"; exit 1) +RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumpt -w .':\n${FILES}"; exit 1) + +# runs goimports +FROM base AS lint-goimports +RUN FILES="$(goimports -l -local github.com/siderolabs/go-procfs .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/go-procfs .':\n${FILES}"; exit 1) # runs golangci-lint FROM base AS lint-golangci-lint @@ -52,6 +67,10 @@ COPY .golangci.yml . ENV GOGC 50 RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/.cache/golangci-lint --mount=type=cache,target=/go/pkg golangci-lint run --config .golangci.yml +# runs govulncheck +FROM base AS lint-govulncheck +RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg govulncheck ./... + # runs unit-tests with race detector FROM base AS unit-tests-race ARG TESTPKGS @@ -60,7 +79,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/g # runs unit-tests FROM base AS unit-tests-run ARG TESTPKGS -RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -count 1 ${TESTPKGS} +RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS} FROM scratch AS unit-tests COPY --from=unit-tests-run /src/coverage.txt /coverage.txt diff --git a/Makefile b/Makefile index 612180d..b55b815 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty. +# Generated on 2022-10-31T18:09:29Z by kres 03328da. # common variables @@ -8,13 +8,26 @@ SHA := $(shell git describe --match=none --always --abbrev=8 --dirty) TAG := $(shell git describe --tag --always --dirty) BRANCH := $(shell git rev-parse --abbrev-ref HEAD) ARTIFACTS := _out +WITH_DEBUG ?= false +WITH_RACE ?= false REGISTRY ?= ghcr.io -USERNAME ?= talos-systems +USERNAME ?= siderolabs REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME) -GOFUMPT_VERSION ?= abc0db2c416aca0f60ea33c23c76665f6e7ba0b6 -GO_VERSION ?= 1.14 +GOLANGCILINT_VERSION ?= v1.50.1 +GOFUMPT_VERSION ?= v0.4.0 +GO_VERSION ?= 1.19 +GOIMPORTS_VERSION ?= v0.2.0 +PROTOBUF_GO_VERSION ?= 1.28.1 +GRPC_GO_VERSION ?= 1.2.0 +GRPC_GATEWAY_VERSION ?= 2.12.0 +VTPROTOBUF_VERSION ?= 0.3.0 +DEEPCOPY_VERSION ?= v0.5.5 +GO_BUILDFLAGS ?= +GO_LDFLAGS ?= +CGO_ENABLED ?= 0 TESTPKGS ?= ./... -KRES_IMAGE ?= ghcr.io/talos-systems/kres:latest +KRES_IMAGE ?= ghcr.io/siderolabs/kres:latest +CONFORMANCE_IMAGE ?= ghcr.io/siderolabs/conform:latest # docker build settings @@ -27,14 +40,25 @@ COMMON_ARGS = --file=Dockerfile COMMON_ARGS += --progress=$(PROGRESS) COMMON_ARGS += --platform=$(PLATFORM) COMMON_ARGS += --push=$(PUSH) -COMMON_ARGS += --build-arg=ARTIFACTS=$(ARTIFACTS) -COMMON_ARGS += --build-arg=SHA=$(SHA) -COMMON_ARGS += --build-arg=TAG=$(TAG) -COMMON_ARGS += --build-arg=USERNAME=$(USERNAME) -COMMON_ARGS += --build-arg=TOOLCHAIN=$(TOOLCHAIN) -COMMON_ARGS += --build-arg=GOFUMPT_VERSION=$(GOFUMPT_VERSION) -COMMON_ARGS += --build-arg=TESTPKGS=$(TESTPKGS) -TOOLCHAIN ?= docker.io/golang:1.15-alpine +COMMON_ARGS += --build-arg=ARTIFACTS="$(ARTIFACTS)" +COMMON_ARGS += --build-arg=SHA="$(SHA)" +COMMON_ARGS += --build-arg=TAG="$(TAG)" +COMMON_ARGS += --build-arg=USERNAME="$(USERNAME)" +COMMON_ARGS += --build-arg=REGISTRY="$(REGISTRY)" +COMMON_ARGS += --build-arg=TOOLCHAIN="$(TOOLCHAIN)" +COMMON_ARGS += --build-arg=CGO_ENABLED="$(CGO_ENABLED)" +COMMON_ARGS += --build-arg=GO_BUILDFLAGS="$(GO_BUILDFLAGS)" +COMMON_ARGS += --build-arg=GO_LDFLAGS="$(GO_LDFLAGS)" +COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)" +COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)" +COMMON_ARGS += --build-arg=GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)" +COMMON_ARGS += --build-arg=PROTOBUF_GO_VERSION="$(PROTOBUF_GO_VERSION)" +COMMON_ARGS += --build-arg=GRPC_GO_VERSION="$(GRPC_GO_VERSION)" +COMMON_ARGS += --build-arg=GRPC_GATEWAY_VERSION="$(GRPC_GATEWAY_VERSION)" +COMMON_ARGS += --build-arg=VTPROTOBUF_VERSION="$(VTPROTOBUF_VERSION)" +COMMON_ARGS += --build-arg=DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)" +COMMON_ARGS += --build-arg=TESTPKGS="$(TESTPKGS)" +TOOLCHAIN ?= docker.io/golang:1.19-alpine # help menu @@ -69,6 +93,18 @@ respectively. endef +ifneq (, $(filter $(WITH_RACE), t true TRUE y yes 1)) +GO_BUILDFLAGS += -race +CGO_ENABLED := 1 +GO_LDFLAGS += -linkmode=external -extldflags '-static' +endif + +ifneq (, $(filter $(WITH_DEBUG), t true TRUE y yes 1)) +GO_BUILDFLAGS += -tags sidero.debug +else +GO_LDFLAGS += -s -w +endif + all: unit-tests lint .PHONY: clean @@ -91,8 +127,14 @@ lint-gofumpt: ## Runs gofumpt linter. fmt: ## Formats the source code @docker run --rm -it -v $(PWD):/src -w /src golang:$(GO_VERSION) \ bash -c "export GO111MODULE=on; export GOPROXY=https://proxy.golang.org; \ - cd /tmp && go mod init tmp && go get mvdan.cc/gofumpt/gofumports@$(GOFUMPT_VERSION) && \ - cd - && gofumports -w -local github.com/talos-systems/go-procfs ." + go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION) && \ + gofumpt -w ." + +lint-govulncheck: ## Runs govulncheck linter. + @$(MAKE) target-$@ + +lint-goimports: ## Runs goimports linter. + @$(MAKE) target-$@ .PHONY: base base: ## Prepare base toolchain @@ -115,7 +157,7 @@ lint-markdown: ## Runs markdownlint. @$(MAKE) target-$@ .PHONY: lint -lint: lint-golangci-lint lint-gofumpt lint-markdown ## Run all linters for the project. +lint: lint-golangci-lint lint-gofumpt lint-govulncheck lint-goimports lint-markdown ## Run all linters for the project. .PHONY: rekres rekres: @@ -127,3 +169,13 @@ help: ## This help menu. @echo "$$HELP_MENU_HEADER" @grep -E '^[a-zA-Z%_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' +.PHONY: release-notes +release-notes: + mkdir -p $(ARTIFACTS) + @ARTIFACTS=$(ARTIFACTS) ./hack/release.sh $@ $(ARTIFACTS)/RELEASE_NOTES.md $(TAG) + +.PHONY: conformance +conformance: + @docker pull $(CONFORMANCE_IMAGE) + @docker run --rm -it -v $(PWD):/src -w /src $(CONFORMANCE_IMAGE) enforce + diff --git a/README.md b/README.md index 1d8ace0..004b012 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# go-pocfs +# go-procfs diff --git a/go.mod b/go.mod index 15d5314..2c37d2f 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,13 @@ -module github.com/talos-systems/go-procfs +module github.com/siderolabs/go-procfs -go 1.13 +go 1.19 + +require github.com/stretchr/testify v1.8.1 require ( - github.com/kr/pretty v0.1.0 // indirect - github.com/stretchr/objx v0.2.0 // indirect - github.com/stretchr/testify v1.5.0 - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/yaml.v2 v2.2.8 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index eee1932..41842bd 100644 --- a/go.sum +++ b/go.sum @@ -1,26 +1,29 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.5.0 h1:DMOzIV76tmoDNE9pX6RSN0aDtCYeCg5VueieJaAo1uw= -github.com/stretchr/testify v1.5.0/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/hack/git-chglog/CHANGELOG.tpl.md b/hack/git-chglog/CHANGELOG.tpl.md deleted file mode 100644 index f6c3201..0000000 --- a/hack/git-chglog/CHANGELOG.tpl.md +++ /dev/null @@ -1,26 +0,0 @@ - - - - -{{ range .Versions }} - -## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }}) - -{{ range .CommitGroups -}} -### {{ .Title }} - -{{ range .Commits -}} -* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} -{{ end }} -{{ end -}} - -{{- if .NoteGroups -}} -{{ range .NoteGroups -}} -### {{ .Title }} - -{{ range .Notes }} -{{ .Body }} -{{ end }} -{{ end -}} -{{ end -}} -{{ end -}} diff --git a/hack/git-chglog/config.yaml b/hack/git-chglog/config.yaml deleted file mode 100644 index 78ddc07..0000000 --- a/hack/git-chglog/config.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. -# -# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty. - -style: github -template: CHANGELOG.tpl.md -info: - title: CHANGELOG - repository_url: https://github.com/talos-systems/go-procfs -options: - commits: - # filters: - # Type: - # - feat - # - fix - # - perf - # - refactor - commit_groups: - # title_maps: - # feat: Features - # fix: Bug Fixes - # perf: Performance Improvements - # refactor: Code Refactoring - header: - pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" - pattern_maps: - - Type - - Scope - - Subject - notes: - keywords: - - BREAKING CHANGE diff --git a/hack/release.sh b/hack/release.sh index b709ae7..18e24d0 100755 --- a/hack/release.sh +++ b/hack/release.sh @@ -2,16 +2,20 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty. - +# Generated on 2022-10-31T18:09:29Z by kres 03328da. set -e +RELEASE_TOOL_IMAGE="ghcr.io/siderolabs/release-tool:latest" + +function release-tool { + docker pull "${RELEASE_TOOL_IMAGE}" >/dev/null + docker run --rm -w /src -v "${PWD}":/src:ro "${RELEASE_TOOL_IMAGE}" -l -d -n -t "${1}" ./hack/release.toml +} + function changelog { if [ "$#" -eq 1 ]; then - git-chglog --output CHANGELOG.md -c ./hack/git-chglog/config.yaml --tag-filter-pattern "^${1}" "${1}.0-alpha.0.." - elif [ "$#" -eq 0 ]; then - git-chglog --output CHANGELOG.md -c ./hack/git-chglog/config.yaml + (release-tool ${1}; echo; cat CHANGELOG.md) > CHANGELOG.md- && mv CHANGELOG.md- CHANGELOG.md else echo 1>&2 "Usage: $0 changelog [tag]" exit 1 @@ -19,7 +23,7 @@ function changelog { } function release-notes { - git-chglog --output ${1} -c ./hack/git-chglog/config.yaml "${2}" + release-tool "${2}" > "${1}" } function cherry-pick { @@ -51,10 +55,12 @@ then else cat <