Skip to content
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
15 changes: 14 additions & 1 deletion 04_setup_ironic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fi

for IMAGE_VAR in $(env | grep "_LOCAL_IMAGE=" | grep -o "^[^=]*") ; do
IMAGE=${!IMAGE_VAR}
BUILD_COMMAND_ARGS=""

sudo -E podman pull --authfile $PULL_SECRET_FILE $OPENSHIFT_RELEASE_IMAGE

Expand Down Expand Up @@ -67,14 +68,26 @@ for IMAGE_VAR in $(env | grep "_LOCAL_IMAGE=" | grep -o "^[^=]*") ; do
git fetch origin pull/${IMAGE_PR}/head:pr${IMAGE_PR}
git checkout pr${IMAGE_PR}
fi

# If we want to install extra packages, we set the path to a
# file containing the packages (one per line) we want to install
EXTRA_PKGS_FILE_PATH=${IMAGE_VAR/_LOCAL_IMAGE}_EXTRA_PACKAGES
EXTRA_PKGS_FILE=${!EXTRA_PKGS_FILE_PATH:-}
EXTRA_PKGS_FILE=$(cd $OLDPWD; realpath $EXTRA_PKGS_FILE)
if [[ -n $EXTRA_PKGS_FILE ]]; then
cp $EXTRA_PKGS_FILE "$REPOPATH"
EXTRA_PKGS_FILE_NAME=$(basename $EXTRA_PKGS_FILE)
BUILD_COMMAND_ARGS+=" --build-arg EXTRA_PKGS_LIST=$EXTRA_PKGS_FILE_NAME"
fi

# If we built a custom base image, we should use it as a new base in
# the Dockerfile to prevent discrepancies between locally built images.
# Replace all FROM entries with the base-image.
if [[ -n ${BASE_IMAGE_DIR:-} ]]; then
sed -i "s/^FROM [^ ]*/FROM ${BASE_IMAGE_DIR}/g" ${IMAGE_DOCKERFILE}
fi
sudo podman build --authfile $PULL_SECRET_FILE -t ${!IMAGE_VAR} -f $IMAGE_DOCKERFILE .

sudo podman build --authfile $PULL_SECRET_FILE $BUILD_COMMAND_ARGS -t ${!IMAGE_VAR} -f $IMAGE_DOCKERFILE .
cd -
sudo podman push --tls-verify=false --authfile $PULL_SECRET_FILE ${!IMAGE_VAR} ${!IMAGE_VAR}
fi
Expand Down
6 changes: 6 additions & 0 deletions config_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ set -x
# NOTE: If a checkout already exists in $HOME, it won't be re-created.
# NOTE: You must set CUSTOM_REPO_FILE to build some OpenShift images, e.g. ironic ones.

# Use <IMAGE_NAME>_EXTRA_PACKAGES to set the path (relative to dev-scripts or
# absolute) to a file with extra packages to install in the image, one per line.
# At the moment, this option is supported with ironic-image and ironic-inspector-image
# For example:
# export IRONIC_EXTRA_PACKAGES=ironic-extra-pkgs.txt

# Set this variable to point the custom base image to a different location
# It can be an absolute path or a local path under the dev-scripts dir
# export BASE_IMAGE_DIR=base-image
Expand Down