From 9893b825827dc62c5346d2d166b1a79bc08a3b91 Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Wed, 1 Feb 2017 00:18:53 -0800 Subject: [PATCH] bug with default params to pipeline stack --- Makefile | 4 ++-- templates/assets.go | 28 ++++++++++++++-------------- workflows/pipeline_upsert.go | 13 ++++++++++--- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 94dc69bf..3a64d0dc 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ deps: glide install go generate $(SRC_FILES) -lint: +lint: fmt @echo "=== linting ===" go vet $(SRC_FILES) glide novendor | xargs -n1 golint -set_exit_status @@ -85,7 +85,7 @@ clean: all: clean deps test build fmt: - @echo "=== cleaning ===" + @echo "=== formatting ===" go fmt $(SRC_FILES) diff --git a/templates/assets.go b/templates/assets.go index 27be2bfc..8a45d6e1 100644 --- a/templates/assets.go +++ b/templates/assets.go @@ -129,7 +129,7 @@ func assetsPipelineYml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "assets/pipeline.yml", size: 9525, mode: os.FileMode(420), modTime: time.Unix(1485932360, 0)} + info := bindataFileInfo{name: "assets/pipeline.yml", size: 9525, mode: os.FileMode(420), modTime: time.Unix(1485935988, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -266,13 +266,13 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "assets/bucket.yml": assetsBucketYml, - "assets/cluster.yml": assetsClusterYml, - "assets/pipeline.yml": assetsPipelineYml, - "assets/repo.yml": assetsRepoYml, - "assets/service.yml": assetsServiceYml, + "assets/bucket.yml": assetsBucketYml, + "assets/cluster.yml": assetsClusterYml, + "assets/pipeline.yml": assetsPipelineYml, + "assets/repo.yml": assetsRepoYml, + "assets/service.yml": assetsServiceYml, "assets/vpc-target.yml": assetsVpcTargetYml, - "assets/vpc.yml": assetsVpcYml, + "assets/vpc.yml": assetsVpcYml, } // AssetDir returns the file names below a certain @@ -314,15 +314,16 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ "assets": &bintree{nil, map[string]*bintree{ - "bucket.yml": &bintree{assetsBucketYml, map[string]*bintree{}}, - "cluster.yml": &bintree{assetsClusterYml, map[string]*bintree{}}, - "pipeline.yml": &bintree{assetsPipelineYml, map[string]*bintree{}}, - "repo.yml": &bintree{assetsRepoYml, map[string]*bintree{}}, - "service.yml": &bintree{assetsServiceYml, map[string]*bintree{}}, + "bucket.yml": &bintree{assetsBucketYml, map[string]*bintree{}}, + "cluster.yml": &bintree{assetsClusterYml, map[string]*bintree{}}, + "pipeline.yml": &bintree{assetsPipelineYml, map[string]*bintree{}}, + "repo.yml": &bintree{assetsRepoYml, map[string]*bintree{}}, + "service.yml": &bintree{assetsServiceYml, map[string]*bintree{}}, "vpc-target.yml": &bintree{assetsVpcTargetYml, map[string]*bintree{}}, - "vpc.yml": &bintree{assetsVpcYml, map[string]*bintree{}}, + "vpc.yml": &bintree{assetsVpcYml, map[string]*bintree{}}, }}, }} @@ -372,4 +373,3 @@ func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } - diff --git a/workflows/pipeline_upsert.go b/workflows/pipeline_upsert.go index f4ba52d8..bbf7321b 100644 --- a/workflows/pipeline_upsert.go +++ b/workflows/pipeline_upsert.go @@ -60,11 +60,18 @@ func (workflow *pipelineWorkflow) pipelineUpserter(tokenProvider func(bool) stri } pipelineParams["GitHubUser"] = sourceRepo[0] pipelineParams["GitHubRepo"] = sourceRepo[1] - pipelineParams["GitHubBranch"] = workflow.pipelineConfig.Source.Branch pipelineParams["GitHubToken"] = tokenProvider(pipelineStack == nil) - pipelineParams["BuildType"] = workflow.pipelineConfig.Build.Type - pipelineParams["BuildComputeType"] = workflow.pipelineConfig.Build.ComputeType + if workflow.pipelineConfig.Source.Branch != "" { + pipelineParams["GitHubBranch"] = workflow.pipelineConfig.Source.Branch + } + + if workflow.pipelineConfig.Build.Type != "" { + pipelineParams["BuildType"] = workflow.pipelineConfig.Build.Type + } + if workflow.pipelineConfig.Build.ComputeType != "" { + pipelineParams["BuildComputeType"] = workflow.pipelineConfig.Build.ComputeType + } if workflow.pipelineConfig.Build.Image != "" { pipelineParams["BuildImage"] = workflow.pipelineConfig.Build.Image