Skip to content

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

Merged
merged 7 commits into from
Nov 22, 2023

Conversation

Jdubrick
Copy link
Contributor

What does this PR do?

This PR enables the use of podman for container images instead of explicitly docker.

Which issue(s) does this PR fix

resolves #1341

PR acceptance criteria

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Open new test/doc issues under the devfile/api repo
  • Check each criteria if:
  • There is a separate tracking issue. Add the issue link under the criteria
    or
  • test/doc updates are made as part of this PR
  • If unchecked, explain why it's not needed
  • Implement podman support for devfile/api build and run scripts.
  • Update documentation to reflect changes in the build/deploy process.
  • Sufficiently test changes made.

How to test changes / Special notes to the reviewer

Run bash ./docker-run.sh ./build.sh with export USE_PODMAN=true for podman testing and export USE_PODMAN=false for docker.

@@ -34,8 +34,8 @@ Release details and process are found in [Devfile Release](RELEASE.md)

## How to build
Copy link
Contributor

@yangcao77 yangcao77 Nov 20, 2023

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

Copy link
Contributor

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?

Copy link
Contributor Author

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 only

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally looks good, left a comment on the doc

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (adb72c3) 35.75% compared to head (d086125) 35.75%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1357   +/-   ##
=======================================
  Coverage   35.75%   35.75%           
=======================================
  Files          52       52           
  Lines        6696     6696           
=======================================
  Hits         2394     2394           
  Misses       4158     4158           
  Partials      144      144           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

docker-run.sh Outdated
Comment on lines 29 to 31
# Run script to set env var for podman if necessary
. ./setenv.sh

Copy link
Contributor

Choose a reason for hiding this comment

The 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).

setenv.sh Outdated
Comment on lines 21 to 25
podman=${USE_PODMAN:-false}
if [ ${podman} == true ]; then
alias docker=podman
echo "setting alias docker=podman"
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not inline this?

Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 setenv.sh script being used alongside an env variable to toggle between podman or docker.

If it's preferred to be inline that change can definitely be made.

Copy link
Contributor

@amisevsk amisevsk Nov 22, 2023

Choose a reason for hiding this comment

The 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 shopt -s expand_alias.

Copy link
Contributor Author

@Jdubrick Jdubrick Nov 22, 2023

Choose a reason for hiding this comment

The 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 ./build.sh script it was failing with a seg fault, this was not happening with setting the alias. I'm not sure why so more investigation will have to be done into that if we want to not use an alias and rather a variable.

@openshift-ci openshift-ci bot removed the lgtm label Nov 22, 2023
Copy link
Contributor

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look good to me. thx for the changes

Copy link

openshift-ci bot commented Nov 22, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: amisevsk, Jdubrick, yangcao77

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Jdubrick Jdubrick merged commit e37cd6b into devfile:main Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement podman support for devfile/api
4 participants