Skip to content

Commit d1939fa

Browse files
authored
add BUILD OS & Arch to rhel system registration host name (#7895)
1 parent e02d7dc commit d1939fa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

build/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
380380
FROM ubi-9-plus AS ubi-9-plus-nap
381381
ARG NAP_MODULES
382382
ARG NGINX_AGENT
383+
ARG BUILD_OS
383384

384385
RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \
385386
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
@@ -399,7 +400,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
399400
&& rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
400401
&& microdnf --nodocs install -y ca-certificates shadow-utils subscription-manager \
401402
&& if [ "${NGINX_AGENT}" = "true" ]; then microdnf --nodocs install -y nginx-agent-2.*; fi \
402-
&& subscription-manager register --org=${RHEL_ORGANIZATION} --activationkey=${RHEL_ACTIVATION_KEY} || true \
403+
&& subscription-manager register --org=${RHEL_ORGANIZATION} --activationkey=${RHEL_ACTIVATION_KEY} --name ${BUILD_OS}-${NAP_MODULES}-$(uname -m) || true \
403404
&& subscription-manager attach \
404405
&& rpm --import /tmp/app-protect-security-updates.key \
405406
&& if [ -z "${NAP_MODULES##*waf*}" ]; then \
@@ -455,6 +456,7 @@ FROM redhat/ubi8@sha256:244e9858f9d8a2792a3dceb850b4fa8fdbd67babebfde42587bfa919
455456
ARG NAP_MODULES
456457
ARG NGINX_AGENT
457458
ARG NGINX_PLUS_VERSION
459+
ARG BUILD_OS
458460

459461
ENV NGINX_VERSION=${NGINX_PLUS_VERSION}
460462

@@ -482,7 +484,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
482484
&& dnf --nodocs install -y nginx-plus nginx-plus-module-njs nginx-plus-module-otel nginx-plus-module-fips-check \
483485
&& if [ "${NGINX_AGENT}" = "true" ]; then dnf --nodocs install -y nginx-agent-2.*; fi \
484486
&& sed -i 's/\(def in_container():\)/\1\n return False/g' /usr/lib64/python*/*-packages/rhsm/config.py \
485-
&& subscription-manager register --org=${RHEL_ORGANIZATION} --activationkey=${RHEL_ACTIVATION_KEY} || true \
487+
&& subscription-manager register --org=${RHEL_ORGANIZATION} --activationkey=${RHEL_ACTIVATION_KEY} --name ${BUILD_OS}-$(uname -m) || true \
486488
&& subscription-manager attach \
487489
&& dnf config-manager --set-enabled codeready-builder-for-rhel-8-x86_64-rpms \
488490
&& dnf --nodocs install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
@@ -504,6 +506,7 @@ FROM redhat/ubi8@sha256:244e9858f9d8a2792a3dceb850b4fa8fdbd67babebfde42587bfa919
504506
ARG NAP_MODULES
505507
ARG NGINX_AGENT
506508
ARG NGINX_PLUS_VERSION
509+
ARG BUILD_OS
507510

508511
ENV NGINX_VERSION=${NGINX_PLUS_VERSION}
509512

@@ -532,7 +535,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
532535
&& if [ "${NGINX_AGENT}" = "true" ]; then dnf --nodocs install -y nginx-agent-2.*; fi \
533536
## end of duplicated code
534537
&& sed -i 's/\(def in_container():\)/\1\n return False/g' /usr/lib64/python*/*-packages/rhsm/config.py \
535-
&& subscription-manager register --org=${RHEL_ORGANIZATION} --activationkey=${RHEL_ACTIVATION_KEY} || true \
538+
&& subscription-manager register --org=${RHEL_ORGANIZATION} --activationkey=${RHEL_ACTIVATION_KEY} --name ${BUILD_OS}-$(uname -m) || true \
536539
&& subscription-manager attach \
537540
&& dnf config-manager --set-enabled codeready-builder-for-rhel-8-x86_64-rpms \
538541
&& dnf --nodocs install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \

0 commit comments

Comments
 (0)