pkg/generator: add auto-gen for tmp/build.sh#46
Merged
fanminshi merged 1 commit intooperator-framework:masterfrom Feb 22, 2018
fanminshi:gen_build
Merged
pkg/generator: add auto-gen for tmp/build.sh#46fanminshi merged 1 commit intooperator-framework:masterfrom fanminshi:gen_build
fanminshi merged 1 commit intooperator-framework:masterfrom
fanminshi:gen_build
Conversation
Contributor
Author
|
Manual Test: func TestGenBuild(t *testing.T) {
buf := &bytes.Buffer{}
if err := renderBuildFile(buf, "github.com/coreos/play", "play"); err != nil {
t.Error(err)
return
}
if err := ioutil.WriteFile("./build.sh", buf.Bytes(), 0744); err != nil {
t.Error(err)
}
}Output: #!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if ! which go > /dev/null; then
echo "golang needs to be installed"
exit 1
fi
BIN_DIR="$(pwd)/_output/bin"
mkdir -p ${bin_dir} || true
# set some environment variables
PROJECT_NAME="play"
REPO_PATH="github.com/coreos/play"
BUILD_PATH="${REPO_PATH}/cmd/${PROJECT_NAME}"
echo "building "${PROJECT_NAME}"..."
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ${BIN_DIR}/${PROJECT_NAME} $BUILD_PATH |
Contributor
Author
| exit 1 | ||
| fi | ||
|
|
||
| BIN_DIR="$(pwd)/_output/bin" |
Contributor
There was a problem hiding this comment.
Put _output/ under tmp/
| fi | ||
|
|
||
| BIN_DIR="$(pwd)/_output/bin" | ||
| mkdir -p ${bin_dir} || true |
Contributor
Author
|
Latest Test Output: #!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if ! which go > /dev/null; then
echo "golang needs to be installed"
exit 1
fi
BIN_DIR="$(pwd)/tmp/_output/bin"
mkdir -p ${BIN_DIR} || true
# set some environment variables
PROJECT_NAME="play"
REPO_PATH="github.com/coreos/play"
BUILD_PATH="${REPO_PATH}/cmd/${PROJECT_NAME}"
echo "building "${PROJECT_NAME}"..."
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ${BIN_DIR}/${PROJECT_NAME} $BUILD_PATH |
Contributor
Author
|
all fixed PTAL cc/ @hongchaodeng |
| fi | ||
|
|
||
| BIN_DIR="$(pwd)/tmp/_output/bin" | ||
| mkdir -p ${BIN_DIR} || true |
Contributor
There was a problem hiding this comment.
We don't need || true. mkdir -p succeeds even if the dir exists.
|
|
||
| BIN_DIR="$(pwd)/tmp/_output/bin" | ||
| mkdir -p ${BIN_DIR} || true | ||
| # set some environment variables |
Contributor
There was a problem hiding this comment.
set some environment variables
What are the env used for? Please clarify.
Or if they are obvious, just no comments.
Contributor
Author
There was a problem hiding this comment.
obvious enough. no need to have comment.
| "text/template" | ||
| ) | ||
|
|
||
| // Main Build all the customized data needed to generate tmp/build.sh |
Contributor
There was a problem hiding this comment.
What does "Main Build" mean?
Contributor
Author
|
all fixed! Latest test output: #!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if ! which go > /dev/null; then
echo "golang needs to be installed"
exit 1
fi
BIN_DIR="$(pwd)/tmp/_output/bin"
mkdir -p ${BIN_DIR}
PROJECT_NAME="play"
REPO_PATH="github.com/coreos/play"
BUILD_PATH="${REPO_PATH}/cmd/${PROJECT_NAME}"
echo "building "${PROJECT_NAME}"..."
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ${BIN_DIR}/${PROJECT_NAME} $BUILD_PATH |
Contributor
|
LGTM |
m1kola
pushed a commit
to m1kola/operator-sdk
that referenced
this pull request
Jun 7, 2024
Organize Ansible build/release files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This generates a build script that compiles this operator project into a binary.
Also, we need to think about how to integrate this build script with operator-sdk build command and along with other potential scripts to make
operator-sdk build $IMAGEwork.