From 4f7464dda4bf19d3beb8ae072f5eb69faaf91057 Mon Sep 17 00:00:00 2001 From: Michael Sauter Date: Wed, 27 Sep 2023 14:01:36 +0200 Subject: [PATCH] Catch up with latest changes in ods-pipeline --- Makefile | 10 ++++----- ...{Dockerfile.sonar-scan => Dockerfile.scan} | 21 +++++++++++++++---- build/tasks/scan.yaml | 4 ++-- test/e2e/main_test.go | 2 +- 4 files changed, 25 insertions(+), 12 deletions(-) rename build/images/{Dockerfile.sonar-scan => Dockerfile.scan} (74%) diff --git a/Makefile b/Makefile index 1cd2d2c..d18d558 100644 --- a/Makefile +++ b/Makefile @@ -19,15 +19,15 @@ help: ## Show this help screen. ##@ Building -images: image-sonar-scan ## Build images. +images: image-scan ## Build images. .PHONY: images -image-sonar-scan: ## Build sonar-scan image. +image-scan: ## Build scan image. docker build \ - -f build/images/Dockerfile.sonar-scan \ - -t localhost:5000/ods-pipeline/sonar-scan \ + -f build/images/Dockerfile.scan \ + -t localhost:5000/ods-pipeline/scan \ . -.PHONY: image-sonar-scan +.PHONY: image-scan tasks: ## Render tasks. Use "VERSION=1.0.0 make tasks" to render a specific version. go run github.com/opendevstack/ods-pipeline/cmd/taskmanifest \ diff --git a/build/images/Dockerfile.sonar-scan b/build/images/Dockerfile.scan similarity index 74% rename from build/images/Dockerfile.sonar-scan rename to build/images/Dockerfile.scan index bb77d4e..2dbd0bd 100644 --- a/build/images/Dockerfile.sonar-scan +++ b/build/images/Dockerfile.scan @@ -4,8 +4,8 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] USER root WORKDIR /usr/src/app -ENV SONAR_SCANNER_VERSION=4.6.2.2472 \ - CNES_REPORT_VERSION=4.0.0 +ENV SONAR_SCANNER_VERSION=4.8.0.2856 \ + CNES_REPORT_VERSION=4.2.0 # Install Sonar Scanner. RUN apt-get update && apt-get install -y unzip \ @@ -28,12 +28,25 @@ COPY . . RUN cd cmd/sonar && CGO_ENABLED=0 go build -o /usr/local/bin/sonar # Final image -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 +FROM registry.access.redhat.com/ubi8/nodejs-18:1 + +ENV NPM_CONFIG_PREFIX=$HOME/.npm-global \ + LANG=en_US.UTF-8 \ + LC_ALL=en_US.UTF-8 + +RUN echo id: $(id) && \ + echo node version: $(node --version) && \ + echo npm version: $(npm --version) && \ + echo npx version: $(npx --version) ENV SONAR_EDITION="community" \ JAVA_HOME=/usr/lib/jvm/jre-11 -RUN microdnf install --nodocs java-11-openjdk-headless which && microdnf clean all +USER root +RUN INSTALL_PKGS="java-11-openjdk-headless which" && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + yum -y clean all --enablerepo='*' COPY --from=builder /usr/local/bin/sonar /usr/local/bin/sonar COPY --from=builder /usr/local/sonar-scanner-cli /usr/local/sonar-scanner-cli diff --git a/build/tasks/scan.yaml b/build/tasks/scan.yaml index bfe26cc..d19446c 100644 --- a/build/tasks/scan.yaml +++ b/build/tasks/scan.yaml @@ -20,8 +20,8 @@ spec: default: "false" steps: - name: scan-with-sonar - # Image is built from build/package/Dockerfile.sonar-scan. - image: '{{.ImageRepository}}/sonar-scan:{{.Version}}' + # Image is built from build/package/Dockerfile.scan. + image: '{{.ImageRepository}}/scan:{{.Version}}' env: - name: HOME value: '/tekton/home' diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index 4c432e0..f77a06e 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -29,7 +29,7 @@ func TestMain(m *testing.M) { func testMain(m *testing.M) int { cc, err := ttr.StartKinDCluster( ttr.LoadImage(ttr.ImageBuildConfig{ - Dockerfile: "build/images/Dockerfile.sonar-scan", + Dockerfile: "build/images/Dockerfile.scan", ContextDir: rootPath, }), )