diff --git a/.github/workflows/pr-created.yaml b/.github/workflows/pr-created.yaml index 81a1d5a..99ad371 100644 --- a/.github/workflows/pr-created.yaml +++ b/.github/workflows/pr-created.yaml @@ -5,7 +5,7 @@ on: branches: - 'main' paths-ignore: - - '*.md' + - '*.md' - '*.yaml' - '.github/workflows/*' @@ -20,6 +20,6 @@ jobs: security-events: write uses: kubescape/workflows/.github/workflows/incluster-comp-pr-created.yaml@main with: - GO_VERSION: "1.21" + GO_VERSION: "1.22" CGO_ENABLED: 0 - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/pr-merged.yaml b/.github/workflows/pr-merged.yaml index bff9474..6ac4c25 100644 --- a/.github/workflows/pr-merged.yaml +++ b/.github/workflows/pr-merged.yaml @@ -2,13 +2,13 @@ name: pr-merged on: pull_request_target: types: [closed] - branches: + branches: - 'main' paths-ignore: - '**.md' ### Ignore running when README.MD changed. - '**.yaml' ### Ignore running when YAML files changed. - '.github/workflows/*' ### Ignore running when files under path: .github/workflows/* changed. - + jobs: pr-merged: if: ${{ github.event.pull_request.merged == true }} @@ -25,8 +25,8 @@ jobs: CGO_ENABLED: 0 GO111MODULE: "on" BUILD_PLATFORM: linux/amd64,linux/arm64 - GO_VERSION: "1.21" + GO_VERSION: "1.22" REQUIRED_TESTS: '[]' COSIGN: true HELM_E2E_TEST: true - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/build/Dockerfile b/build/Dockerfile index 5401a2b..ff4cfd2 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,11 +1,8 @@ -FROM --platform=$BUILDPLATFORM golang:1.21-bullseye as builder +FROM --platform=$BUILDPLATFORM golang:1.22-bullseye as builder -ENV GO111MODULE=on \ - CGO_ENABLED=0 \ - GOPROXY=https://proxy.golang.org,direct - -# Set the working directory inside the container +ENV GO111MODULE=on CGO_ENABLED=0 WORKDIR /work +ARG TARGETOS TARGETARCH RUN --mount=target=. \ --mount=type=cache,target=/root/.cache/go-build \ @@ -14,8 +11,12 @@ RUN --mount=target=. \ FROM gcr.io/distroless/static-debian11:nonroot -# Copy the Pre-built binary file from the previous stage +USER nonroot +WORKDIR /home/nonroot/ + COPY --from=builder /out/prometheus-exporter /usr/bin/prometheus-exporter -# Entry Point -ENTRYPOINT [ "prometheus-exporter" ] \ No newline at end of file +ARG image_version +ENV RELEASE=$image_version + +ENTRYPOINT ["prometheus-exporter"] diff --git a/go.mod b/go.mod index cf30be9..3174de2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kubescape/prometheus-exporter -go 1.21.3 +go 1.22.4 require ( github.com/kubescape/go-logger v0.0.22