-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rekres, also fixes: #7. Signed-off-by: Noel Georgi <[email protected]>
- Loading branch information
Showing
5 changed files
with
67 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
# syntax = docker/dockerfile-upstream:1.5.2-labs | ||
# syntax = docker/dockerfile-upstream:1.6.0-labs | ||
|
||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
# | ||
# Generated on 2023-05-03T17:32:52Z by kres latest. | ||
# Generated on 2023-09-05T19:06:43Z by kres 0d3003d-dirty. | ||
|
||
ARG TOOLCHAIN | ||
|
||
# cleaned up specs and compiled versions | ||
FROM scratch AS generate | ||
|
||
FROM ghcr.io/siderolabs/ca-certificates:v1.4.1 AS image-ca-certificates | ||
FROM ghcr.io/siderolabs/ca-certificates:v1.6.0-alpha.0-10-gd3d7d29 AS image-ca-certificates | ||
|
||
FROM ghcr.io/siderolabs/fhs:v1.4.1 AS image-fhs | ||
FROM ghcr.io/siderolabs/fhs:v1.6.0-alpha.0-10-gd3d7d29 AS image-fhs | ||
|
||
# runs markdownlint | ||
FROM docker.io/node:20.0.0-alpine3.16 AS lint-markdown | ||
FROM docker.io/node:20.5.1-alpine3.18 AS lint-markdown | ||
WORKDIR /src | ||
RUN npm i -g markdownlint-cli@0.33.0 | ||
RUN npm i -g markdownlint-cli@0.35.0 | ||
RUN npm i [email protected] | ||
COPY .markdownlint.json . | ||
COPY ./CHANGELOG.md ./CHANGELOG.md | ||
COPY ./README.md ./README.md | ||
RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js . | ||
|
||
|
@@ -31,27 +32,32 @@ FROM --platform=${BUILDPLATFORM} toolchain AS tools | |
ENV GO111MODULE on | ||
ARG CGO_ENABLED | ||
ENV CGO_ENABLED ${CGO_ENABLED} | ||
ARG GOTOOLCHAIN | ||
ENV GOTOOLCHAIN ${GOTOOLCHAIN} | ||
ARG GOEXPERIMENT | ||
ENV GOEXPERIMENT ${GOEXPERIMENT} | ||
ENV GOPATH /go | ||
ARG DEEPCOPY_VERSION | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \ | ||
&& mv /go/bin/deep-copy /bin/deep-copy | ||
ARG GOLANGCILINT_VERSION | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \ | ||
&& mv /go/bin/golangci-lint /bin/golangci-lint | ||
ARG GOFUMPT_VERSION | ||
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \ | ||
&& mv /go/bin/gofumpt /bin/gofumpt | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/vuln/cmd/govulncheck@latest \ | ||
&& mv /go/bin/govulncheck /bin/govulncheck | ||
ARG GOIMPORTS_VERSION | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \ | ||
&& mv /go/bin/goimports /bin/goimports | ||
ARG DEEPCOPY_VERSION | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \ | ||
&& mv /go/bin/deep-copy /bin/deep-copy | ||
ARG GOFUMPT_VERSION | ||
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \ | ||
&& mv /go/bin/gofumpt /bin/gofumpt | ||
|
||
# tools and sources | ||
FROM tools AS base | ||
WORKDIR /src | ||
COPY ./go.mod . | ||
COPY ./go.sum . | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
RUN cd . | ||
RUN --mount=type=cache,target=/go/pkg go mod download | ||
RUN --mount=type=cache,target=/go/pkg go mod verify | ||
COPY ./cmd ./cmd | ||
|
@@ -69,16 +75,18 @@ RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is no | |
|
||
# runs goimports | ||
FROM base AS lint-goimports | ||
RUN FILES="$(goimports -l -local github.com/siderolabs/talos-backup .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/talos-backup .':\n${FILES}"; exit 1) | ||
RUN FILES="$(goimports -l -local github.com/siderolabs/talos-backup/ .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/talos-backup/ .':\n${FILES}"; exit 1) | ||
|
||
# runs golangci-lint | ||
FROM base AS lint-golangci-lint | ||
WORKDIR /src | ||
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 | ||
WORKDIR /src | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg govulncheck ./... | ||
|
||
# builds talos-backup-linux-amd64 | ||
|
@@ -99,11 +107,13 @@ RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/g | |
|
||
# runs unit-tests with race detector | ||
FROM base AS unit-tests-race | ||
WORKDIR /src | ||
ARG TESTPKGS | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp CGO_ENABLED=1 go test -v -race -count 1 ${TESTPKGS} | ||
|
||
# runs unit-tests | ||
FROM base AS unit-tests-run | ||
WORKDIR /src | ||
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 -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS} | ||
|
||
|
@@ -118,7 +128,7 @@ FROM scratch AS talos-backup-linux-arm64 | |
COPY --from=talos-backup-linux-arm64-build /talos-backup-linux-arm64 /talos-backup-linux-arm64 | ||
|
||
FROM scratch AS unit-tests | ||
COPY --from=unit-tests-run /src/coverage.txt /coverage.txt | ||
COPY --from=unit-tests-run /src/coverage.txt /coverage-unit-tests.txt | ||
|
||
FROM talos-backup-linux-${TARGETARCH} AS talos-backup | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters