-
Notifications
You must be signed in to change notification settings - Fork 74
Implementation for podman to be used for container images #1357
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
Changes from 4 commits
60baa9e
1e61932
3870586
cce5fe4
965bdcd
f2d6c95
d086125
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,9 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Allow setting of podman environment var in the script runtime | ||
shopt -s expand_aliases | ||
set -eux | ||
|
||
# git ROOT directory used to mount filesystem | ||
GIT_ROOT_DIRECTORY=$(git rev-parse --show-toplevel) | ||
|
@@ -23,6 +26,9 @@ WORKDIR="/projects/src/${GO_MODULE}" | |
# Container image | ||
IMAGE_NAME="quay.io/devfile/kubernetes-api-build-prerequisites:latest" | ||
|
||
# Run script to set env var for podman if necessary | ||
. ./setenv.sh | ||
|
||
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'm not sure I like hiding the alias in a separate script and controlled by an env var -- it's hiding a lot of functionality here (if you don't notice these two lines at the top it looks like it just uses docker). |
||
init() { | ||
BLUE='\033[1;34m' | ||
GREEN='\033[0;32m' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright Red Hat | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This script aliases the docker cli if the environment variable USE_PODMAN is set to true. | ||
|
||
# default value is false if USE_PODMAN is unset or null | ||
podman=${USE_PODMAN:-false} | ||
if [ ${podman} == true ]; then | ||
alias docker=podman | ||
echo "setting alias docker=podman" | ||
fi | ||
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. Why not inline this? 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 do have the same question, why using a separate script just for setting alias? 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. The reasoning for having it in a separate script was only because I was going off of prior work done here by someone else. That repo utilizes the same If it's preferred to be inline that change can definitely be made. 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. The way I've usually done it in other repos is to just use a variable, e.g. DOCKER=docker
if [ <use podman condition> ]; then
DOCKER=podman
fi
$DOCKER build -t <image> -f <file> <context> this also avoids the need for setting 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. In my last commit I added the setting of the alias inline so we don't need another script to be doing that work. I initially tried to go with your way @amisevsk with the use of a variable but found that when it was trying to call the |
Uh oh!
There was an error while loading. Please reload this page.
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 section is duplicating the content in contributing doc. We shouldn't spent effort to maintain same content in separate docs. Please use the link to contributing.md, e.g.
./CONTRIBUTING.md#building
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 agree about the duplication :) Thinking that in general the contribution guidelines are more related to information about how someone could open a PR or an issue, I was wondering if the
contributing.md
is the right file to maintain this section? WDYT?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.
Thank you for pointing that out! To remove the duplication I agree with contributing.md probably not being the right spot for the build instructions, I'll remove it from contributing and keep in in the
readme.md
onlyThere 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.
@yangcao77 @thepetk please see the latest commit for my updated changes.
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.
should directly link to the
building
section. not the top of the contributing doc