-
Notifications
You must be signed in to change notification settings - Fork 462
hack/build-image.sh: Add script to build images #27
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
Conversation
|
/cc @sdemos FYI |
|
@ashcrow: GitHub didn't allow me to request PR reviews from the following users: sdemos, FYI. Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
hack/build-image.sh
Outdated
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.
add info in README and mention the script requires podman
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.
Done.
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.
Washing through $CMD will break any quoting to protect from an invalid ${WHAT}. If we want to echo the commands being executed, we can, since we're already using Bash, use:
set -x
for IMAGE_TO_BUILD in $TOBUILD; do
# ...test for file existence, see my earlier comment...
podman build -t "${NAME}:${VERSION}" -f "${IMAGE_TO_BUILD}"
done
README.md
Outdated
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.
nit: We can get syntax highlighting for this with:
```console
more on using console in openshift/installer#27.
hack/build-image.sh
Outdated
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.
nit: I'd rather send warnings to stderr. For example, see openshift/installer@04fa686.
I also don't see a need for the --- spacers, but if you keep them I think they should go to stderr too.
hack/build-image.sh
Outdated
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.
This you can replace this for loop with:
ALL_IMAGES=Dockerfile.*
hack/build-image.sh
Outdated
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.
No need for sed here. You can use ${parameter#word} prefix removal (defined in POSIX):
echo "- ${x#Dockerfile.}"
hack/build-image.sh
Outdated
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.
It's safer to quote this user-supplied information:
TOBUILD="Dockerfile.${WHAT}"
hack/build-image.sh
Outdated
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.
This wildcard business scares me a bit ;). Can we move the test into your for loop below?
for IMAGE_TO_BUILD in $TOBUILD; do
if ! test -f "${IMAGE_TO_BUILD}"
then
echo "no build file named '${IMAGE_TO_BUILD}'" >&2
echo "WHAT may be invalid: '${WHAT}'" >&2
exit 1
fi
...
done
hack/build-image.sh
Outdated
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.
NAME="${IMAGE_TO_BUILD#Dockerfile.}"
hack/build-image.sh
Outdated
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.
Washing through $CMD will break any quoting to protect from an invalid ${WHAT}. If we want to echo the commands being executed, we can, since we're already using Bash, use:
set -x
for IMAGE_TO_BUILD in $TOBUILD; do
# ...test for file existence, see my earlier comment...
podman build -t "${NAME}:${VERSION}" -f "${IMAGE_TO_BUILD}"
doneBuilds one or all images. Example: $ WHAT=machine-config-daemon ./hack/build-image.sh WHAT targets include: - all - machine-config-controller - machine-config-daemon - machine-config-operator Signed-off-by: Steve Milner <[email protected]>
|
Updated with review items and added two |
Signed-off-by: Steve Milner <[email protected]>
|
Updated. PTAL. |
abhinavdahiya
left a comment
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.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, ashcrow The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…f-reg check for credential before process rhel install with default registry
hack script to build images quickly.
Full Example