*: add auto-gen for codegen scripts#47
Merged
fanminshi merged 2 commits intooperator-framework:masterfrom Feb 22, 2018
fanminshi:gen_k8s
Merged
*: add auto-gen for codegen scripts#47fanminshi merged 2 commits intooperator-framework:masterfrom fanminshi:gen_k8s
fanminshi merged 2 commits intooperator-framework:masterfrom
fanminshi:gen_k8s
Conversation
Contributor
Author
|
Manual Test: func TestCodeGen(t *testing.T) {
buf := &bytes.Buffer{}
if err := renderBoilerplateFile(buf, "play"); err != nil {
t.Error(err)
return
}
if err := ioutil.WriteFile("./boilerplate.go.txt", buf.Bytes(), 0744); err != nil {
t.Error(err)
}
buf = &bytes.Buffer{}
if err := renderUpdateGeneratedFile(buf, "github.com/coreos/play", "play", "v1alpha1"); err != nil {
t.Error(err)
return
}
if err := ioutil.WriteFile("./update-generated.sh", buf.Bytes(), 0744); err != nil {
t.Error(err)
}
}Output: # update-generated.sh
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
DOCKER_REPO_ROOT="/go/src/github.com/coreos/play"
IMAGE=${IMAGE:-"gcr.io/coreos-k8s-scale-testing/codegen"}
docker run --rm \
-v "$PWD":"$DOCKER_REPO_ROOT" \
-w "$DOCKER_REPO_ROOT" \
"$IMAGE" \
"/go/src/k8s.io/code-generator/generate-groups.sh" \
"all" \
"github.com/coreos/play/pkg/generated" \
"github.com/coreos/play/pkg/apis" \
"play:v1alpha1" \
--go-header-file "./hack/codegen/boilerplate.go.txt" \
$@
. |
Contributor
Author
Contributor
|
LGTM Just to make sure, this build file will not be generated at |
Contributor
Author
|
@hongchaodeng depends on how we going to run the script. we can decided that later on when to run this script. |
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.
auto-gen codegen scripts.