From c24d4ca50e0d2972c777fad6e04c4bd1848d2cf2 Mon Sep 17 00:00:00 2001 From: Papik Tamas Date: Mon, 11 Mar 2019 16:28:02 +0100 Subject: [PATCH 1/2] added projectType and step startTime --- cli/run_util.go | 78 +++++++++++++++++++++++++----------------------- models/models.go | 14 +++++---- 2 files changed, 48 insertions(+), 44 deletions(-) diff --git a/cli/run_util.go b/cli/run_util.go index 1fe2ccd2..62deb4a4 100644 --- a/cli/run_util.go +++ b/cli/run_util.go @@ -530,7 +530,7 @@ func activateAndRunSteps( // ------------------------------------------ // In function method - Registration methods, for register step run results. registerStepRunResults := func(step stepmanModels.StepModel, stepInfoPtr stepmanModels.StepInfoModel, - stepIdxPtr int, runIf string, resultCode, exitCode int, err error, isLastStep, printStepHeader bool) { + stepIdxPtr int, runIf string, resultCode, exitCode int, err error, isLastStep, printStepHeader bool, startTime time.Time) { if printStepHeader { bitrise.PrintRunningStepHeader(stepInfoPtr, step, stepIdxPtr) @@ -552,12 +552,13 @@ func activateAndRunSteps( } stepResults := models.StepRunResultsModel{ - StepInfo: stepInfoCopy, - Status: resultCode, - Idx: buildRunResults.ResultsCount(), - RunTime: time.Now().Sub(stepStartTime), - ErrorStr: errStr, - ExitCode: exitCode, + StepInfo: stepInfoCopy, + Status: resultCode, + Idx: buildRunResults.ResultsCount(), + RunTime: time.Now().Sub(stepStartTime), + ErrorStr: errStr, + ExitCode: exitCode, + StartTime: startTime, } isExitStatusError := true @@ -622,7 +623,7 @@ func activateAndRunSteps( if err := bitrise.CleanupStepWorkDir(); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } @@ -630,13 +631,13 @@ func activateAndRunSteps( // Preparing the step if err := tools.EnvmanInitAtPath(configs.InputEnvstorePath); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } if err := tools.ExportEnvironmentsList(configs.InputEnvstorePath, *environments); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } @@ -644,7 +645,7 @@ func activateAndRunSteps( compositeStepIDStr, workflowStep, err := models.GetStepIDStepDataPair(stepListItm) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } stepInfoPtr.ID = compositeStepIDStr @@ -657,7 +658,7 @@ func activateAndRunSteps( stepIDData, err := models.CreateStepIDDataFromString(compositeStepIDStr, defaultStepLibSource) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } stepInfoPtr.ID = stepIDData.IDorURI @@ -677,7 +678,7 @@ func activateAndRunSteps( stepAbsLocalPth, err := pathutil.AbsPath(stepIDData.IDorURI) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } @@ -685,13 +686,13 @@ func activateAndRunSteps( if err := command.CopyDir(stepAbsLocalPth, stepDir, true); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } if err := command.CopyFile(filepath.Join(stepAbsLocalPth, "step.yml"), stepYMLPth); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } } else if stepIDData.SteplibSource == "git" { @@ -699,7 +700,7 @@ func activateAndRunSteps( repo, err := git.New(stepDir) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) } if err := repo.CloneTagOrBranch(stepIDData.IDorURI, stepIDData.Version).Run(); err != nil { if strings.HasPrefix(stepIDData.IDorURI, "git@") { @@ -709,13 +710,13 @@ func activateAndRunSteps( fmt.Println(colorstring.Yellow(`even if the repository is open source!`)) } registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } if err := command.CopyFile(filepath.Join(stepDir, "step.yml"), stepYMLPth); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } } else if stepIDData.SteplibSource == "_" { @@ -725,25 +726,25 @@ func activateAndRunSteps( stepYMLPth = "" if err := workflowStep.FillMissingDefaults(); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } repo, err := git.New(stepDir) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) } if err := repo.CloneTagOrBranch(stepIDData.IDorURI, stepIDData.Version).Run(); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } } else if stepIDData.SteplibSource != "" { log.Debugf("[BITRISE_CLI] - Steplib (%s) step (id:%s) (version:%s) found, activating step", stepIDData.SteplibSource, stepIDData.IDorURI, stepIDData.Version) if err := tools.StepmanSetup(stepIDData.SteplibSource); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } @@ -761,14 +762,14 @@ func activateAndRunSteps( if err != nil { if buildRunResults.IsStepLibUpdated(stepIDData.SteplibSource) { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("StepmanJSONStepLibStepInfo failed, err: %s", err), isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("StepmanJSONStepLibStepInfo failed, err: %s", err), isLastStep, true, stepStartTime) continue } // May StepLib should be updated log.Infof("Step info not found in StepLib (%s) -- Updating ...", stepIDData.SteplibSource) if err := tools.StepmanUpdate(stepIDData.SteplibSource); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } buildRunResults.StepmanUpdates[stepIDData.SteplibSource]++ @@ -776,7 +777,7 @@ func activateAndRunSteps( outStr, err = tools.StepmanJSONStepLibStepInfo(stepIDData.SteplibSource, stepIDData.IDorURI, stepIDData.Version) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("StepmanJSONStepLibStepInfo failed, err: %s", err), isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("StepmanJSONStepLibStepInfo failed, err: %s", err), isLastStep, true, stepStartTime) continue } } @@ -784,7 +785,7 @@ func activateAndRunSteps( stepInfo, err := stepmanModels.StepInfoModel{}.CreateFromJSON(outStr) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("CreateFromJSON failed, err: %s", err), isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("CreateFromJSON failed, err: %s", err), isLastStep, true, stepStartTime) continue } @@ -798,14 +799,14 @@ func activateAndRunSteps( if err := tools.StepmanActivate(stepIDData.SteplibSource, stepIDData.IDorURI, stepIDData.Version, stepDir, stepYMLPth); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } else { log.Debugf("[BITRISE_CLI] - Step activated: (ID:%s) (version:%s)", stepIDData.IDorURI, stepIDData.Version) } } else { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("Invalid stepIDData: No SteplibSource or LocalPath defined (%v)", stepIDData), isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("Invalid stepIDData: No SteplibSource or LocalPath defined (%v)", stepIDData), isLastStep, true, stepStartTime) continue } @@ -816,14 +817,14 @@ func activateAndRunSteps( log.Debugf("Spec read from YML: %#v\n", specStep) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } mergedStep, err = models.MergeStepWith(specStep, workflowStep) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) continue } } @@ -842,26 +843,26 @@ func activateAndRunSteps( outStr, err := tools.EnvmanJSONPrint(configs.InputEnvstorePath) if err != nil { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, fmt.Errorf("EnvmanJSONPrint failed, err: %s", err), isLastStep, false) + *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, fmt.Errorf("EnvmanJSONPrint failed, err: %s", err), isLastStep, false, stepStartTime) continue } envList, err := envmanModels.NewEnvJSONList(outStr) if err != nil { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, fmt.Errorf("CreateFromJSON failed, err: %s", err), isLastStep, false) + *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, fmt.Errorf("CreateFromJSON failed, err: %s", err), isLastStep, false, stepStartTime) continue } isRun, err := bitrise.EvaluateTemplateToBool(*mergedStep.RunIf, configs.IsCIMode, configs.IsPullRequestMode, buildRunResults, envList) if err != nil { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, err, isLastStep, false) + *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, err, isLastStep, false, stepStartTime) continue } if !isRun { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeSkippedWithRunIf, 0, err, isLastStep, false) + *mergedStep.RunIf, models.StepRunStatusCodeSkippedWithRunIf, 0, err, isLastStep, false, stepStartTime) continue } } @@ -875,7 +876,7 @@ func activateAndRunSteps( if buildRunResults.IsBuildFailed() && !isAlwaysRun { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeSkipped, 0, err, isLastStep, false) + *mergedStep.RunIf, models.StepRunStatusCodeSkipped, 0, err, isLastStep, false, stepStartTime) } else { // beside of the envs coming from the current parent process these will be added as an extra var additionalEnvironments []envmanModels.EnvironmentItemModel @@ -918,14 +919,14 @@ func activateAndRunSteps( if err != nil { if *mergedStep.IsSkippable { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailedSkippable, exit, err, isLastStep, false) + *mergedStep.RunIf, models.StepRunStatusCodeFailedSkippable, exit, err, isLastStep, false, stepStartTime) } else { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailed, exit, err, isLastStep, false) + *mergedStep.RunIf, models.StepRunStatusCodeFailed, exit, err, isLastStep, false, stepStartTime) } } else { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeSuccess, 0, nil, isLastStep, false) + *mergedStep.RunIf, models.StepRunStatusCodeSuccess, 0, nil, isLastStep, false, stepStartTime) } } } @@ -1081,6 +1082,7 @@ func runWorkflowWithConfiguration( buildRunResults := models.BuildRunResultsModel{ StartTime: startTime, StepmanUpdates: map[string]int{}, + ProjectType: bitriseConfig.ProjectType, } buildRunResults, err = activateAndRunWorkflow( diff --git a/models/models.go b/models/models.go index f69081c6..206d67a3 100644 --- a/models/models.go +++ b/models/models.go @@ -105,6 +105,7 @@ type StepIDData struct { // BuildRunResultsModel ... type BuildRunResultsModel struct { + ProjectType string `json:"project_type" yaml:"project_type"` StartTime time.Time `json:"start_time" yaml:"start_time"` StepmanUpdates map[string]int `json:"stepman_updates" yaml:"stepman_updates"` SuccessSteps []StepRunResultsModel `json:"success_steps" yaml:"success_steps"` @@ -115,12 +116,13 @@ type BuildRunResultsModel struct { // StepRunResultsModel ... type StepRunResultsModel struct { - StepInfo stepmanModels.StepInfoModel `json:"step_info" yaml:"step_info"` - Status int `json:"status" yaml:"status"` - Idx int `json:"idx" yaml:"idx"` - RunTime time.Duration `json:"run_time" yaml:"run_time"` - ErrorStr string `json:"error_str" yaml:"error_str"` - ExitCode int `json:"exit_code" yaml:"exit_code"` + StepInfo stepmanModels.StepInfoModel `json:"step_info" yaml:"step_info"` + Status int `json:"status" yaml:"status"` + Idx int `json:"idx" yaml:"idx"` + RunTime time.Duration `json:"run_time" yaml:"run_time"` + StartTime time.Time `json:"start_time" yaml:"start_time"` + ErrorStr string `json:"error_str" yaml:"error_str"` + ExitCode int `json:"exit_code" yaml:"exit_code"` } // TestResultStepInfo ... From b212fb509ffa61bc95a1bfe4d47ae3ad7ae06a1b Mon Sep 17 00:00:00 2001 From: Papik Tamas Date: Mon, 11 Mar 2019 17:18:22 +0100 Subject: [PATCH 2/2] pr change --- cli/run_util.go | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/cli/run_util.go b/cli/run_util.go index 62deb4a4..0f93d234 100644 --- a/cli/run_util.go +++ b/cli/run_util.go @@ -530,7 +530,7 @@ func activateAndRunSteps( // ------------------------------------------ // In function method - Registration methods, for register step run results. registerStepRunResults := func(step stepmanModels.StepModel, stepInfoPtr stepmanModels.StepInfoModel, - stepIdxPtr int, runIf string, resultCode, exitCode int, err error, isLastStep, printStepHeader bool, startTime time.Time) { + stepIdxPtr int, runIf string, resultCode, exitCode int, err error, isLastStep, printStepHeader bool) { if printStepHeader { bitrise.PrintRunningStepHeader(stepInfoPtr, step, stepIdxPtr) @@ -558,7 +558,7 @@ func activateAndRunSteps( RunTime: time.Now().Sub(stepStartTime), ErrorStr: errStr, ExitCode: exitCode, - StartTime: startTime, + StartTime: stepStartTime, } isExitStatusError := true @@ -623,7 +623,7 @@ func activateAndRunSteps( if err := bitrise.CleanupStepWorkDir(); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } @@ -631,13 +631,13 @@ func activateAndRunSteps( // Preparing the step if err := tools.EnvmanInitAtPath(configs.InputEnvstorePath); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } if err := tools.ExportEnvironmentsList(configs.InputEnvstorePath, *environments); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } @@ -645,7 +645,7 @@ func activateAndRunSteps( compositeStepIDStr, workflowStep, err := models.GetStepIDStepDataPair(stepListItm) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } stepInfoPtr.ID = compositeStepIDStr @@ -658,7 +658,7 @@ func activateAndRunSteps( stepIDData, err := models.CreateStepIDDataFromString(compositeStepIDStr, defaultStepLibSource) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } stepInfoPtr.ID = stepIDData.IDorURI @@ -678,7 +678,7 @@ func activateAndRunSteps( stepAbsLocalPth, err := pathutil.AbsPath(stepIDData.IDorURI) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } @@ -686,13 +686,13 @@ func activateAndRunSteps( if err := command.CopyDir(stepAbsLocalPth, stepDir, true); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } if err := command.CopyFile(filepath.Join(stepAbsLocalPth, "step.yml"), stepYMLPth); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } } else if stepIDData.SteplibSource == "git" { @@ -700,7 +700,7 @@ func activateAndRunSteps( repo, err := git.New(stepDir) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) } if err := repo.CloneTagOrBranch(stepIDData.IDorURI, stepIDData.Version).Run(); err != nil { if strings.HasPrefix(stepIDData.IDorURI, "git@") { @@ -710,13 +710,13 @@ func activateAndRunSteps( fmt.Println(colorstring.Yellow(`even if the repository is open source!`)) } registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } if err := command.CopyFile(filepath.Join(stepDir, "step.yml"), stepYMLPth); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } } else if stepIDData.SteplibSource == "_" { @@ -726,25 +726,25 @@ func activateAndRunSteps( stepYMLPth = "" if err := workflowStep.FillMissingDefaults(); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } repo, err := git.New(stepDir) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) } if err := repo.CloneTagOrBranch(stepIDData.IDorURI, stepIDData.Version).Run(); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } } else if stepIDData.SteplibSource != "" { log.Debugf("[BITRISE_CLI] - Steplib (%s) step (id:%s) (version:%s) found, activating step", stepIDData.SteplibSource, stepIDData.IDorURI, stepIDData.Version) if err := tools.StepmanSetup(stepIDData.SteplibSource); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } @@ -762,14 +762,14 @@ func activateAndRunSteps( if err != nil { if buildRunResults.IsStepLibUpdated(stepIDData.SteplibSource) { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("StepmanJSONStepLibStepInfo failed, err: %s", err), isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("StepmanJSONStepLibStepInfo failed, err: %s", err), isLastStep, true) continue } // May StepLib should be updated log.Infof("Step info not found in StepLib (%s) -- Updating ...", stepIDData.SteplibSource) if err := tools.StepmanUpdate(stepIDData.SteplibSource); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } buildRunResults.StepmanUpdates[stepIDData.SteplibSource]++ @@ -777,7 +777,7 @@ func activateAndRunSteps( outStr, err = tools.StepmanJSONStepLibStepInfo(stepIDData.SteplibSource, stepIDData.IDorURI, stepIDData.Version) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("StepmanJSONStepLibStepInfo failed, err: %s", err), isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("StepmanJSONStepLibStepInfo failed, err: %s", err), isLastStep, true) continue } } @@ -785,7 +785,7 @@ func activateAndRunSteps( stepInfo, err := stepmanModels.StepInfoModel{}.CreateFromJSON(outStr) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("CreateFromJSON failed, err: %s", err), isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("CreateFromJSON failed, err: %s", err), isLastStep, true) continue } @@ -799,14 +799,14 @@ func activateAndRunSteps( if err := tools.StepmanActivate(stepIDData.SteplibSource, stepIDData.IDorURI, stepIDData.Version, stepDir, stepYMLPth); err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } else { log.Debugf("[BITRISE_CLI] - Step activated: (ID:%s) (version:%s)", stepIDData.IDorURI, stepIDData.Version) } } else { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("Invalid stepIDData: No SteplibSource or LocalPath defined (%v)", stepIDData), isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, fmt.Errorf("Invalid stepIDData: No SteplibSource or LocalPath defined (%v)", stepIDData), isLastStep, true) continue } @@ -817,14 +817,14 @@ func activateAndRunSteps( log.Debugf("Spec read from YML: %#v\n", specStep) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } mergedStep, err = models.MergeStepWith(specStep, workflowStep) if err != nil { registerStepRunResults(stepmanModels.StepModel{}, stepInfoPtr, stepIdxPtr, - "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true, stepStartTime) + "", models.StepRunStatusCodeFailed, 1, err, isLastStep, true) continue } } @@ -843,26 +843,26 @@ func activateAndRunSteps( outStr, err := tools.EnvmanJSONPrint(configs.InputEnvstorePath) if err != nil { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, fmt.Errorf("EnvmanJSONPrint failed, err: %s", err), isLastStep, false, stepStartTime) + *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, fmt.Errorf("EnvmanJSONPrint failed, err: %s", err), isLastStep, false) continue } envList, err := envmanModels.NewEnvJSONList(outStr) if err != nil { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, fmt.Errorf("CreateFromJSON failed, err: %s", err), isLastStep, false, stepStartTime) + *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, fmt.Errorf("CreateFromJSON failed, err: %s", err), isLastStep, false) continue } isRun, err := bitrise.EvaluateTemplateToBool(*mergedStep.RunIf, configs.IsCIMode, configs.IsPullRequestMode, buildRunResults, envList) if err != nil { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, err, isLastStep, false, stepStartTime) + *mergedStep.RunIf, models.StepRunStatusCodeFailed, 1, err, isLastStep, false) continue } if !isRun { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeSkippedWithRunIf, 0, err, isLastStep, false, stepStartTime) + *mergedStep.RunIf, models.StepRunStatusCodeSkippedWithRunIf, 0, err, isLastStep, false) continue } } @@ -876,7 +876,7 @@ func activateAndRunSteps( if buildRunResults.IsBuildFailed() && !isAlwaysRun { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeSkipped, 0, err, isLastStep, false, stepStartTime) + *mergedStep.RunIf, models.StepRunStatusCodeSkipped, 0, err, isLastStep, false) } else { // beside of the envs coming from the current parent process these will be added as an extra var additionalEnvironments []envmanModels.EnvironmentItemModel @@ -919,14 +919,14 @@ func activateAndRunSteps( if err != nil { if *mergedStep.IsSkippable { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailedSkippable, exit, err, isLastStep, false, stepStartTime) + *mergedStep.RunIf, models.StepRunStatusCodeFailedSkippable, exit, err, isLastStep, false) } else { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeFailed, exit, err, isLastStep, false, stepStartTime) + *mergedStep.RunIf, models.StepRunStatusCodeFailed, exit, err, isLastStep, false) } } else { registerStepRunResults(mergedStep, stepInfoPtr, stepIdxPtr, - *mergedStep.RunIf, models.StepRunStatusCodeSuccess, 0, nil, isLastStep, false, stepStartTime) + *mergedStep.RunIf, models.StepRunStatusCodeSuccess, 0, nil, isLastStep, false) } } }