Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ansible Operator defaults on macOS result in 'No such file or directory' when running docker make targets #4403

Closed
geerlingguy opened this issue Jan 19, 2021 · 7 comments · Fixed by #4489
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. language/ansible Issue is related to an Ansible operator project
Milestone

Comments

@geerlingguy
Copy link
Contributor

Bug Report

What did you do?

I followed the instructions in the Ansible operator quickstart: https://sdk.operatorframework.io/docs/building-operators/ansible/quickstart/

mkdir memcached-operator
cd memcached-operator
operator-sdk init --plugins=ansible --domain=example.com

operator-sdk create api --group cache --version v1 --kind Memcached --generate-role

make docker-build

What did you expect to see?

I expected the image to be built.

What did you see instead? Under which circumstances?

I saw:

$ make docker-build                                            
env: Snitch.app/Contents/Components:/Library/Apple/usr/bin:/Users/jgeerling/.rvm/bin:/Users/jgeerling/Downloads/memcached-operator/bin: No such file or directory
env: Snitch.app/Contents/Components:/Library/Apple/usr/bin:/Users/jgeerling/.rvm/bin:/Users/jgeerling/Downloads/memcached-operator/bin: No such file or directory
docker build . -t controller:latest
env: Snitch.app/Contents/Components:/Library/Apple/usr/bin:/Users/jgeerling/.rvm/bin:/Users/jgeerling/Downloads/memcached-operator/bin: No such file or directory
make: *** [docker-build] Error 127

Environment

Operator type:

/language ansible

Kubernetes cluster type:

vanilla

$ operator-sdk version

operator-sdk version: "v1.3.0", commit: "1abf57985b43bf6a59dcd18147b3c574fa57d3f6", kubernetes version: "v1.19.4", go version: "go1.15.5", GOOS: "darwin", GOARCH: "amd64"

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"clean", BuildDate:"2020-11-12T01:09:16Z", GoVersion:"go1.15.4", Compiler:"gc", Platform:"darwin/amd64"}

Possible Solution

It looks like the Makefile might be overriding my $PATH. env in my path is located in:

$ which env
/usr/bin/env

But that is not in any of the paths that seem to be used by the Makefile :-/

Additional context

N/A

@openshift-ci-robot openshift-ci-robot added the language/ansible Issue is related to an Ansible operator project label Jan 19, 2021
@geerlingguy
Copy link
Contributor Author

Surprisingly, if I comment out the SHELL line below from the generated Makefile, everything works perfectly:

# SHELL := env PATH=$(PATH) /bin/sh

I'm running macOS Big Sur, in zsh shell. Maybe /bin/sh is different?

@geerlingguy
Copy link
Contributor Author

Apparently this also happens in WSL2, according to geerlingguy/kubernetes-101#21

@jmrodri
Copy link
Member

jmrodri commented Jan 25, 2021

Looking at the go plugin we don't set a SHELL but in the ansible and helm plugins we do add that to the generated makefile.

internal/plugins/helm/v1/scaffolds/internal/templates/makefile.go:103:SHELL := env PATH=$(PATH) /bin/sh
internal/plugins/ansible/v1/scaffolds/internal/templates/makefile.go:103:SHELL := env PATH=$(PATH) /bin/sh

@asmacdo
Copy link
Member

asmacdo commented Jan 25, 2021

@estroz
Copy link
Member

estroz commented Jan 25, 2021

/kind bug

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 25, 2021
@estroz estroz added this to the v1.5.0 milestone Jan 25, 2021
@jackson-chris
Copy link

I had just run into a similar problem with the autogenerate Makefile in version 1.4.2 on macOS:

The line:

PATH  := $(PATH):$(PWD)/bin

did not work well when your PATH included entries with spaces (VMWare Fusion adds entries with spaces for example). To resolve this I simply added quotes around the command like below:

PATH  := "$(PATH):$(PWD)/bin"

@varshaprasad96
Copy link
Member

@blindenvy Setting of PATH is no longer required in Ansible/Helm makefiles, since we are directly checking and invoking binaries from $(PWD)/bin. The PR has removed it and the fix should be there in next release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. language/ansible Issue is related to an Ansible operator project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants