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

Fix Makefile to take vaules from ENV VAR values #351

Merged
merged 1 commit into from
Sep 8, 2020

Conversation

ArangoGutierrez
Copy link
Contributor

make image and make push fails when trying to set a diff value to
IMAGE_BUILD_CMD, runing the default value

Signed-off-by: Carlos Eduardo Arango Gutierrez carangog@redhat.com

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 6, 2020
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 6, 2020
@ArangoGutierrez
Copy link
Contributor Author

[eduardo@fedora-32-ws node-feature-discovery]$ IMAGE_BUILD_CMD="podman build" make image 
nfd-worker-daemonset.yaml: namespace: kube-system
nfd-worker-daemonset.yaml: image: k8s.gcr.io/nfd/node-feature-discovery:v0.6.0-32-g900c20e
nfd-daemonset-combined.yaml: namespace: kube-system
nfd-daemonset-combined.yaml: image: k8s.gcr.io/nfd/node-feature-discovery:v0.6.0-32-g900c20e
nfd-worker-job.yaml: namespace: kube-system
nfd-worker-job.yaml: image: k8s.gcr.io/nfd/node-feature-discovery:v0.6.0-32-g900c20e
nfd-master.yaml: namespace: kube-system
nfd-master.yaml: image: k8s.gcr.io/nfd/node-feature-discovery:v0.6.0-32-g900c20e
docker build --build-arg VERSION=v0.6.0-32-g900c20e \
        --build-arg HOSTMOUNT_PREFIX=/host- \
        -t k8s.gcr.io/nfd/node-feature-discovery:v0.6.0-32-g900c20e \
         ./
make: docker: Command not found
make: *** [Makefile:47: image] Error 127

@ArangoGutierrez
Copy link
Contributor Author

/assign @marquiz

@ArangoGutierrez
Copy link
Contributor Author

/assign @marquiz

@marquiz
Copy link
Contributor

marquiz commented Sep 7, 2020

With the current Makefile you need to use overrides, like:

make image IMAGE_BUILD_CMD="podman build"

So I would say this PR rather changes the handling of variables than fixes something that is broken.

Nevertheless, this might be a rational change, making customized build possibly a bit less surprsing for users. But, in that case we should change the handling of all variables mentioned in the README in a similar fashion. Also, the commit message subject must be changed to something like

README: blah blah blah

<Explain how variable handling changes>

@ArangoGutierrez
Copy link
Contributor Author

With the current Makefile you need to use overrides, like:

make image IMAGE_BUILD_CMD="podman build"

So I would say this PR rather changes the handling of variables than fixes something that is broken.

Nevertheless, this might be a rational change, making customized build possibly a bit less surprsing for users. But, in that case we should change the handling of all variables mentioned in the README in a similar fashion. Also, the commit message subject must be changed to something like

README: blah blah blah

<Explain how variable handling changes>

Thanks for the review, I applied the same logic to all the variables that can be defined pre-running the make command, and added some documentation on the README

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 7, 2020
Makefile Outdated
Comment on lines 15 to 16
IMAGE_TAG_NAME := $(VERSION)
IMAGE_EXTRA_TAG_NAMES :=
IMAGE_EXTRA_TAG_NAMES ?=
Copy link
Contributor

Choose a reason for hiding this comment

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

IMAGE_TAG_NAME should also be initialized with =?

Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

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

Two small comments.

In addition, please change the commit message to something I outlined in the previous review. I.e. change the formatting a bit and change the message to correspond the reality 😄

@ArangoGutierrez
Copy link
Contributor Author

Two small comments.

In addition, please change the commit message to something I outlined in the previous review. I.e. change the formatting a bit and change the message to correspond the reality smile

Will do thanks. yeah you are right, some times I just get used to small quick messages, but good strong messages are good for maintenance in the long run

@ArangoGutierrez ArangoGutierrez changed the title Fix Makefile for IMAGE_BUILD_CMD and IMAGE_PUSH_CMD Fix Makefile to take vaules from ENV VAR values Sep 8, 2020
@ArangoGutierrez
Copy link
Contributor Author

@marquiz check commit 6cdf681 , it details what is happening on this patch

@marquiz
Copy link
Contributor

marquiz commented Sep 8, 2020

Will do thanks. yeah you are right, some times I just get used to small quick messages, but good strong messages are good for maintenance in the long run

Thanks, the mismatch with the reality of the previous version was quite strong 😉 The commit messages do not always to be super long, even though too long commit messages are rarely a problem.

There's still one unaddressed comment

make image and make push fails when trying to use an ENV VAR value, as
it is now they can only be overrided.

the Var modified are
GO_CMD
GO_FMT
IMAGE_BUILD_EXTRA_OPTS
IMAGE_BUILD_CMD
IMAGE_PUSH_CMD
IMAGE_TAG_NAME
IMAGE_REGISTRY
IMAGE_NAME
IMAGE_EXTRA_TAG_NAMES
K8S_NAMESPACE
HOSTMOUNT_PREFIX

This new behaviour has also been updated on the README.

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
@ArangoGutierrez
Copy link
Contributor Author

Will do thanks. yeah you are right, some times I just get used to small quick messages, but good strong messages are good for maintenance in the long run

Thanks, the mismatch with the reality of the previous version was quite strong wink The commit messages do not always to be super long, even though too long commit messages are rarely a problem.

There's still one unaddressed comment

done

Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

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

Thanks @ArangoGutierrez !
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 8, 2020
@marquiz
Copy link
Contributor

marquiz commented Sep 8, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ArangoGutierrez, marquiz

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2020
@k8s-ci-robot k8s-ci-robot merged commit 535dd0b into kubernetes-sigs:master Sep 8, 2020
@marquiz marquiz mentioned this pull request Nov 20, 2020
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

3 participants