本文整理汇总了Golang中github.com/bitrise-io/bitrise/models.StepInfoModel.Latest方法的典型用法代码示例。如果您正苦于以下问题:Golang StepInfoModel.Latest方法的具体用法?Golang StepInfoModel.Latest怎么用?Golang StepInfoModel.Latest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/bitrise-io/bitrise/models.StepInfoModel
的用法示例。
在下文中一共展示了StepInfoModel.Latest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: activateAndRunSteps
func activateAndRunSteps(workflow models.WorkflowModel, defaultStepLibSource string, buildRunResults models.BuildRunResultsModel, environments *[]envmanModels.EnvironmentItemModel, isLastWorkflow bool) models.BuildRunResultsModel {
log.Debugln("[BITRISE_CLI] - Activating and running steps")
// ------------------------------------------
// In function global variables - These are global for easy use in local register step run result methods.
var stepStartTime time.Time
// Holds pointer to current step info, for easy usage in local register step run result methods.
// The value is filled with the current running step info.
var stepInfoPtr models.StepInfoModel
// ------------------------------------------
// In function method - Registration methods, for register step run results.
registerStepRunResults := func(runIf string, resultCode, exitCode int, err error, isLastStep bool) {
stepInfoCopy := models.StepInfoModel{
ID: stepInfoPtr.ID,
Version: stepInfoPtr.Version,
Latest: stepInfoPtr.Latest,
}
stepResults := models.StepRunResultsModel{
StepInfo: stepInfoCopy,
Status: resultCode,
Idx: buildRunResults.ResultsCount(),
RunTime: time.Now().Sub(stepStartTime),
Error: err,
ExitCode: exitCode,
}
switch resultCode {
case models.StepRunStatusCodeSuccess:
buildRunResults.SuccessSteps = append(buildRunResults.SuccessSteps, stepResults)
break
case models.StepRunStatusCodeFailed:
log.Errorf("Step (%s) failed, error: (%v)", stepInfoCopy.ID, err)
buildRunResults.FailedSteps = append(buildRunResults.FailedSteps, stepResults)
break
case models.StepRunStatusCodeFailedSkippable:
log.Warnf("Step (%s) failed, but was marked as skippable, error: (%v)", stepInfoCopy.ID, err)
buildRunResults.FailedSkippableSteps = append(buildRunResults.FailedSkippableSteps, stepResults)
break
case models.StepRunStatusCodeSkipped:
log.Warnf("A previous step failed, and this step (%s) was not marked as IsAlwaysRun, skipped", stepInfoCopy.ID)
buildRunResults.SkippedSteps = append(buildRunResults.SkippedSteps, stepResults)
break
case models.StepRunStatusCodeSkippedWithRunIf:
log.Warn("The step's (" + stepInfoCopy.ID + ") Run-If expression evaluated to false - skipping")
if runIf != "" {
log.Info("The Run-If expression was: ", colorstring.Blue(runIf))
}
buildRunResults.SkippedSteps = append(buildRunResults.SkippedSteps, stepResults)
break
default:
log.Error("Unkown result code")
return
}
bitrise.PrintStepSummary(stepResults, isLastStep)
}
// ------------------------------------------
// Main - Preparing & running the steps
for idx, stepListItm := range workflow.Steps {
// Per step variables
stepStartTime = time.Now()
isLastStep := isLastWorkflow && (idx == len(workflow.Steps)-1)
stepInfoPtr = models.StepInfoModel{}
// Per step cleanup
if err := bitrise.SetBuildFailedEnv(buildRunResults.IsBuildFailed()); err != nil {
log.Error("Failed to set Build Status envs")
}
if err := bitrise.CleanupStepWorkDir(); err != nil {
registerStepRunResults("", models.StepRunStatusCodeFailed, 1, err, isLastStep)
continue
}
//
// Preparing the step
// Get step id & version data
compositeStepIDStr, workflowStep, err := models.GetStepIDStepDataPair(stepListItm)
stepInfoPtr.ID = compositeStepIDStr
if workflowStep.Title != nil && *workflowStep.Title != "" {
stepInfoPtr.ID = *workflowStep.Title
}
if err != nil {
registerStepRunResults("", models.StepRunStatusCodeFailed, 1, err, isLastStep)
continue
}
stepIDData, err := models.CreateStepIDDataFromString(compositeStepIDStr, defaultStepLibSource)
stepInfoPtr.ID = stepIDData.IDorURI
if workflowStep.Title != nil && *workflowStep.Title != "" {
stepInfoPtr.ID = *workflowStep.Title
}
stepInfoPtr.Version = stepIDData.Version
if err != nil {
registerStepRunResults("", models.StepRunStatusCodeFailed, 1, err, isLastStep)
//.........这里部分代码省略.........