Skip to content

Commit 33f3aba

Browse files
committed
Change logic for Ubuntu
1 parent 6c9b789 commit 33f3aba

File tree

6 files changed

+38
-27
lines changed

6 files changed

+38
-27
lines changed

.github/workflows/arm-AL2023-build-test-push-workflow-AL2023.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ jobs:
9494
- name: Build and push Splunk Operator Image
9595
run: |
9696
export PLATFORMS=linux/arm64
97-
export BASE_OS=public.ecr.aws/amazonlinux/amazonlinux
98-
export BASE_OS_VERSION=2023
97+
export BASE_IMAGE=public.ecr.aws/amazonlinux/amazonlinux
98+
export BASE_IMAGE_VERSION=2023
9999
export IMG=${{ secrets.ECR_REPOSITORY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
100-
make docker-buildx PLATFORMS=$PLATFORMS BASE_OS=$BASE_OS BASE_OS_VERSION=$BASE_OS_VERSION IMG=$IMG
100+
make docker-buildx PLATFORMS=$PLATFORMS BASE_IMAGE=$BASE_IMAGE BASE_IMAGE_VERSION=$BASE_IMAGE_VERSION IMG=$IMG
101101
- name: Sign Splunk Operator image with a key
102102
run: |
103103
cosign sign --yes --key env://COSIGN_PRIVATE_KEY ${{ secrets.ECR_REPOSITORY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:${{ github.sha }}

.github/workflows/arm-AL2023-int-test-workflow.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ jobs:
4343
- name: Build and push Splunk Operator Image
4444
run: |
4545
export PLATFORMS=linux/arm64
46-
export BASE_OS=public.ecr.aws/amazonlinux/amazonlinux
47-
export BASE_OS_VERSION=2023
46+
export BASE_IMAGE=public.ecr.aws/amazonlinux/amazonlinux
47+
export BASE_IMAGE_VERSION=2023
4848
export IMG=${{ secrets.ECR_REPOSITORY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
49-
make docker-buildx PLATFORMS=$PLATFORMS BASE_OS=$BASE_OS BASE_OS_VERSION=$BASE_OS_VERSION IMG=$IMG
49+
make docker-buildx PLATFORMS=$PLATFORMS BASE_IMAGE=$BASE_IMAGE BASE_IMAGE_VERSION=$BASE_IMAGE_VERSION IMG=$IMG
5050
int-tests-arm-al2023:
5151
strategy:
5252
fail-fast: false

.github/workflows/arm-Ubuntu-build-test-push-workflow.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ jobs:
9494
- name: Build and push Splunk Operator Image
9595
run: |
9696
export PLATFORMS=linux/arm64
97-
export BASE_OS=ubuntu
98-
export BASE_OS_VERSION=24.10
97+
export BASE_IMAGE=ubuntu
98+
export BASE_IMAGE_VERSION=24.10
9999
export IMG=${{ secrets.ECR_REPOSITORY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
100-
make docker-buildx PLATFORMS=$PLATFORMS BASE_OS=$BASE_OS BASE_OS_VERSION=$BASE_OS_VERSION IMG=$IMG
100+
make docker-buildx PLATFORMS=$PLATFORMS BASE_IMAGE=$BASE_IMAGE BASE_IMAGE_VERSION=$BASE_IMAGE_VERSION IMG=$IMG
101101
- name: Sign Splunk Operator image with a key
102102
run: |
103103
cosign sign --yes --key env://COSIGN_PRIVATE_KEY ${{ secrets.ECR_REPOSITORY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:${{ github.sha }}

.github/workflows/arm-Ubuntu-int-test-workflow.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ jobs:
4343
- name: Build and push Splunk Operator Image
4444
run: |
4545
export PLATFORMS=linux/arm64
46-
export BASE_OS=ubuntu
47-
export BASE_OS_VERSION=24.10
46+
export BASE_IMAGE=ubuntu
47+
export BASE_IMAGE_VERSION=24.10
4848
export IMG=${{ secrets.ECR_REPOSITORY }}/${{ env.SPLUNK_OPERATOR_IMAGE_NAME }}:$GITHUB_SHA
49-
make docker-buildx PLATFORMS=$PLATFORMS BASE_OS=$BASE_OS BASE_OS_VERSION=$BASE_OS_VERSION IMG=$IMG
49+
make docker-buildx PLATFORMS=$PLATFORMS BASE_IMAGE=$BASE_IMAGE BASE_IMAGE_VERSION=$BASE_IMAGE_VERSION IMG=$IMG
5050
int-tests-arm-ubuntu:
5151
strategy:
5252
fail-fast: false

Dockerfile

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Setup defaults for build arguments
2-
ARG PLATFORMS ?= linux/amd64
3-
ARG BASE_OS ?= registry.access.redhat.com/ubi8/ubi
4-
ARG BASE_OS_VERSION ?= 8.10
2+
ARG PLATFORMS=linux/amd64
3+
ARG BASE_IMAGE=registry.access.redhat.com/ubi8/ubi
4+
ARG BASE_IMAGE_VERSION=8.10
55

66
# Build the manager binary
77
FROM golang:1.23.0 as builder
@@ -26,20 +26,31 @@ COPY hack hack/
2626
# TARGETOS and TARGETARCH are provided(inferred) by buildx via the --platforms flag
2727
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o manager main.go
2828

29-
# Use BASE_OS as the base image
30-
FROM ${BASE_OS}:${BASE_OS_VERSION}
29+
# Use BASE_IMAGE as the base image
30+
FROM ${BASE_IMAGE}:${BASE_IMAGE_VERSION}
3131

3232
ENV OPERATOR=/manager \
3333
USER_UID=1001 \
3434
USER_NAME=nonroot
3535

3636
# Install necessary packages and configure user
37-
RUN yum -y install shadow-utils && \
38-
useradd -ms /bin/bash nonroot -u 1001 && \
39-
yum update -y krb5-libs && yum clean all && \
40-
yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical && \
41-
yum -y update-minimal --security --sec-severity=Moderate && \
42-
yum -y update-minimal --security --sec-severity=Low
37+
RUN if grep -q 'Ubuntu' /etc/os-release; then \
38+
apt-get update && \
39+
apt-get install -y --no-install-recommends passwd=1:4.8.1-1ubuntu5.20.04 && \
40+
useradd -ms /bin/bash nonroot -u 1001 && \
41+
apt-get install -y --no-install-recommends krb5-locales=1.17-6ubuntu4.1 && \
42+
apt-get upgrade -y && \
43+
apt-get install -y --no-install-recommends unattended-upgrades=2.3ubuntu0.1 && \
44+
unattended-upgrades -v --security && \
45+
apt-get clean && rm -rf /var/lib/apt/lists/*; \
46+
else \
47+
yum -y install shadow-utils && \
48+
useradd -ms /bin/bash nonroot -u 1001 && \
49+
yum update -y krb5-libs && yum clean all && \
50+
yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical && \
51+
yum -y update-minimal --security --sec-severity=Moderate && \
52+
yum -y update-minimal --security --sec-severity=Low; \
53+
fi
4354

4455
# Metadata
4556
LABEL name="splunk" \

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,16 @@ docker-push: ## Push docker image with the manager.
152152
# Pass only what is required, the rest will be defaulted
153153
# Setup defaults for build arguments
154154
PLATFORMS ?= linux/amd64
155-
BASE_OS ?= registry.access.redhat.com/ubi8/ubi
156-
BASE_OS_VERSION ?= 8.10
155+
BASE_IMAGE ?= registry.access.redhat.com/ubi8/ubi
156+
BASE_IMAGE_VERSION ?= 8.10
157157
docker-buildx:
158158
@if [ -z "$(IMG)" ]; then \
159159
echo "Error: IMG is a mandatory argument. Usage: make docker-buildx IMG=<image_name> ...."; \
160160
exit 1; \
161161
fi
162162
docker buildx build --push --platform="${PLATFORMS}" \
163-
--build-arg BASE_OS="${BASE_OS}" \
164-
--build-arg BASE_OS_VERSION="${BASE_OS_VERSION}" \
163+
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
164+
--build-arg BASE_IMAGE_VERSION="${BASE_IMAGE_VERSION}" \
165165
--tag "${IMG}" -f Dockerfile .
166166

167167
##@ Deployment

0 commit comments

Comments
 (0)