diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..075aca66e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "promu"] + path = promu + url = https://github.com/prometheus/promu.git + branch = master diff --git a/.promu.yml b/.promu.yml index 431128e30..116aa8afa 100644 --- a/.promu.yml +++ b/.promu.yml @@ -1,6 +1,6 @@ go: # This must match .circle/config.yml. - version: 1.21 + version: 1.23 repository: path: github.com/prometheus-community/postgres_exporter build: @@ -8,7 +8,7 @@ build: binaries: - name: postgres_exporter path: ./cmd/postgres_exporter - flags: -a -tags strictfipsruntime + flags: -a -tags strictfipsruntime -mod=readonly ldflags: | -X github.com/prometheus/common/version.Version={{.Version}} -X github.com/prometheus/common/version.Revision={{.Revision}} diff --git a/.tekton/postgres-exporter-globalhub-1-5-pull-request.yaml b/.tekton/postgres-exporter-globalhub-1-5-pull-request.yaml index 8c6ec5a18..b54b78bf3 100644 --- a/.tekton/postgres-exporter-globalhub-1-5-pull-request.yaml +++ b/.tekton/postgres-exporter-globalhub-1-5-pull-request.yaml @@ -34,6 +34,12 @@ spec: value: Containerfile.konflux - name: path-context value: . + - name: build-source-image + value: "true" + - name: hermetic + value: "true" + - name: prefetch-input + value: '[ {"type": "gomod", "path": "."}, {"type": "gomod", "path": "./promu"} ]' pipelineSpec: description: | This pipeline is ideal for building multi-arch container images from a Containerfile while maintaining trust after pipeline customization. diff --git a/.tekton/postgres-exporter-globalhub-1-5-push.yaml b/.tekton/postgres-exporter-globalhub-1-5-push.yaml index f9e4d0ae5..5745e9f90 100644 --- a/.tekton/postgres-exporter-globalhub-1-5-push.yaml +++ b/.tekton/postgres-exporter-globalhub-1-5-push.yaml @@ -32,6 +32,12 @@ spec: value: Containerfile.konflux - name: path-context value: . + - name: build-source-image + value: "true" + - name: hermetic + value: "true" + - name: prefetch-input + value: '[ {"type": "gomod", "path": "."}, {"type": "gomod", "path": "./promu"} ]' pipelineSpec: description: | This pipeline is ideal for building multi-arch container images from a Containerfile while maintaining trust after pipeline customization. diff --git a/Containerfile.konflux b/Containerfile.konflux index e747a43af..9de8ae88e 100644 --- a/Containerfile.konflux +++ b/Containerfile.konflux @@ -3,43 +3,30 @@ FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.23 AS bui WORKDIR /workspace COPY . . -RUN git clone https://github.com/prometheus/promu.git && cd promu && go mod vendor && go build -o /usr/local/bin . +RUN cd promu && CGO_ENABLED=1 GOFLAGS="-p=4" go build -mod=readonly -a -v -o /usr/local/bin . ENV BUILD_PROMU=false -RUN go mod vendor && promu build --cgo --prefix ./ +RUN promu build --cgo --prefix ./ # Stage 2: Copy the binaries from the image builder to the base image FROM registry.access.redhat.com/ubi9/ubi-minimal:latest -ARG VCS_REF -ARG VCS_URL -ARG IMAGE_NAME -ARG IMAGE_DESCRIPTION -ARG IMAGE_DISPLAY_NAME -ARG IMAGE_NAME_ARCH -ARG IMAGE_MAINTAINER -ARG IMAGE_VENDOR -ARG IMAGE_VERSION -ARG IMAGE_RELEASE -ARG IMAGE_SUMMARY -ARG IMAGE_OPENSHIFT_TAGS - -LABEL org.label-schema.vendor="Red Hat" \ - org.label-schema.name="$IMAGE_NAME_ARCH" \ - org.label-schema.description="$IMAGE_DESCRIPTION" \ - org.label-schema.vcs-ref=$VCS_REF \ - org.label-schema.vcs-url=$VCS_URL \ - org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" \ - org.label-schema.schema-version="1.0" \ - name="$IMAGE_NAME" \ - maintainer="$IMAGE_MAINTAINER" \ - vendor="$IMAGE_VENDOR" \ - version="$IMAGE_VERSION" \ - release="$IMAGE_RELEASE" \ - description="$IMAGE_DESCRIPTION" \ - summary="$IMAGE_SUMMARY" \ - io.k8s.display-name="$IMAGE_DISPLAY_NAME" \ - io.k8s.description="$IMAGE_DESCRIPTION" \ - io.openshift.tags="$IMAGE_OPENSHIFT_TAGS" +# Red Hat annotations. +LABEL com.redhat.component="multicluster global hub postgres exporter" +LABEL org.label-schema.vendor="Red Hat" +LABEL org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" +LABEL org.label-schema.schema-version="1.0" + +# Bundle metadata +LABEL name="multicluster-global-hub/postgres_exporter" +LABEL version="release-1.5" +LABEL summary="multicluster global hub postgres exporter" +LABEL io.openshift.expose-services="" +LABEL io.openshift.tags="data,images" +LABEL io.k8s.display-name="multicluster global hub postgres exporter" +LABEL io.k8s.description="This is the standard release image for the multicluster global hub postgres exporter" +LABEL maintainer="['acm-component-maintainers@redhat.com']" +LABEL description="multicluster global hub postgres exporter" + COPY --from=builder /workspace/postgres_exporter /bin/postgres_exporter diff --git a/promu b/promu new file mode 160000 index 000000000..d76561b4f --- /dev/null +++ b/promu @@ -0,0 +1 @@ +Subproject commit d76561b4f66b561f54e262249f44ad45e153a23e