--- a/loaders/bitbucket/loader.go Mon Feb 19 00:14:29 2018 -0600
+++ b/loaders/bitbucket/loader.go Mon Feb 19 00:43:38 2018 -0600
@@ -32,6 +32,10 @@
"github.com/go-yaml/yaml"
+ defaultPlan = "default" // Loader is a loader.Loader that loads bitbucket-pipelines.yml files
@@ -51,19 +55,19 @@
if pipeline.Steps.Image.Name != "" {
- image = pipeline.Steps.Image
+ img = pipeline.Steps.Image // if the step has an image with a username, we need to add the tasks to login and logout
- if image.Username != "" {
- registry, _, _ := docker.ParseImage(image.Name)
+ if img.Username != "" { + registry, _, _ := docker.ParseImage(img.Name) // create and add the login task to the stage
loginTask = fmt.Sprintf("%s-%d-login", name, idx)
cfg.Tasks[loginTask] = &docker.Login{
- Username: image.Username,
- Password: image.Password,
+ Username: img.Username, + Password: img.Password, @@ -73,7 +77,7 @@
- } else if image.Username != "" {
+ } else if img.Username != "" { // if we're using the global image and it has a username, we need to add the tasks to the stage
@@ -84,16 +88,16 @@
plan.Stages[idx].Tasks = append(plan.Stages[idx].Tasks, loginTask)
- parsedTasks, err := script.Parse(image.Name, "/bin/sh", pipeline.Steps.Script)
+ parsedTasks, err := script.Parse(img.Name, "/bin/sh", pipeline.Steps.Script) for idx, task := range parsedTasks {
- name := fmt.Sprintf("%s-%d", name, idx)
+ taskName := fmt.Sprintf("%s-%d", name, idx) + cfg.Tasks[taskName] = task - plan.Stages[0].Tasks = append(plan.Stages[0].Tasks, name)
+ plan.Stages[0].Tasks = append(plan.Stages[0].Tasks, taskName) @@ -112,8 +116,8 @@
func addPipelines(base string, defImage image, pipelines map[string][]pipeline, cfg *config.Config) error {
for name, branchPipeline := range pipelines {
if len(branchPipeline) > 0 {
- name := fmt.Sprintf("%s-%s", base, name)
- err := addPipeline(name, defImage, branchPipeline, cfg)
+ planName := fmt.Sprintf("%s-%s", base, name) + err := addPipeline(planName, defImage, branchPipeline, cfg) @@ -190,7 +194,6 @@
// LoadOverride loads the given override file into the config.
func (l *Loader) LoadOverride(base, path string, data []byte, cfg *config.Config, disableDeprecated bool) {
// Filenames returns the list for filenames that this loader supports.
@@ -205,7 +208,7 @@
// DefaultPlan returns the default plan name.
func (l *Loader) DefaultPlan() string {
// ResolvePlanName resolves the plan name if the one in the config contains a
@@ -213,8 +216,8 @@
func (l *Loader) ResolvePlanName(plan string, cfg *config.Config, st *state.State) string {
// try to shortcut if we can
+ if plan == defaultPlan { customPlan := fmt.Sprintf("custom-%s", plan)
@@ -256,5 +259,5 @@
--- a/loaders/bitbucket/types.go Mon Feb 19 00:14:29 2018 -0600
+++ b/loaders/bitbucket/types.go Mon Feb 19 00:43:38 2018 -0600
@@ -44,7 +44,7 @@
- if err := unmarshal(&raw); err != nil {
+ if err = unmarshal(&raw); err != nil { --- a/loaders/codebuild/loader.go Mon Feb 19 00:14:29 2018 -0600
+++ b/loaders/codebuild/loader.go Mon Feb 19 00:43:38 2018 -0600
@@ -32,6 +32,7 @@
"bitbucket.org/rw_grim/convey/tasks"
+// Loader defines an AWS CodeBuild configuration. @@ -62,24 +63,7 @@
-// Need more input to figure out how this works.
-// func (l *Loader) loadDefaultEnvironment() []string {
-// "AWS_DEFAULT_REGION=",
-// "AWS_REGION=" + l.region,
-// "CODEBUILD_BUILD_ARN=",
-// "CODEBUILD_BUILD_ID=",
-// "CODEBUILD_BUILD_IMAGE=" + l.image,
-// "CODEBUILD_BUILD_SUCCEEDING=1", // hard coded for now 1 for succeeding, 0 for failing
-// "CODEBUILD_INITIATOR=convey",
-// "CODEBUILD_KMS_KEY_ID=",
-// "CODEBUILD_RESOLVED_SOURCE_VERSION=",
-// "CODEBUILD_SOURCE_REPO_URL=",
-// "CODEBUILD_SOURCE_VERSION=",
-// "CODEBUILD_SRC_DIR=",
+// Load loads an AWS CodeBuild buildspec.yml. func (l *Loader) Load(path, base string, data []byte, options []string, disableDeprecated bool) (*config.Config, error) {
err := l.loadOptions(options)
@@ -201,21 +185,27 @@
plan.Stages = append(plan.Stages, exportStage)
+// LoadOverride just satisfies the Loader interface an is not implemented. func (l *Loader) LoadOverride(path, base string, data []byte, config *config.Config, disableDeprecated bool) {
+// Filenames returns the filenames defining AWS CodeBuild configurations. func (l *Loader) Filenames() []string {
return []string{"buildspec.yml"}
+// OverrideSuffix just satisfies the Loader interface and is not used. func (l *Loader) OverrideSuffix() string {
+// DefaultPlan returns the default plan to use when an AWS CodeBuild +// configuration is loaded. func (l *Loader) DefaultPlan() string {
+// ResolvePlanName satisfies the LoaderInterface and returns the default value. func (l *Loader) ResolvePlanName(plan string, cfg *config.Config, st *state.State) string {
--- a/loaders/codebuild/types.go Mon Feb 19 00:14:29 2018 -0600
+++ b/loaders/codebuild/types.go Mon Feb 19 00:43:38 2018 -0600
@@ -31,6 +31,8 @@
BaseDirectory string `yaml:"base-directory"`
+// CodeBuild defines the data structure for the top level AWS CodeBuild Version string `yaml:"version"`
Environment environment `yaml:"env"`
--- a/loaders/convey/convey.go Mon Feb 19 00:14:29 2018 -0600
+++ b/loaders/convey/convey.go Mon Feb 19 00:43:38 2018 -0600
@@ -150,24 +150,24 @@
if cfg.RequiredVersion != "" {
- verRange, err := semver.ParseRange(cfg.RequiredVersion)
+ verRange, nErr := semver.ParseRange(cfg.RequiredVersion) - curVer, err := semver.Make(consts.Version)
+ curVer, nErr := semver.Make(consts.Version)
- "convey version %s required, but %s is in use.",
+ "convey version %s required, but %s is in use",
--- a/loaders/convey/tasks.go Mon Feb 19 00:14:29 2018 -0600
+++ b/loaders/convey/tasks.go Mon Feb 19 00:43:38 2018 -0600
@@ -37,10 +37,16 @@
- logger.Warn("the engine attribute is deprecated and will be removed in a future version. Please update to the new type format as this format will be removed in a future version.")
+ msg := "the engine attribute is deprecated and will be removed in a future version. Please update to the new type format as this format will be removed in a future version." + if err := logger.Warn(msg); err != nil { + fmt.Printf("error reporting warning: %s\n", err) if rawEngine == "intrinsic" {
- logger.Warn("the intrinsic engine is deprecated, using convey instead")
+ msg := "the intrinsic engine is deprecated, using convey instead" + if err := logger.Warn(msg); err != nil { + fmt.Printf("error reporting warning: %s\n", err) @@ -55,13 +61,10 @@
typeName := fmt.Sprintf("%s/%s", legacyEngine, legacyType)
- "converted deprecated task format {engine: '%s', type: '%s'} to type %s. Please update to the new type format as this format will be removed in a future version.",
+ msgFmt := "converted deprecated task format {engine: '%s', type: '%s'} to type %s. Please update to the new type format as this format will be removed in a future version." + if err := logger.Warnf(msgFmt, rawEngine, rawType, typeName); err != nil { + fmt.Printf("error reporting warning: %s\n", err) task, ok := cConfig.TasksMap[typeName]