Skip to content

Commit

Permalink
Merge pull request #1108 from nestoracunablanco/fix/sonarcloudIssues
Browse files Browse the repository at this point in the history
refactor: suggestions from sonarcloud quality gate
  • Loading branch information
kubevirt-bot authored Oct 18, 2024
2 parents 347b29e + a55d285 commit 5adbc74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
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

0 comments on commit 5adbc74

Please sign in to comment.