Skip to content

Commit c3508bc

Browse files
committed
ROX-24040: Set Podman instead of Docker to fix RHEL8 builders
1 parent f34ff11 commit c3508bc

File tree

314 files changed

+3170
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+3170
-7
lines changed

Dockerfile

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ WORKDIR /src
88
RUN go env -w GOCACHE=/go/.cache; \
99
go env -w GOMODCACHE=/go/pkg/mod
1010

11+
# We previously used --mount=type=bind in the next RUN command
12+
# (see https://docs.docker.com/build/guide/mounts/#add-bind-mounts)
13+
# but this did not work with SELinux volumes and Docker, as only
14+
# Podman supports the relabel=shared option
15+
# (see https://docs.podman.io/en/v4.4/markdown/options/mount.html).
16+
# This adds a layer but works with Docker and Podman.
17+
COPY go.mod go.sum ./
18+
1119
RUN --mount=type=cache,target=/go/pkg/mod/ \
12-
--mount=type=bind,source=go.sum,target=go.sum \
13-
--mount=type=bind,source=go.mod,target=go.mod \
1420
go mod download -x
1521

1622
COPY . ./

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -497,12 +497,12 @@ docker/login: docker/login/fleet-manager
497497
.PHONY: docker/login
498498

499499
docker/login/fleet-manager:
500-
@docker logout quay.io
500+
$(DOCKER) logout quay.io || true # Swallog podman error if not logged in
501501
@DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) login -u "${QUAY_USER}" --password-stdin <<< "${QUAY_TOKEN}" quay.io
502502
.PHONY: docker/login/fleet-manager
503503

504504
docker/login/probe:
505-
@docker logout quay.io
505+
$(DOCKER) logout quay.io || true # Swallow podman error if not logged in
506506
@DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) login -u "${QUAY_PROBE_USER}" --password-stdin <<< "${QUAY_PROBE_TOKEN}" quay.io
507507
.PHONY: docker/login/probe
508508

@@ -563,7 +563,7 @@ image/push: image/push/fleet-manager image/push/probe
563563

564564
image/push/fleet-manager: IMAGE_REF="$(external_image_registry)/$(image_repository):$(image_tag)"
565565
image/push/fleet-manager:
566-
DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) buildx build -t $(IMAGE_REF) --platform $(IMAGE_PLATFORM) --push .
566+
DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) buildx build -t $(IMAGE_REF) --platform $(IMAGE_PLATFORM) --output=type=registry .
567567
@echo
568568
@echo "Image was pushed as $(IMAGE_REF). You might want to"
569569
@echo "export FLEET_MANAGER_IMAGE=$(IMAGE_REF)"
@@ -579,7 +579,7 @@ image/push/probe: image/build/probe
579579
# push the image to the OpenShift internal registry
580580
image/push/internal: IMAGE_TAG ?= $(image_tag)
581581
image/push/internal: docker/login/internal
582-
$(DOCKER) buildx build -t "$(shell oc get route default-route -n openshift-image-registry -o jsonpath="{.spec.host}")/$(NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)" --platform linux/amd64 --push .
582+
$(DOCKER) buildx build -t "$(shell oc get route default-route -n openshift-image-registry -o jsonpath="{.spec.host}")/$(NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)" --platform linux/amd64 --output=type=registry .
583583
.PHONY: image/push/internal
584584

585585
image/build/fleetshard-operator: IMAGE_REF="$(external_image_registry)/fleetshard-operator:$(image_tag)"

build_push_app_interface.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/bin/bash -ex
22
#
33
# Copyright (c) 2024 Red Hat, Inc.
44
#
@@ -36,6 +36,9 @@ IMAGE_REPOSITORY="${QUAY_IMAGE_REPOSITORY:-app-sre/acs-fleet-manager}"
3636
PROBE_IMAGE_REPOSITORY="${PROBE_QUAY_IMAGE_REPOSITORY:-app-sre/acscs-probe}"
3737
EMAILSENDER_IMAGE_REPOSITORY="${PROBE_QUAY_IMAGE_REPOSITORY:-app-sre/acscs-emailsender}"
3838

39+
# Support RHEL8 build images for App-Interface ci-ext
40+
# export DOCKER=podman
41+
3942
source ./scripts/build_setup.sh
4043

4144
# Push the image:

type=registry/root/.bash_logout

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ~/.bash_logout
2+

type=registry/root/.bash_profile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# .bash_profile
2+
3+
# Get the aliases and functions
4+
if [ -f ~/.bashrc ]; then
5+
. ~/.bashrc
6+
fi
7+
8+
# User specific environment and startup programs
9+
10+
PATH=$PATH:$HOME/bin
11+
12+
export PATH

type=registry/root/.bashrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# .bashrc
2+
3+
# User specific aliases and functions
4+
5+
alias rm='rm -i'
6+
alias cp='cp -i'
7+
alias mv='mv -i'
8+
9+
# Source global definitions
10+
if [ -f /etc/bashrc ]; then
11+
. /etc/bashrc
12+
fi

type=registry/root/.cshrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# .cshrc
2+
3+
# User specific aliases and functions
4+
5+
alias rm 'rm -i'
6+
alias cp 'cp -i'
7+
alias mv 'mv -i'

type=registry/root/.tcshrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# .tcshrc
2+
3+
# User specific aliases and functions
4+
5+
alias rm 'rm -i'
6+
alias cp 'cp -i'
7+
alias mv 'mv -i'
8+
9+
set prompt='[%n@%m %c]# '
10+

type=registry/root/anaconda-ks.cfg

+248
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
#version=RHEL8
2+
# Reboot after installation
3+
reboot
4+
# Use text mode install
5+
text
6+
7+
repo --name="koji-override-0" --baseurl=http://download.devel.redhat.com/released/rhel-8/RHEL-8/8.10.0/BaseOS/x86_64/os/ --noverifyssl
8+
repo --name="koji-override-1" --baseurl=https://rhsm-pulp.corp.redhat.com/content/dist/rhel8/8/x86_64/appstream/os --noverifyssl
9+
repo --name="koji-override-2" --baseurl=https://rhsm-pulp.corp.redhat.com/content/dist/rhel8/8/x86_64/baseos/os --noverifyssl
10+
repo --name="koji-override-3" --baseurl=http://download.devel.redhat.com/released/rhel-8/RHEL-8/8.10.0/AppStream/x86_64/os/ --noverifyssl
11+
12+
%post --logfile=/root/anaconda-post.log --erroronfail
13+
set -eux
14+
15+
# Support for subscription-manager secrets
16+
ln -s /run/secrets/etc-pki-entitlement /etc/pki/entitlement-host
17+
ln -s /run/secrets/rhsm /etc/rhsm-host
18+
19+
#https://bugzilla.redhat.com/show_bug.cgi?id=1201663
20+
rm -f /etc/systemd/system/multi-user.target.wants/rhsmcertd.service
21+
22+
#fips mode
23+
# secrets patch creates /run/secrets/system-fips if /etc/system-fips exists on the host
24+
#in turn, openssl in the container checks /etc/system-fips but dangling symlink counts as nonexistent
25+
ln -s /run/secrets/system-fips /etc/system-fips
26+
27+
# Set install langs macro so that new rpms that get installed will
28+
# only install langs that we limit it to.
29+
LANG="C.utf8"
30+
echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf
31+
echo "LANG=C.utf8" > /etc/locale.conf
32+
33+
# https://bugzilla.redhat.com/show_bug.cgi?id=1400682
34+
# https://bugzilla.redhat.com/show_bug.cgi?id=1672230
35+
echo "Import RPM GPG key"
36+
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
37+
38+
#echo "# fstab intentionally empty for containers" > /etc/fstab
39+
#this is not possible, guestmount needs fstab => brew build crashes without it
40+
#fstab is removed in TDL when tar-ing files
41+
42+
# Remove network configuration files leftover from anaconda installation
43+
# https://bugzilla.redhat.com/show_bug.cgi?id=1713089
44+
rm -f /etc/sysconfig/network-scripts/ifcfg-*
45+
46+
# Remove machine-id on pre generated images
47+
rm -f /etc/machine-id
48+
touch /etc/machine-id
49+
# Keep permissions the same as the systemd RPM so rpm --verify works
50+
chmod 0444 /etc/machine-id
51+
52+
%end
53+
54+
%post --logfile=/root/anaconda-post.log --erroronfail
55+
# remove some random help txt files
56+
rm -fv usr/share/gnupg/help*.txt
57+
58+
# Pruning random things
59+
rm usr/lib/rpm/rpm.daily
60+
rm -rfv usr/lib64/nss/unsupported-tools/ # unsupported
61+
62+
# Statically linked crap
63+
rm -fv usr/sbin/{glibc_post_upgrade.x86_64,sln}
64+
ln usr/bin/ln usr/sbin/sln
65+
66+
# Remove some dnf info
67+
rm -rfv /var/lib/dnf
68+
69+
# don't need icons
70+
rm -rfv /usr/share/icons/*
71+
72+
#some random not-that-useful binaries
73+
rm -fv /usr/bin/pinky
74+
75+
# we lose presets by removing /usr/lib/systemd but we do not care
76+
rm -rfv /usr/lib/systemd
77+
78+
# if you want to change the timezone, bind-mount it from the host or reinstall tzdata
79+
rm -fv /etc/localtime
80+
mv /usr/share/zoneinfo/UTC /etc/localtime
81+
rm -rfv /usr/share/zoneinfo
82+
83+
# Final pruning
84+
rm -rfv /var/cache/* /var/log/* /tmp/*
85+
86+
# remove the original RHEL8 EULA
87+
# TODO: This affects the integrity of the installed rpm. Find a better way.
88+
rm -f /usr/share/redhat-release/EULA
89+
90+
# install the repofile
91+
cat > /etc/yum.repos.d/ubi.repo <<EOF
92+
[ubi-8-baseos-rpms]
93+
name = Red Hat Universal Base Image 8 (RPMs) - BaseOS
94+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/baseos/os
95+
enabled = 1
96+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
97+
gpgcheck = 1
98+
99+
[ubi-8-baseos-debug-rpms]
100+
name = Red Hat Universal Base Image 8 (Debug RPMs) - BaseOS
101+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/baseos/debug
102+
enabled = 0
103+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
104+
gpgcheck = 1
105+
106+
[ubi-8-baseos-source]
107+
name = Red Hat Universal Base Image 8 (Source RPMs) - BaseOS
108+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/baseos/source/SRPMS
109+
enabled = 0
110+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
111+
gpgcheck = 1
112+
113+
[ubi-8-appstream-rpms]
114+
name = Red Hat Universal Base Image 8 (RPMs) - AppStream
115+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/appstream/os
116+
enabled = 1
117+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
118+
gpgcheck = 1
119+
120+
[ubi-8-appstream-debug-rpms]
121+
name = Red Hat Universal Base Image 8 (Debug RPMs) - AppStream
122+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/appstream/debug
123+
enabled = 0
124+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
125+
gpgcheck = 1
126+
127+
[ubi-8-appstream-source]
128+
name = Red Hat Universal Base Image 8 (Source RPMs) - AppStream
129+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/appstream/source/SRPMS
130+
enabled = 0
131+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
132+
gpgcheck = 1
133+
134+
[ubi-8-codeready-builder-rpms]
135+
name = Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder
136+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/codeready-builder/os
137+
enabled = 1
138+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
139+
gpgcheck = 1
140+
141+
[ubi-8-codeready-builder]
142+
name = Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder
143+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/codeready-builder/os
144+
enabled = 0
145+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
146+
gpgcheck = 1
147+
148+
149+
[ubi-8-codeready-builder-debug-rpms]
150+
name = Red Hat Universal Base Image 8 (Debug RPMs) - CodeReady Builder
151+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/codeready-builder/debug
152+
enabled = 0
153+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
154+
gpgcheck = 1
155+
156+
[ubi-8-codeready-builder-source]
157+
name = Red Hat Universal Base Image 8 (Source RPMs) - CodeReady Builder
158+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/\$basearch/codeready-builder/source/SRPMS
159+
enabled = 0
160+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
161+
gpgcheck = 1
162+
EOF
163+
164+
%end
165+
166+
%post --nochroot --logfile=/mnt/sysimage/root/anaconda-post-nochroot.log --erroronfail
167+
set -eux
168+
169+
# https://bugzilla.redhat.com/show_bug.cgi?id=1343138
170+
# Fix /run/lock breakage since it's not tmpfs in docker
171+
# This unmounts /run (tmpfs) and then recreates the files
172+
# in the /run directory on the root filesystem of the container
173+
# NOTE: run this in nochroot because "umount" does not exist in chroot
174+
umount /mnt/sysimage/run
175+
# The file that specifies the /run/lock tmpfile is
176+
# /usr/lib/tmpfiles.d/legacy.conf, which is part of the systemd
177+
# rpm that isn't included in this image. We'll create the /run/lock
178+
# file here manually with the settings from legacy.conf
179+
# NOTE: chroot to run "install" because it is not in anaconda env
180+
chroot /mnt/sysimage install -d /run/lock -m 0755 -o root -g root
181+
182+
183+
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1051816
184+
# NOTE: run this in nochroot because "find" does not exist in chroot
185+
KEEPLANG=en_US
186+
for dir in locale i18n; do
187+
find /mnt/sysimage/usr/share/${dir} -mindepth 1 -maxdepth 1 -type d -not \( -name "${KEEPLANG}" -o -name POSIX \) -exec rm -rfv {} +
188+
done
189+
190+
%end
191+
192+
%packages --excludedocs --nocore --instLangs=en --excludeWeakdeps
193+
bash
194+
coreutils-single
195+
glibc-minimal-langpack
196+
libusbx
197+
microdnf
198+
redhat-release
199+
rootfiles
200+
-crypto-policies-scripts
201+
-dosfstools
202+
-e2fsprogs
203+
-fuse-libs
204+
-gnupg2-smime
205+
-kernel
206+
-libss
207+
-pinentry
208+
-qemu-guest-agent
209+
-shared-mime-info
210+
-trousers
211+
-xfsprogs
212+
-xkeyboard-config
213+
214+
%end
215+
216+
# Keyboard layouts
217+
keyboard --vckeymap=us --xlayouts='us'
218+
# System language
219+
lang en_US.UTF-8
220+
221+
# Network information
222+
network --bootproto=dhcp --device=link --activate
223+
network --hostname=localhost.localdomain
224+
225+
# Use network installation
226+
url --url="http://download.devel.redhat.com/released/rhel-8/RHEL-8/8.10.0/BaseOS/x86_64/os/" --noverifyssl
227+
228+
# Do not configure the X Window System
229+
skipx
230+
231+
ignoredisk --only-use=vda
232+
# System bootloader configuration
233+
bootloader --disabled
234+
autopart --type=plain --fstype=ext4 --nohome --noboot --noswap
235+
# Clear the Master Boot Record
236+
zerombr
237+
# Partition clearing information
238+
clearpart --all
239+
240+
# System timezone
241+
timezone Etc/UTC --isUtc --nontp
242+
243+
# Root password
244+
rootpw --iscrypted --lock locked
245+
246+
%addon com_redhat_kdump --disable --reserve-mb='auto'
247+
248+
%end

0 commit comments

Comments
 (0)