Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: suggestions from sonarcloud quality gate #1108

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ ARG TARGET_ARCH

RUN microdnf install -y make tar gzip which && microdnf clean all

RUN export ARCH=$(uname -m | sed 's/x86_64/amd64/'); curl -L https://go.dev/dl/go1.22.4.linux-${ARCH}.tar.gz | tar -C /usr/local -xzf -
RUN ARCH=$(uname -m | sed 's/x86_64/amd64/') && \
curl -L https://go.dev/dl/go1.22.4.linux-${ARCH}.tar.gz -o go.tar.gz && \
tar -C /usr/local -xzf go.tar.gz && \
rm go.tar.gz

ENV PATH=$PATH:/usr/local/go/bin

# Consume required variables so we can work with make
Expand All @@ -38,9 +42,8 @@ COPY hack/csv-generator.go hack/csv-generator.go
# Copy .golangci.yaml so we can run lint as part of the build process
COPY .golangci.yaml .golangci.yaml

# Build the manager binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGET_ARCH} GO111MODULE=on make manager
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGET_ARCH} GO111MODULE=on make csv-generator
# Build the manager and csv-generator binaries
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGET_ARCH} GO111MODULE=on make manager csv-generator


FROM --platform=linux/${TARGET_ARCH} registry.access.redhat.com/ubi9/ubi-micro
Expand Down
6 changes: 4 additions & 2 deletions validator.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ COPY internal/ internal/
COPY pkg/ pkg/

# Compile for the TARGET_ARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGET_ARCH} GO111MODULE=on go build -a -ldflags="-X 'kubevirt.io/ssp-operator/internal/template-validator/version.COMPONENT=$COMPONENT'\
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGET_ARCH} GO111MODULE=on go build \
-a -ldflags="-X 'kubevirt.io/ssp-operator/internal/template-validator/version.COMPONENT=$COMPONENT'\
-X 'kubevirt.io/ssp-operator/internal/template-validator/version.VERSION=$VERSION'\
-X 'kubevirt.io/ssp-operator/internal/template-validator/version.BRANCH=$BRANCH'\
-X 'kubevirt.io/ssp-operator/internal/template-validator/version.REVISION=$REVISION'" -o kubevirt-template-validator internal/template-validator/main.go
-X 'kubevirt.io/ssp-operator/internal/template-validator/version.REVISION=$REVISION'" \
-o kubevirt-template-validator internal/template-validator/main.go

# Hack: Create an empty directory in the builder image and copy it to the target image to avoid triggering any architecture-specific commands
RUN mkdir emptydir
Expand Down