From 1ef09866a3f3c0fe288bb88004c8dd6dde62cd93 Mon Sep 17 00:00:00 2001 From: Ragot Geoffrey Date: Fri, 2 Feb 2024 17:50:58 +0100 Subject: [PATCH] fix: add missing goreleaser file (#1179) --- components/operator/.goreleaser.yml | 39 +++++++++++++++++++++++++++ components/operator/Earthfile | 5 ++-- components/operator/Makefile | 4 +-- components/operator/build.Dockerfile | 4 +++ components/operator/{cmd => }/main.go | 0 5 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 components/operator/.goreleaser.yml create mode 100644 components/operator/build.Dockerfile rename components/operator/{cmd => }/main.go (100%) diff --git a/components/operator/.goreleaser.yml b/components/operator/.goreleaser.yml new file mode 100644 index 0000000000..c1171328ce --- /dev/null +++ b/components/operator/.goreleaser.yml @@ -0,0 +1,39 @@ +project_name: operator +includes: + - from_file: + path: ./../../.goreleaser.default.yaml + +monorepo: + tag_prefix: v + dir: ./ + +builds: + - binary: operator + id: operator + ldflags: + - -X github.com/formancehq/operator/cmd.BuildDate={{ .Date }} + - -X github.com/formancehq/operator/cmd.Version={{ .Version }} + - -X github.com/formancehq/operator/cmd.Commit={{ .ShortCommit }} + - -extldflags "-static" + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64 + +archives: + - id: "{{.ProjectName}}" + builds: + - operator + format: tar.gz + name_template: "{{.ProjectName}}_{{.Os}}-{{.Arch}}" + + +release: + prerelease: auto + footer: | + ## What to do next? + - Read the [documentation](https://docs.formance.com/) + - Join our [Slack server](https://formance.com/slack) \ No newline at end of file diff --git a/components/operator/Earthfile b/components/operator/Earthfile index bbcf157f63..004a4c5758 100644 --- a/components/operator/Earthfile +++ b/components/operator/Earthfile @@ -13,7 +13,7 @@ sources: COPY (stack+sources/out --LOCATION=ee/search) ee/search COPY (stack+sources/out --LOCATION=libs/go-libs) libs/go-libs WORKDIR /src/components/operator - COPY --dir api internal cmd pkg . + COPY --dir api internal pkg . COPY go.* . SAVE ARTIFACT /src @@ -21,7 +21,7 @@ compile: FROM core+builder-image COPY (+sources/*) /src COPY --pass-args (+generate/*) /src/components/operator - WORKDIR /src/components/operator/cmd + WORKDIR /src/components/operator DO --pass-args core+GO_COMPILE build-image: @@ -104,7 +104,6 @@ lint: DO --pass-args stack+GO_LINT SAVE ARTIFACT api AS LOCAL api SAVE ARTIFACT internal AS LOCAL internal - SAVE ARTIFACT cmd AS LOCAL cmd tests: FROM core+builder-image diff --git a/components/operator/Makefile b/components/operator/Makefile index 3e9011d2b8..9ff17464cf 100644 --- a/components/operator/Makefile +++ b/components/operator/Makefile @@ -84,11 +84,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes .PHONY: build build: manifests generate fmt vet ## Build manager binary. - go build -o bin/manager cmd/main.go + go build -o bin/manager main.go .PHONY: run run: manifests generate fmt vet ## Run a controller from your host. - go run ./cmd/main.go + go run ./main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. # (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it. diff --git a/components/operator/build.Dockerfile b/components/operator/build.Dockerfile new file mode 100644 index 0000000000..278ea8b8e0 --- /dev/null +++ b/components/operator/build.Dockerfile @@ -0,0 +1,4 @@ +FROM ghcr.io/formancehq/base:22.04 +COPY operator /usr/bin/operator +ENV OTEL_SERVICE_NAME operator +ENTRYPOINT ["/usr/bin/operator"] diff --git a/components/operator/cmd/main.go b/components/operator/main.go similarity index 100% rename from components/operator/cmd/main.go rename to components/operator/main.go