-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add a new hotfix image build script #959
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,10 @@ TAG=latest | |
|
||
ARCH=`uname -m` | ||
|
||
RPM_BUILD_OPTIONS=${RPM_BUILD_OPTIONS:-""} | ||
RPM_BUILD_IMAGE=${RPM_BUILD_IMAGE:-"manageiq/rpm_build:$TAG"} | ||
RPM_PREFIX=${RPM_PREFIX:-"manageiq"} | ||
|
||
while getopts "t:d:r:hblnops" opt; do | ||
while getopts "t:c:d:r:hblnops" opt; do | ||
case $opt in | ||
b) REBUILD_RPM="true" ;; | ||
c) CONTAINER_PREFIX=$OPTARG ;; | ||
d) BASE_DIR=$OPTARG ;; | ||
l) LOCAL_RPM="true" ;; | ||
n) NO_CACHE="true" ;; | ||
|
@@ -19,7 +16,7 @@ while getopts "t:d:r:hblnops" opt; do | |
r) REPO=$OPTARG ;; | ||
s) RELEASE_BUILD="true" ;; | ||
t) TAG=$OPTARG ;; | ||
h) echo "Usage: $0 [-hblnops] [-d BASE_DIR] [-r IMAGE_REPOSITORY] [-t IMAGE_TAG]"; exit 1 | ||
h) echo "Usage: $0 [-hblnops] [-c CONTAINER_PREFIX] [-d BASE_DIR] [-r IMAGE_REPOSITORY] [-t IMAGE_TAG]"; exit 1 | ||
esac | ||
done | ||
|
||
|
@@ -28,10 +25,11 @@ if [ -n "$LOCAL_RPM" ] && [ -n "$REBUILD_RPM" ]; then | |
exit 1 | ||
fi | ||
|
||
REPO=${REPO:-docker.io/manageiq} | ||
BASE_DIR=${BASE_DIR:-$PWD} | ||
CONTAINER_PREFIX=${CONTAINER_PREFIX:-manageiq} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume we'll start using this in the future? I mean for the image names that we loop over There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but for now we can at least have the same options. |
||
IMAGE_DIR="$BASE_DIR/images" | ||
OPERATOR_DIR="$BASE_DIR/manageiq-operator" | ||
REPO=${REPO:-docker.io/manageiq} | ||
|
||
CONTAINER_COMMAND="$(which podman &>/dev/null && echo "podman" || echo "docker")" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
TAG=latest | ||
|
||
ARCH=`uname -m` | ||
|
||
while getopts "t:c:d:r:hblnops" opt; do | ||
case $opt in | ||
b) REBUILD_RPM="true" ;; | ||
c) CONTAINER_PREFIX=$OPTARG ;; | ||
d) BASE_DIR=$OPTARG ;; | ||
l) LOCAL_RPM="true" ;; | ||
n) NO_CACHE="true" ;; | ||
o) NO_OPERATOR="true" ;; | ||
p) PUSH="true" ;; | ||
r) REPO=$OPTARG ;; | ||
s) RELEASE_BUILD="true" ;; | ||
t) TAG=$OPTARG ;; | ||
h) echo "Usage: $0 [-hblnops] [-c CONTAINER_PREFIX] [-d BASE_DIR] [-r IMAGE_REPOSITORY] [-t IMAGE_TAG]"; exit 1 | ||
esac | ||
done | ||
|
||
BASE_DIR=${BASE_DIR:-$PWD} | ||
CONTAINER_PREFIX=${CONTAINER_PREFIX:-manageiq} | ||
IMAGE_DIR="$BASE_DIR/images" | ||
OPERATOR_DIR="$BASE_DIR/manageiq-operator" | ||
REPO=${REPO:-docker.io/manageiq} | ||
|
||
CONTAINER_COMMAND="$(which podman &>/dev/null && echo "podman" || echo "docker")" | ||
|
||
set -e | ||
|
||
pushd $IMAGE_DIR | ||
cmd="$CONTAINER_COMMAND build" | ||
|
||
hotfix_images="manageiq-base manageiq-base-worker manageiq-orchestrator manageiq-webserver-worker manageiq-ui-worker" | ||
for image in $hotfix_images; do | ||
cmd="$CONTAINER_COMMAND build" | ||
|
||
if [ "$CONTAINER_COMMAND" == "podman" ]; then | ||
cmd+=" --format docker" | ||
fi | ||
|
||
cmd+=" --tag $REPO/$image:$TAG \ | ||
--build-arg CONTAINER_PREFIX=$CONTAINER_PREFIX \ | ||
--build-arg FROM_REPO=$REPO \ | ||
--build-arg FROM_TAG=$TAG \ | ||
--pull \ | ||
manageiq-hotfix" | ||
|
||
echo "Building hotfix for $image: $cmd" | ||
$cmd | ||
done | ||
popd | ||
|
||
if [ -n "$PUSH" ]; then | ||
push_images="manageiq-base manageiq-base-worker manageiq-orchestrator manageiq-webserver-worker manageiq-ui-worker" | ||
|
||
for image in $push_images; do | ||
cmd="$CONTAINER_COMMAND push $REPO/$image:$TAG" | ||
|
||
if [ "$CONTAINER_COMMAND" == "podman" ]; then | ||
cmd+=" --format docker" | ||
fi | ||
|
||
echo "Pushing: $cmd" | ||
$cmd | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ARG CONTAINER_PREFIX=manageiq | ||
ARG FROM_REPO=manageiq | ||
ARG FROM_TAG=latest | ||
|
||
FROM ${FROM_REPO}/${CONTAINER_PREFIX}-base:${FROM_TAG} | ||
|
||
COPY rpms/* /tmp/rpms/ | ||
|
||
RUN /create_local_yum_repo.sh && \ | ||
dnf -y --repo=local-rpm update && \ | ||
chgrp -R 0 $APP_ROOT && \ | ||
chmod -R g=u $APP_ROOT && \ | ||
source /etc/default/evm && \ | ||
/usr/bin/generate_rpm_manifest.sh && \ | ||
clean_dnf_rpm |
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont't understand removing these as they are used down below in https://github.com/ManageIQ/manageiq-pods/pull/959/files#diff-1fba65931954c73107694f0b7b964148febc5ba35da6812e1e117dfb37436e77R42-R47 and https://github.com/ManageIQ/manageiq-pods/pull/959/files#diff-1fba65931954c73107694f0b7b964148febc5ba35da6812e1e117dfb37436e77R63
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being said I never understood building the RPMs as part of this script - always felt like if that's what's wanted the rpms should be built separately and then passed in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally downstream builds are using RPM_PREFIX