func exportEnvironmentsList(envsList []models.EnvironmentItemModel) error { log.Info("[BITRISE_CLI] - Exporting workflow environments") for _, env := range envsList { envKey, envValue, err := env.GetKeyValue() if err != nil { log.Errorln("[BITRISE_CLI] - Failed to get environment key-value pair from env:", env) return err } if envValue != "" { expand := true if env["is_expand"] != "" { boolValue, err := goinp.ParseBool(env["is_expand"]) if err != nil { log.Error("Failed to parse bool:", err) return err } expand = boolValue } if err := bitrise.RunEnvmanAdd(envKey, envValue, expand); err != nil { log.Errorln("[BITRISE_CLI] - Failed to run envman add") return err } } } return nil }
func runStep(step models.StepModel, stepIDData StepIDData) error { log.Infof("[BITRISE_CLI] - Running step: %s (%s)", stepIDData.ID, stepIDData.Version) // Add step envs for _, input := range step.Inputs { envKey, envValue, err := input.GetKeyValue() if err != nil { return err } if envValue != "" { expand := true if input["is_expand"] != "" { boolValue, err := goinp.ParseBool(input["is_expand"]) if err != nil { log.Error("Failed to parse bool:", err) return err } expand = boolValue } if err := bitrise.RunEnvmanAdd(envKey, envValue, expand); err != nil { log.Errorln("[BITRISE_CLI] - Failed to run envman add") return err } } } stepDir := "./steps/" + stepIDData.ID + "/" + stepIDData.Version + "/" //stepCmd := fmt.Sprintf("%sstep.sh", stepDir) stepCmd := "step.sh" cmd := []string{"bash", stepCmd} if err := bitrise.RunEnvmanRunInDir(stepDir, cmd); err != nil { log.Errorln("[BITRISE_CLI] - Failed to run envman run") return err } log.Infof("[BITRISE_CLI] - Step executed: %s (%s)", stepIDData.ID, stepIDData.Version) return nil }