diff --git a/.tekton/collector-component-pipeline.yaml b/.tekton/collector-component-pipeline.yaml index fb6a55a205..c01492fac1 100644 --- a/.tekton/collector-component-pipeline.yaml +++ b/.tekton/collector-component-pipeline.yaml @@ -53,6 +53,10 @@ spec: - description: Output Image Repository name: output-image-repo type: string + - default: "-fast" + description: Suffix that will be appended to the output image tag. + name: output-tag-suffix + type: string - default: . description: Path to the source code of an application's component from where to build image. @@ -177,6 +181,9 @@ spec: workspace: git-auth - name: determine-image-tag + params: + - name: tag-suffix + value: $(params.output-tag-suffix) runAfter: # This task must run on a freshly cloned repository to prevent seeing any changes from other tasks. - clone-repository @@ -238,6 +245,9 @@ spec: value: $(tasks.clone-repository.results.commit) - name: TARGET_STAGE value: $(params.build-target-stage) + - name: BUILD_ARGS + value: + - COLLECTOR_TAG=$(tasks.determine-image-tag.results.image-tag) runAfter: - prefetch-dependencies - prepare-rhel-rpm-subscriptions diff --git a/.tekton/determine-image-tag-task.yaml b/.tekton/determine-image-tag-task.yaml index 61e4ae152d..9534b45359 100644 --- a/.tekton/determine-image-tag-task.yaml +++ b/.tekton/determine-image-tag-task.yaml @@ -7,6 +7,9 @@ metadata: spec: description: Determines the tag for the output image using the StackRox convention from 'make tag' output. params: + - name: tag-suffix + description: Suffix to append to generated image tag. + type: string results: - name: image-tag description: Image Tag determined by custom logic. @@ -20,7 +23,7 @@ spec: dnf -y install git make cd "$(workspaces.source.path)/source" .konflux/scripts/fail-build-if-git-is-dirty.sh - echo -n "$(make --quiet --no-print-directory tag)-fast" | tee "$(results.image-tag.path)" + echo -n "$(make --quiet --no-print-directory tag)$(params.tag-suffix)" | tee "$(results.image-tag.path)" workspaces: - name: source description: The workspace where source code is included. diff --git a/collector/container/konflux.Dockerfile b/collector/container/konflux.Dockerfile index 149e178bd7..59021338fc 100644 --- a/collector/container/konflux.Dockerfile +++ b/collector/container/konflux.Dockerfile @@ -85,7 +85,7 @@ RUN ./builder/install/install-dependencies.sh && \ -DUSE_VALGRIND=${USE_VALGRIND} \ -DADDRESS_SANITIZER=${ADDRESS_SANITIZER} \ -DTRACE_SINSP_EVENTS=${TRACE_SINSP_EVENTS} && \ - cmake --build ${CMAKE_BUILD_DIR} --target all -- -j "${NPROCS:-2}" && \ + cmake --build ${CMAKE_BUILD_DIR} --target all -- -j "${NPROCS:-4}" && \ ctest -V --test-dir ${CMAKE_BUILD_DIR} && \ strip -v --strip-unneeded "${CMAKE_BUILD_DIR}/collector/collector" @@ -116,8 +116,7 @@ FROM scratch COPY --from=rpm-implanter-app /mnt / -# TODO(ROX-20236): configure injection of dynamic version value when it becomes possible. -ARG COLLECTOR_VERSION=0.0.1-todo +ARG COLLECTOR_TAG WORKDIR / @@ -133,12 +132,13 @@ LABEL \ source-location="https://github.com/stackrox/collector" \ summary="Runtime data collection for Red Hat Advanced Cluster Security for Kubernetes" \ url="https://catalog.redhat.com/software/container-stacks/detail/60eefc88ee05ae7c5b8f041c" \ - version=${COLLECTOR_VERSION} \ + version="${COLLECTOR_TAG}" \ vendor="Red Hat, Inc." ARG BUILD_DIR ARG CMAKE_BUILD_DIR +ENV COLLECTOR_VERSION="${COLLECTOR_TAG}" ENV COLLECTOR_HOST_ROOT=/host COPY kernel-modules/MODULE_VERSION /kernel-modules/MODULE_VERSION.txt