-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: drop dependency on Talos machinery package
As `siderolink` library gets imported into Talos, and it also used Talos machinery package, this creates an unnecceary import loop which causes lots of troubles. Drop the loop by: * refactoring event sink to accept supported event types from the outside * partially copying the code which generates SideroLink network from Talos Signed-off-by: Andrey Smirnov <[email protected]>
- Loading branch information
Showing
8 changed files
with
193 additions
and
335 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,12 @@ | |
|
||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
# | ||
# Generated on 2022-09-27T12:22:46Z by kres 8e6d786. | ||
# Generated on 2022-11-02T17:12:14Z by kres 03328da. | ||
|
||
ARG TOOLCHAIN | ||
|
||
# runs markdownlint | ||
FROM docker.io/node:18.9.0-alpine3.16 AS lint-markdown | ||
FROM docker.io/node:19.0.0-alpine3.16 AS lint-markdown | ||
WORKDIR /src | ||
RUN npm i -g [email protected] | ||
RUN npm i [email protected] | ||
|
@@ -27,14 +27,17 @@ RUN apk --update --no-cache add bash curl build-base protoc protobuf-dev | |
# build 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 | ||
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 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 | ||
|
@@ -90,6 +93,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 | ||
|
@@ -111,37 +118,49 @@ COPY --from=unit-tests-run /src/coverage.txt /coverage.txt | |
FROM base AS siderolink-agent-darwin-amd64-build | ||
COPY --from=generate / / | ||
WORKDIR /src/cmd/siderolink-agent | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=darwin go build -ldflags "-s -w" -o /siderolink-agent-darwin-amd64 | ||
ARG GO_BUILDFLAGS | ||
ARG GO_LDFLAGS | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=darwin go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /siderolink-agent-darwin-amd64 | ||
|
||
# builds siderolink-agent-darwin-arm64 | ||
FROM base AS siderolink-agent-darwin-arm64-build | ||
COPY --from=generate / / | ||
WORKDIR /src/cmd/siderolink-agent | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=arm64 GOOS=darwin go build -ldflags "-s -w" -o /siderolink-agent-darwin-arm64 | ||
ARG GO_BUILDFLAGS | ||
ARG GO_LDFLAGS | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=arm64 GOOS=darwin go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /siderolink-agent-darwin-arm64 | ||
|
||
# builds siderolink-agent-linux-amd64 | ||
FROM base AS siderolink-agent-linux-amd64-build | ||
COPY --from=generate / / | ||
WORKDIR /src/cmd/siderolink-agent | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=linux go build -ldflags "-s -w" -o /siderolink-agent-linux-amd64 | ||
ARG GO_BUILDFLAGS | ||
ARG GO_LDFLAGS | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=linux go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /siderolink-agent-linux-amd64 | ||
|
||
# builds siderolink-agent-linux-arm64 | ||
FROM base AS siderolink-agent-linux-arm64-build | ||
COPY --from=generate / / | ||
WORKDIR /src/cmd/siderolink-agent | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=arm64 GOOS=linux go build -ldflags "-s -w" -o /siderolink-agent-linux-arm64 | ||
ARG GO_BUILDFLAGS | ||
ARG GO_LDFLAGS | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=arm64 GOOS=linux go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /siderolink-agent-linux-arm64 | ||
|
||
# builds siderolink-agent-linux-armv7 | ||
FROM base AS siderolink-agent-linux-armv7-build | ||
COPY --from=generate / / | ||
WORKDIR /src/cmd/siderolink-agent | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=arm GOARM=7 GOOS=linux go build -ldflags "-s -w" -o /siderolink-agent-linux-armv7 | ||
ARG GO_BUILDFLAGS | ||
ARG GO_LDFLAGS | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=arm GOARM=7 GOOS=linux go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /siderolink-agent-linux-armv7 | ||
|
||
# builds siderolink-agent-windows-amd64.exe | ||
FROM base AS siderolink-agent-windows-amd64.exe-build | ||
COPY --from=generate / / | ||
WORKDIR /src/cmd/siderolink-agent | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=windows go build -ldflags "-s -w" -o /siderolink-agent-windows-amd64.exe | ||
ARG GO_BUILDFLAGS | ||
ARG GO_LDFLAGS | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=windows go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /siderolink-agent-windows-amd64.exe | ||
|
||
FROM scratch AS siderolink-agent-darwin-amd64 | ||
COPY --from=siderolink-agent-darwin-amd64-build /siderolink-agent-darwin-amd64 /siderolink-agent-darwin-amd64 | ||
|
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
Oops, something went wrong.