commands/{build,cmdutil},pkg/generator: remove build.sh#561
Conversation
This commit moves all functionality of build.sh into the build.go file to embed the functionality into the binary. It also allows the binary to generate the files needed when making tests (Dockerfile and go-test.sh) in case someone tries to build testing enabled images using a project made before that functionality was added. See operator-framework#541
| fmt.Fprintln(os.Stdout, string(o)) | ||
| // if a user is using an older sdk repo as their library, make sure they have required build files | ||
| _, err = os.Stat("tmp/build/test-framework/Dockerfile") | ||
| if err != nil { |
There was a problem hiding this comment.
maybe add a logging to indicate that you are missing the tmp/build/test-framework/Dockerfile and you are going to tmp/build/test-framework/Dockerfile
There was a problem hiding this comment.
offline discussion: generator already prints out the file it is going to generate. so we don't need to add extra a logging statement.
|
lgtm |
| buildTestCmd.Env = goBuildEnv | ||
| o, err := buildTestCmd.CombinedOutput() | ||
| if err != nil { | ||
| cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to build: (%v)", string(o))) |
There was a problem hiding this comment.
Change this to:
log.Fatalf("failed to build: %v (%v)", err, string(o)))And on Line 161 as well. We're phasing out cmdError.ExitWithError since that doesn't really add much.
|
LGTM after nit |
| cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("build command needs exactly 1 argument")) | ||
| } | ||
|
|
||
| cmdutil.MustInProjectRoot() |
There was a problem hiding this comment.
This command breaks support for Ansible Operator because config/config.yaml doesn't exist in our project. Why doesn't this function look for the Dockerfile instead? It would verify we are in the project root and be agnostic to the type of operator.
This commit moves all functionality of build.sh into the build.go
file to embed the functionality into the binary. It also allows the
binary to generate the files needed when making tests (Dockerfile
and go-test.sh) in case someone tries to build testing enabled
images using a project made before that functionality was added.
See #541