Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to apply upstream patches to the image #209

Merged
merged 1 commit into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ FROM docker.io/centos:centos8

ENV PKGS_LIST=main-packages-list.txt
ARG EXTRA_PKGS_LIST
ARG PATCH_LIST

COPY ${PKGS_LIST} ${EXTRA_PKGS_LIST} /tmp/
COPY prepare-image.sh /bin/
COPY ${PKGS_LIST} ${EXTRA_PKGS_LIST} ${PATCH_LIST} /tmp/
COPY prepare-image.sh patch-image.sh /bin/

RUN prepare-image.sh && \
rm -f /bin/prepare-image.sh
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,16 @@ The ironic configuration can be overridden by various environment variables. The
- OS_CONDUCTOR__INSPECT_TIMEOUT=1800 - timeout (seconds) for waiting for node inspection
- OS_CONDUCTOR__CLEAN_CALLBACK_TIMEOUT=1800 - timeout (seconds) to wait for a callback from the ramdisk doing the cleaning
- OS_PXE__BOOT_RETRY_TIMEOUT=1200 - timeout (seconds) to enable boot retries.

Applying Patches to the image
-----------------------------

When building the image, it is possible to specify a patch of one or more
upstream projects to apply to the image, passing a file with the patch list
using the PATCH_LIST build argument.
At the moment, only projects hosted in opendev.org are supported.

elfosardo marked this conversation as resolved.
Show resolved Hide resolved
Each line of the file is in the form "project_dir refspec" where:
- project is the last part of the project url including the org, for example openstack/ironic
- refspec is the gerrit refspec of the patch we want to test, for example refs/changes/67/759567/1

29 changes: 29 additions & 0 deletions patch-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/bash
set -ex

patch_file="/tmp/${PATCH_LIST}"

while IFS= read -r line
do
# each line is in the form "project_dir refsspec" where:
# - project is the last part of the project url including the org,
# for example openstack/ironic
# - refspec is the gerrit refspec of the patch we want to test,
# for example refs/changes/67/759567/1
PROJECT=$(echo $line | cut -d " " -f1)
PROJ_NAME=$(echo $PROJECT | cut -d "/" -f2)
PROJ_URL="https://opendev.org/$PROJECT"
REFSPEC=$(echo $line | cut -d " " -f2)

cd /tmp
git clone "$PROJ_URL"
cd "$PROJ_NAME"
git fetch "$PROJ_URL" "$REFSPEC"
git checkout FETCH_HEAD

SKIP_GENERATE_AUTHORS=1 SKIP_WRITE_GIT_CHANGELOG=1 python3 setup.py sdist
pip3 install dist/*.tar.gz
done < "$patch_file"

cd /

6 changes: 6 additions & 0 deletions prepare-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ if [[ ! -z ${EXTRA_PKGS_LIST} ]]; then
fi
dnf clean all
rm -rf /var/cache/{yum,dnf}/*
if [[ ! -z ${PATCH_LIST} ]]; then
if [[ -s "/tmp/${PATCH_LIST}" ]]; then
/bin/patch-image.sh;
fi
fi
rm -f /bin/patch-image.sh