-
Notifications
You must be signed in to change notification settings - Fork 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
:fix :(docs): changed env PODMAN_BIN to CONTAINER_TOOL #305
Conversation
cmd/settings.go
Outdated
@@ -24,7 +24,7 @@ const ( | |||
|
|||
type Config struct { | |||
RootCommandName string `env:"CMD_NAME" default:"kantra"` | |||
PodmanBinary string `env:"PODMAN_BIN" default:"/usr/bin/podman"` | |||
PodmanBinary string `env:"CONTAINER_TOOL" default:"/usr/bin/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.
My only question here would be whether kantra should keep supporting PODMAN_BIN
as an alias of CONTAINER_TOOL
for compatibility reasons. (Realized my paragraph about this was unclear in #168, so I've edited it to reword.)
I'm not sure either way. (And to be clear, I'm not a maintainer of the repo.)
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.
@eemcmullan your views on this?
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 think it's fine to move ahead with CONTAINER_TOOL
without supporting PODMAN_BIN
. We will then probably want to update instances of the podmanBinary
field to something like containerToolBinary
, but I don't think that was covered in the issue, and it's not a user-facing var, so I am okay with these changes. Thanks for the contribution!
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.
Welcome @eemcmullan do let me know if further changes are required before merging!!
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 am wondering if during the loading, if PODMAN_BIN is set in line 57 below we could use that.
@eemcmullan won't a user set this env var to use docker if they want?
cmd/settings.go
Outdated
@@ -24,7 +24,7 @@ const ( | |||
|
|||
type Config struct { | |||
RootCommandName string `env:"CMD_NAME" default:"kantra"` | |||
PodmanBinary string `env:"PODMAN_BIN" default:"/usr/bin/podman"` | |||
PodmanBinary string `env:"CONTAINER_TOOL" default:"/usr/bin/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.
I think it's fine to move ahead with CONTAINER_TOOL
without supporting PODMAN_BIN
. We will then probably want to update instances of the podmanBinary
field to something like containerToolBinary
, but I don't think that was covered in the issue, and it's not a user-facing var, so I am okay with these changes. Thanks for the contribution!
@soham4abc apologies for the confusion. After discussing with @shawn-hurley we think it's best to support |
Sure... Do you want me to revert the changes to ```PODMAN_BIN? |
@soham4abc We still want to move forward with |
Signed-off-by: soham4abc <[email protected]>
Signed-off-by: soham4abc <[email protected]>
hey @eemcmullan I have made the changes can you please have a look and test on your end! |
Signed-off-by: soham4abc <[email protected]>
Signed-off-by: soham4abc <[email protected]>
@@ -24,6 +24,7 @@ const ( | |||
|
|||
type Config struct { | |||
RootCommandName string `env:"CMD_NAME" default:"kantra"` | |||
ContainerBinary string `env:"CONTAINER_TOOL" default:"/usr/bin/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.
CI is failing because this field will need to also be updated where it is being accessed in the rest of the project. This will be where the different commands run. Please let me know if you have any questions on it.
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.
sure, Any particular directory this should be pointing to as default?
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.
As of the latest changes I removed the default path.
Signed-off-by: soham4abc <[email protected]>
@eemcmullan can you please have a look and run the CI tests? |
Signed-off-by: soham4abc <[email protected]>
cmd/settings.go
Outdated
// Respect existing PODMAN_BIN setting. | ||
if os.Getenv("PODMAN_BIN") != "" { | ||
// Respect existing CONTAINER_TOOL setting. | ||
if os.Getenv("CONTAINER_TOOL") != "" || os.Getenv("PODMAN_BIN") != "" { |
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 think the check should first look for CONTAINER_TOOL
, and then PODMAN_BIN
after, only if the former is empty, so CONTAINER_TOOL
takes priority.
For the Config
struct, we do not need PodmanBinary
any longer - just ContainerBinary
. This field is used throughout the rest of the project to start the different commands, as the commands run in containers. For example, an analyze command will look something like /usr/bin/podman run --entrypoint <analyzer_bin>.... <image>...
where /usr/bin/podman
is set from this config struct. You can see an example of this here: https://github.com/konveyor/kantra/blob/main/cmd/analyze.go#L1476
Once these commands are updated with the new struct field name, they should be able to run, and the CI testing should pass.
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.
Thanks a lot for the review @eemcmullan. I have pushed the recent changes!
…rity Signed-off-by: soham4abc <[email protected]>
@shawn-hurley can you please have a look at the changes and provide your reviews? |
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.
One minor nit
Two environment variables control the container runtime and the kantra image: `PODMAN_BIN` and `RUNNER_IMG`: | ||
- `PODMAN_BIN`: path to your container runtime (podman or docker) | ||
Two environment variables control the container runtime and the kantra image: `CONTAINER_TOOL` and `RUNNER_IMG`: | ||
- `CONTAINER_TOOL`: path to your container runtime (podman or docker) |
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: container tool not container runtime.
Container Runtimes are actually different things https://kubernetes.io/docs/setup/production-environment/container-runtimes/ and in this case we don't work with most container runtimes we work with a container tool which is IMO something different.
We can fix this on a follow up though
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.
Thanks for the review @shawn-hurley!
@eemcmullan do let me know if this PR needs any more changes
This PR changes the environment variable
PODMAN_BIN
toCONTAINER_TOOL
as kantra falls back to docker if podman is not present, this variable name makes much more sense.
@dagood Please do have a look and provide any necessary feedback for the same.
Closes #168