Skip to content
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

Allow passing extra build flags to podman/docker #6421

Closed
4 tasks done
kadel opened this issue Dec 16, 2022 · 2 comments · Fixed by #6785
Closed
4 tasks done

Allow passing extra build flags to podman/docker #6421

kadel opened this issue Dec 16, 2022 · 2 comments · Fixed by #6785
Assignees
Labels
area/odo-on-podman Issues or PRs related to running odo against Podman kind/user-story An issue of user-story kind priority/Medium Nice to have issue. Getting it done before priority changes would be great. sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint.
Milestone

Comments

@kadel
Copy link
Member

kadel commented Dec 16, 2022

/kind user-story

User Story

As an odo user running Mac with AppleSilicon, I want to be able to build images for different platforms (amd64) So that I can run them on my cluster is amd64

Acceptance Criteria

  • odo deploy and odo build-images should check for ODO_IMAGE_BUILD_ARGS env variable and use it as additional arguments for podman/docker build
  • odo run should check for ODO_CONTAINER_RUN_ARGS env variable and use it as additional arguments for podman/docker run
  • Tests
  • Documentation

ODO_IMAGE_BUILD_ARGS we should come up with a better name for this variable. As in the future, we will have in-cluster build where this variable won't make sense.

ODO_CONTAINER_RUN_ARGS come up with better name ;-)

example:

ODO_IMAGE_BUILD_ARGS="--platform linux/amd64" odo deploy should run podman build --platform linux/amd64 ...

for discussion:
Or this could also be a cli flag for odo build-images and odo deploy

/kind user-story

@openshift-ci openshift-ci bot added the kind/user-story An issue of user-story kind label Dec 16, 2022
@kadel kadel changed the title Allow passing extra build parameters Allow passing extra build flags Dec 16, 2022
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. label Dec 16, 2022
@kadel kadel changed the title Allow passing extra build flags Allow passing extra build flags to podman/docker Dec 16, 2022
@rm3l rm3l added this to odo Project Dec 16, 2022
@rm3l
Copy link
Member

rm3l commented Dec 16, 2022

This seems related to #6178

@kadel kadel added the area/odo-on-podman Issues or PRs related to running odo against Podman label Feb 7, 2023
@kadel kadel added the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Mar 10, 2023
@valaparthvi valaparthvi added sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint. and removed needs-triage Indicates an issue or PR lacks a `triage/*` and requires one. labels May 2, 2023
@rm3l rm3l added this to the v3.11.0 🚀 milestone May 2, 2023
@rm3l rm3l moved this to In Progress 🚧 in odo Project May 3, 2023
@rm3l
Copy link
Member

rm3l commented May 4, 2023

To better separate global options from those that are specific to a Podman/Docker sub-command, I have introduced an additional env var (ODO_CONTAINER_BACKEND_GLOBAL_ARGS), which will be passed as global flags to any Podman/Docker command executed by odo.

This will be needed for example if we want to pass global options like --root and --runroot to better isolate our integration tests on Podman.

ODO_IMAGE_BUILD_ARGS will still be passed as flags specific to the podman build and docker build commands.

ODO_CONTAINER_RUN_ARGS will still be passed as flags specific to the commands creating resources, like podman play kube when running odo against Podman.

So for example, running this:

$ ODO_IMAGE_BUILD_ARGS='--platform=linux/amd64;--build-arg=MY_ARG=my_value' \
  ODO_CONTAINER_BACKEND_GLOBAL_ARGS='--root=/tmp/podman/root;--storage-driver=overlay' \
  ODO_CONTAINER_RUN_ARGS='--configmap=cm-foo.yml;--quiet' \
  odo dev --platform=podman

will result in running the following commands:

podman \
  --root=/tmp/podman/root --storage-driver=overlay \
  build \
  --platform=linux/amd64 --build-arg=MY_ARG=my_value \
  ...

...
podman \
  --root=/tmp/podman/root --storage-driver=overlay \
  play kube \
  --configmap=cm-foo.yml --quiet
  ...

...
# Any other podman commands executed by odo under the hood
# will use the global args, e.g.:
podman \
  --root=/tmp/podman/root --storage-driver=overlay \
  pod list --format {{.Name}} --noheading

podman \
  --root=/tmp/podman/root --storage-driver=overlay \
  pod stop $podName

@github-project-automation github-project-automation bot moved this from In Progress 🚧 to Done ✅ in odo Project May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/odo-on-podman Issues or PRs related to running odo against Podman kind/user-story An issue of user-story kind priority/Medium Nice to have issue. Getting it done before priority changes would be great. sprint demo Indicates an issue for which a demo should be recorded and presented at the end of the sprint.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants