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

cmd/build: Add buildah support #1311

Merged
merged 5 commits into from
Apr 17, 2019

Conversation

mkimuram
Copy link
Contributor

Description of the change:
This PR adds buildah support.

Motivation for the change:
operator-sdk should support building image by using buildah.
There is an existing discussion for motivation in #563 .

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 10, 2019
@openshift-ci-robot
Copy link

Hi @mkimuram. Thanks for your PR.

I'm waiting for a operator-framework or openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 10, 2019
@mkimuram
Copy link
Contributor Author

It seems that #563 is doing a similar change, but it has no update for a long time.
I guess that the reason that the PR takes much time to merge would be that the PR includes big changes on other features like multi-stage builds and adding e2e tests to use buildah everywhere, therefore I hope that this PR helps making progress on just supporting buildah.
(Actually, I had a trouble in building operator in my only-buildah-installed environment, so adding this feature early will help me a lot.)

For memcached-operator, builds with below commands succeeded after applying this PR,
in an envrionment where buildah is installed.

$ export IMAGE=quay.io/example-inc/memcached-operator:v0.0.1
$ operator-sdk build --image-builder buildah $IMAGE
$ sed "s@REPLACE_IMAGE@$IMAGE@g" -i deploy/operator.yaml
$ operator-sdk build --image-builder buildah --enable-tests $IMAGE

@estroz @AlexNPavel @shawn-hurley

Could you review this PR?

Copy link
Member

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

I like that this uses a flag to tell the build to use buildah and keeps the same default, this allows us to switch the default when it makes sense.

I wonder if there is some way to hide the switch statement in its own function because we have to do it twice? I looked at it, and it might not be super easy but would like to see an attempt.

WDYT?

@@ -63,6 +65,8 @@ For example:
buildCmd.Flags().StringVar(&testLocationBuild, "test-location", "./test/e2e", "Location of tests")
buildCmd.Flags().StringVar(&namespacedManBuild, "namespaced-manifest", "deploy/operator.yaml", "Path of namespaced resources manifest for tests")
buildCmd.Flags().StringVar(&dockerBuildArgs, "docker-build-args", "", "Extra docker build arguments as one string such as \"--build-arg https_proxy=$https_proxy\"")
buildCmd.Flags().StringVar(&buildahBuildArgs, "buildah-build-args", "", "Extra buildah build arguments as one string such as \"--build-arg https_proxy=$https_proxy\"")
Copy link
Member

Choose a reason for hiding this comment

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

WDYT of re-using a flag build-args for both docker and buildah?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we rename docker-build-args with something like image-build-args?

Then re-using flag makes sense to me. I'm not sure how operator-sdk community thinks about the backward compatibility of command line option.

Copy link
Member

Choose a reason for hiding this comment

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

image-build-args is fine with me. We'll have to add these changes to the CHANGELOG.md too.

Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

I'm fine with these changes overall. A few points need addressing first.

cmd/operator-sdk/build/cmd.go Outdated Show resolved Hide resolved
cmd/operator-sdk/build/cmd.go Outdated Show resolved Hide resolved
cmd/operator-sdk/build/cmd.go Outdated Show resolved Hide resolved
@mkimuram
Copy link
Contributor Author

@shawn-hurley @estroz

Thank you for your feedback. I've fixed as suggested. PTAL

CHANGELOG.md Outdated Show resolved Hide resolved
@mkimuram
Copy link
Contributor Author

@estroz

Thank you for your suggestion. Fixed as suggested again. PTAL

@estroz
Copy link
Member

estroz commented Apr 11, 2019

/lgtm

/cc @theishshah

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 11, 2019
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 11, 2019
@mkimuram
Copy link
Contributor Author

Below error happens without quote for [docker, buildah], so fixed in the last commit.

./hack/ci/marker --root=doc
Found broken reference (docker, buildah -> docker, buildah) at doc/sdk-cli-reference.md:20
make: *** [test/markdown] Error 1

@AlexNPavel
Copy link
Contributor

/retest

@shawn-hurley
Copy link
Member

/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 12, 2019
@shawn-hurley
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 12, 2019
@shawn-hurley shawn-hurley changed the title Add buildah support cmd/build: Add buildah support Apr 12, 2019
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2019
@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@mkimuram
Copy link
Contributor Author

Rebased again to resolve conflict. PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants