Skip to content

Commit b9c3532

Browse files
j-chiamseowwj
andauthored
docker: enable redhat/ubi8
Closes #476 Signed-off-by: Seow, Wen Jie <[email protected]> Signed-off-by: Wei Shan <[email protected]> Signed-off-by: Chiam, Jia Ying <[email protected]> Co-authored-by: Seow, Wen Jie <[email protected]>
1 parent 159c16d commit b9c3532

File tree

4 files changed

+71
-7
lines changed

4 files changed

+71
-7
lines changed

docker/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ consider to create image for interested test for easy reuse.
88

99
## Getting started
1010

11-
```
11+
```bash
1212
git clone https://github.com/intel/lkp-tests.git
1313

1414
cd lkp-tests
1515

1616
image=debian/buster
1717
hostname=lkp-docker.${image//\//.}
1818

19-
docker build -f docker/${image%%/*}/Dockerfile -t lkp-tests/${image} -t lkp-tests/${image}:$(git log -1 --pretty=%h) --build-arg hostname=$hostname --build-arg base_image=$(if [[ "$image" == opensuse/* ]]; then echo "$image" | sed 's|opensuse/\([^/]*\)/|opensuse/\1:|'; else echo ${image//\//:}; fi) .
19+
docker build -f docker/${image%%/*}/Dockerfile -t lkp-tests/${image} -t lkp-tests/${image}:$(git log -1 --pretty=%h) --build-arg hostname=$hostname --build-arg base_image=$(if [[ "$image" == opensuse/* ]]; then echo "$image" | sed 's|opensuse/\([^/]*\)/|opensuse/\1:|'; elif [[ "$image" == redhat/* ]]; then echo "$image" | sed 's|redhat/\([^/]*\)/|redhat/\1:|'; else echo ${image//\//:}; fi) .
2020

2121
docker run --rm --entrypoint '' lkp-tests/${image} lkp help
2222
```
2323

2424
The alternative method to build the image is
2525

26-
```
26+
```bash
2727
lkp docker build --image $image --hostname $hostname
2828
```
2929

3030
## Run one atomic job
3131

32-
```
32+
```bash
3333
# Add --privileged option to allow privileged access like dmesg, sysctl. Use
3434
# this with caution.
3535
docker run -d -h $hostname --name $hostname \
@@ -56,13 +56,13 @@ docker exec -it $hostname bash
5656

5757
The alternative method to attach to a terminal in the docker container is
5858

59-
```
59+
```bash
6060
lkp docker attach --container $hostname
6161
```
6262

6363
The alternative method to run the job is
6464

65-
```
65+
```bash
6666
lkp docker test -i $image -j hackbench.yaml -g pipe-8-process-1600 --hostname $hostname
6767

6868
# The flag --any can be set to let lkp randomly choose a job from the suite
@@ -76,7 +76,7 @@ lkp docker rt --container $hostname --options "hackbench"
7676

7777
## Test by lkp docker
7878

79-
```
79+
```bash
8080
image=debian/bookworm
8181
hostname=lkp-docker.${image//\//.}
8282

docker/build

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ cd $LKP_SRC
6060
# (example: opensuse/leap:latest -> opensuse/leap:latest)
6161
if [[ "$opt_image" == opensuse/* ]]; then
6262
base_image=$(echo "$opt_image" | sed 's|opensuse/\([^/]*\)/|opensuse/\1:|')
63+
elif [[ "$opt_image" == redhat/* ]]; then
64+
base_image=$(echo "$opt_image" | sed 's|redhat/\([^/]*\)/|redhat/\1:|')
6365
else
6466
base_image=${opt_image//\//:}
6567
fi

docker/redhat/CentOS-8-Vault.repo

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[centos-vault]
2+
name=CentOS Vault Repository - BaseOS
3+
baseurl=https://vault.centos.org/8-stream/BaseOS/x86_64/os
4+
enabled=1
5+
gpgcheck=1
6+
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
7+
8+
[centos-vault-extras]
9+
name=CentOS Vault Repository - Extras
10+
baseurl=https://vault.centos.org/8-stream/extras/x86_64/os/
11+
enabled=1
12+
gpgcheck=1
13+
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
14+
15+
[centos-vault-powertools]
16+
name=CentOS Vault Repository - PowerTools
17+
baseurl=https://vault.centos.org/8-stream/PowerTools/x86_64/os/
18+
enabled=1
19+
gpgcheck=1
20+
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
21+
22+
[centos-vault-appstream]
23+
name=CentOS Vault Repository - AppStream
24+
baseurl=https://vault.centos.org/8-stream/AppStream/x86_64/os/
25+
enabled=1
26+
gpgcheck=1
27+
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256

docker/redhat/Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# base image can be redhat/ubi8 etc.
2+
ARG base_image
3+
FROM ${base_image}
4+
5+
# lkp install generates hosts/$HOSTNAME during create_host_config. Here it requires
6+
# user to pass hostname arg to specify a consistent name instead of the container
7+
# hostname when building the image.
8+
ARG hostname=lkp-docker
9+
ENV HOSTNAME=${hostname}
10+
11+
WORKDIR /lkp/lkp-tests
12+
13+
COPY . ./
14+
15+
# UBI8 repos do not have some packages, hence we have to download from CentOS Vault
16+
RUN cp ./docker/redhat/CentOS-8-Vault.repo /etc/yum.repos.d/ && \
17+
dnf config-manager --set-disabled ubi-8-*
18+
19+
# Force ignore error when running `dnf upgrade -y`
20+
# Error: Problem: The operation would result in removing the following protected packages: redhat-release
21+
RUN (dnf upgrade -y || true) && \
22+
dnf install -y \
23+
# kernel-tools installs turbostat
24+
kernel-tools \
25+
make \
26+
# procps installs vmstat, sysctl, etc to partially persistent commonly used dependencies
27+
procps \
28+
perf \
29+
# python3 required by libnuma
30+
python3 \
31+
hostname && \
32+
make install && \
33+
lkp install
34+
35+
ENTRYPOINT ["bash", "-c", "sleep infinity"]

0 commit comments

Comments
 (0)