From cf5acd0c9ff8b56dcebd371096ede1b9e98e793d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 9 Aug 2024 10:04:57 +0200 Subject: [PATCH 1/9] Add containerisation and step bundles info to the workflow run plan --- cli/run.go | 35 +++++++++++++++++++++++++++++++++-- models/workflow_run_plan.go | 21 ++++++++++++++++++--- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/cli/run.go b/cli/run.go index 7ea90ec1..2c42b1ef 100644 --- a/cli/run.go +++ b/cli/run.go @@ -307,7 +307,11 @@ func (r WorkflowRunner) runWorkflows(tracker analytics.Tracker) (models.BuildRun ProjectType: r.config.Config.ProjectType, } - plan, err := createWorkflowRunPlan(r.config.Modes, r.config.Workflow, r.config.Config.Workflows, r.config.Config.StepBundles, func() string { return uuid.Must(uuid.NewV4()).String() }) + plan, err := createWorkflowRunPlan( + r.config.Modes, r.config.Workflow, r.config.Config.Workflows, + r.config.Config.StepBundles, r.config.Config.Containers, r.config.Config.Services, + func() string { return uuid.Must(uuid.NewV4()).String() }, + ) if err != nil { return models.BuildRunResultsModel{}, fmt.Errorf("failed to create workflow execution plan: %w", err) } @@ -495,8 +499,14 @@ func registerRunModes(modes models.WorkflowRunModes) error { return nil } -func createWorkflowRunPlan(modes models.WorkflowRunModes, targetWorkflow string, workflows map[string]models.WorkflowModel, stepBundles map[string]models.StepBundleModel, uuidProvider func() string) (models.WorkflowRunPlan, error) { +func createWorkflowRunPlan( + modes models.WorkflowRunModes, targetWorkflow string, workflows map[string]models.WorkflowModel, + stepBundles map[string]models.StepBundleModel, containers map[string]models.Container, services map[string]models.Container, + uuidProvider func() string, +) (models.WorkflowRunPlan, error) { var executionPlan []models.WorkflowExecutionPlan + withGroupPlans := map[string]models.WithGroupPlan{} + stepBundlePlans := map[string]models.StepBundlePlan{} workflowList := walkWorkflows(targetWorkflow, workflows, nil) for _, workflowID := range workflowList { @@ -530,6 +540,21 @@ func createWorkflowRunPlan(modes models.WorkflowRunModes, targetWorkflow string, groupID := uuidProvider() + var containerPlan models.ContainerPlan + if with.ContainerID != "" { + containerPlan.Image = containers[with.ContainerID].Image + } + + var servicePlans []models.ContainerPlan + for _, serviceID := range with.ServiceIDs { + servicePlans = append(servicePlans, models.ContainerPlan{Image: services[serviceID].Image}) + } + + withGroupPlans[groupID] = models.WithGroupPlan{ + Services: servicePlans, + Container: containerPlan, + } + for _, stepListStepItem := range with.Steps { stepID, step, err := stepListStepItem.GetStepIDAndStep() if err != nil { @@ -560,6 +585,10 @@ func createWorkflowRunPlan(modes models.WorkflowRunModes, targetWorkflow string, bundleEnvs := append(bundleDefinition.Environments, bundleOverride.Environments...) bundleUUID := uuidProvider() + stepBundlePlans[bundleUUID] = models.StepBundlePlan{ + ID: bundleID, + } + for idx, stepListStepItem := range bundleDefinition.Steps { stepID, step, err := stepListStepItem.GetStepIDAndStep() if err != nil { @@ -611,6 +640,8 @@ func createWorkflowRunPlan(modes models.WorkflowRunModes, targetWorkflow string, NoOutputTimeoutMode: modes.NoOutputTimeout > 0, SecretFilteringMode: modes.SecretFilteringMode, SecretEnvsFilteringMode: modes.SecretEnvsFilteringMode, + WithGroupPlans: withGroupPlans, + StepBundlePlans: stepBundlePlans, ExecutionPlan: executionPlan, }, nil } diff --git a/models/workflow_run_plan.go b/models/workflow_run_plan.go index 2dff2d1f..b071243f 100644 --- a/models/workflow_run_plan.go +++ b/models/workflow_run_plan.go @@ -25,11 +25,11 @@ type StepExecutionPlan struct { Step stepmanModels.StepModel `json:"-"` // With (container) group - WithGroupUUID string `json:"-"` + WithGroupUUID string `json:"with_group_uuid"` ContainerID string `json:"-"` ServiceIDs []string `json:"-"` // Step Bundle group - StepBundleUUID string `json:"-"` + StepBundleUUID string `json:"step_bundle_uuid"` StepBundleEnvs []envmanModels.EnvironmentItemModel `json:"-"` } @@ -41,6 +41,19 @@ type WorkflowExecutionPlan struct { IsSteplibOfflineMode bool `json:"-"` } +type ContainerPlan struct { + Image string `json:"image"` +} + +type WithGroupPlan struct { + Services []ContainerPlan `json:"services"` + Container ContainerPlan `json:"container"` +} + +type StepBundlePlan struct { + ID string `json:"id"` +} + type WorkflowRunPlan struct { Version string `json:"version"` LogFormatVersion string `json:"log_format_version"` @@ -53,5 +66,7 @@ type WorkflowRunPlan struct { SecretFilteringMode bool `json:"secret_filtering_mode"` SecretEnvsFilteringMode bool `json:"secret_envs_filtering_mode"` - ExecutionPlan []WorkflowExecutionPlan `json:"execution_plan"` + WithGroupPlans map[string]WithGroupPlan `json:"with_groups"` + StepBundlePlans map[string]StepBundlePlan `json:"step_bundles"` + ExecutionPlan []WorkflowExecutionPlan `json:"execution_plan"` } From 986241a6f8e678159fb8c5adf52823457f5bd99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 9 Aug 2024 10:25:42 +0200 Subject: [PATCH 2/9] omitempty new with group and step bundle fields --- models/workflow_run_plan.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/models/workflow_run_plan.go b/models/workflow_run_plan.go index b071243f..0fbd4a52 100644 --- a/models/workflow_run_plan.go +++ b/models/workflow_run_plan.go @@ -25,11 +25,11 @@ type StepExecutionPlan struct { Step stepmanModels.StepModel `json:"-"` // With (container) group - WithGroupUUID string `json:"with_group_uuid"` + WithGroupUUID string `json:"with_group_uuid,omitempty"` ContainerID string `json:"-"` ServiceIDs []string `json:"-"` // Step Bundle group - StepBundleUUID string `json:"step_bundle_uuid"` + StepBundleUUID string `json:"step_bundle_uuid,omitempty"` StepBundleEnvs []envmanModels.EnvironmentItemModel `json:"-"` } @@ -46,8 +46,8 @@ type ContainerPlan struct { } type WithGroupPlan struct { - Services []ContainerPlan `json:"services"` - Container ContainerPlan `json:"container"` + Services []ContainerPlan `json:"services,omitempty"` + Container ContainerPlan `json:"container,omitempty"` } type StepBundlePlan struct { @@ -66,7 +66,7 @@ type WorkflowRunPlan struct { SecretFilteringMode bool `json:"secret_filtering_mode"` SecretEnvsFilteringMode bool `json:"secret_envs_filtering_mode"` - WithGroupPlans map[string]WithGroupPlan `json:"with_groups"` - StepBundlePlans map[string]StepBundlePlan `json:"step_bundles"` + WithGroupPlans map[string]WithGroupPlan `json:"with_groups,omitempty"` + StepBundlePlans map[string]StepBundlePlan `json:"step_bundles,omitempty"` ExecutionPlan []WorkflowExecutionPlan `json:"execution_plan"` } From 6c258f8d6fad603a369e5bfd5a2d2bfbb4557473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 9 Aug 2024 10:50:51 +0200 Subject: [PATCH 3/9] Test containerisation JSON logs --- _tests/integration/docker_test.go | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/_tests/integration/docker_test.go b/_tests/integration/docker_test.go index 3b5b6d31..6575e83c 100644 --- a/_tests/integration/docker_test.go +++ b/_tests/integration/docker_test.go @@ -4,13 +4,77 @@ package integration import ( + "encoding/json" + "strings" "testing" + "github.com/bitrise-io/bitrise/models" "github.com/bitrise-io/go-utils/command" "github.com/ryanuber/go-glob" "github.com/stretchr/testify/require" ) +func Test_Docker_JSON_Logs(t *testing.T) { + testCases := map[string]struct { + workflowName string + configPath string + inventoryPath string + requiredContainerImage string + requiredServiceImages []string + }{ + "With group with step execution and service containers": { + workflowName: "docker-login-multiple-containers", + configPath: "docker_multiple_containers_bitrise.yml", + inventoryPath: "docker_multiple_containers_secrets.yml", + requiredContainerImage: "localhost:5001/healthy-image", + requiredServiceImages: []string{ + "localhost:5002/healthy-image", + "localhost:5003/healthy-image", + }, + }, + } + for testName, testCase := range testCases { + t.Run(testName, func(t *testing.T) { + cmd := command.New(binPath(), "run", testCase.workflowName, "--config", testCase.configPath, "--inventory", testCase.inventoryPath, "--output-format", "json") + out, _ := cmd.RunAndReturnTrimmedCombinedOutput() + //require.NoError(t, err, out) + checkRequiredContainers(t, out, testCase.requiredContainerImage, testCase.requiredServiceImages) + }) + } +} + +func checkRequiredContainers(t *testing.T, log string, requiredContainerImage string, requiredServiceImages []string) { + lines := strings.Split(log, "\n") + require.True(t, len(lines) > 0) + + var bitriseStartedEventLog struct { + BitriseStartedEvent models.WorkflowRunPlan `json:"content"` + } + bitriseStartedLog := lines[0] + require.NoError(t, json.Unmarshal([]byte(bitriseStartedLog), &bitriseStartedEventLog)) + bitriseStartedEvent := bitriseStartedEventLog.BitriseStartedEvent + + var usedContainerImages []string + var usedServiceImages []string + + for _, workflowPlans := range bitriseStartedEvent.ExecutionPlan { + for _, stepPlans := range workflowPlans.Steps { + if stepPlans.WithGroupUUID != "" { + withGroupPlan := bitriseStartedEvent.WithGroupPlans[stepPlans.WithGroupUUID] + + usedContainerImages = append(usedContainerImages, withGroupPlan.Container.Image) + for _, servicePlan := range withGroupPlan.Services { + usedServiceImages = append(usedServiceImages, servicePlan.Image) + } + } + } + } + + require.Equal(t, 1, len(usedContainerImages)) + require.EqualValues(t, requiredContainerImage, usedContainerImages[0]) + require.EqualValues(t, requiredServiceImages, usedServiceImages) +} + func Test_Docker(t *testing.T) { testCases := map[string]struct { configPath string From 742bb67642702535ed90a2505a70fcf13186c9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 9 Aug 2024 13:12:39 +0200 Subject: [PATCH 4/9] Debug docker json log failure --- _tests/integration/docker_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_tests/integration/docker_test.go b/_tests/integration/docker_test.go index 6575e83c..bbcf65cd 100644 --- a/_tests/integration/docker_test.go +++ b/_tests/integration/docker_test.go @@ -70,9 +70,9 @@ func checkRequiredContainers(t *testing.T, log string, requiredContainerImage st } } - require.Equal(t, 1, len(usedContainerImages)) - require.EqualValues(t, requiredContainerImage, usedContainerImages[0]) - require.EqualValues(t, requiredServiceImages, usedServiceImages) + require.Equal(t, 1, len(usedContainerImages), bitriseStartedLog) + require.EqualValues(t, requiredContainerImage, usedContainerImages[0], bitriseStartedLog) + require.EqualValues(t, requiredServiceImages, usedServiceImages, bitriseStartedLog) } func Test_Docker(t *testing.T) { From 8d36dfb985c4518264ffc5f4fc363f4a7ee1751f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 9 Aug 2024 13:22:36 +0200 Subject: [PATCH 5/9] Test step bundle in json logs --- _tests/integration/docker_test.go | 122 +++++++++---------- _tests/integration/modular_config_module.yml | 11 +- _tests/integration/modular_config_test.go | 41 ++++++- 3 files changed, 109 insertions(+), 65 deletions(-) diff --git a/_tests/integration/docker_test.go b/_tests/integration/docker_test.go index bbcf65cd..998ff772 100644 --- a/_tests/integration/docker_test.go +++ b/_tests/integration/docker_test.go @@ -14,67 +14,6 @@ import ( "github.com/stretchr/testify/require" ) -func Test_Docker_JSON_Logs(t *testing.T) { - testCases := map[string]struct { - workflowName string - configPath string - inventoryPath string - requiredContainerImage string - requiredServiceImages []string - }{ - "With group with step execution and service containers": { - workflowName: "docker-login-multiple-containers", - configPath: "docker_multiple_containers_bitrise.yml", - inventoryPath: "docker_multiple_containers_secrets.yml", - requiredContainerImage: "localhost:5001/healthy-image", - requiredServiceImages: []string{ - "localhost:5002/healthy-image", - "localhost:5003/healthy-image", - }, - }, - } - for testName, testCase := range testCases { - t.Run(testName, func(t *testing.T) { - cmd := command.New(binPath(), "run", testCase.workflowName, "--config", testCase.configPath, "--inventory", testCase.inventoryPath, "--output-format", "json") - out, _ := cmd.RunAndReturnTrimmedCombinedOutput() - //require.NoError(t, err, out) - checkRequiredContainers(t, out, testCase.requiredContainerImage, testCase.requiredServiceImages) - }) - } -} - -func checkRequiredContainers(t *testing.T, log string, requiredContainerImage string, requiredServiceImages []string) { - lines := strings.Split(log, "\n") - require.True(t, len(lines) > 0) - - var bitriseStartedEventLog struct { - BitriseStartedEvent models.WorkflowRunPlan `json:"content"` - } - bitriseStartedLog := lines[0] - require.NoError(t, json.Unmarshal([]byte(bitriseStartedLog), &bitriseStartedEventLog)) - bitriseStartedEvent := bitriseStartedEventLog.BitriseStartedEvent - - var usedContainerImages []string - var usedServiceImages []string - - for _, workflowPlans := range bitriseStartedEvent.ExecutionPlan { - for _, stepPlans := range workflowPlans.Steps { - if stepPlans.WithGroupUUID != "" { - withGroupPlan := bitriseStartedEvent.WithGroupPlans[stepPlans.WithGroupUUID] - - usedContainerImages = append(usedContainerImages, withGroupPlan.Container.Image) - for _, servicePlan := range withGroupPlan.Services { - usedServiceImages = append(usedServiceImages, servicePlan.Image) - } - } - } - } - - require.Equal(t, 1, len(usedContainerImages), bitriseStartedLog) - require.EqualValues(t, requiredContainerImage, usedContainerImages[0], bitriseStartedLog) - require.EqualValues(t, requiredServiceImages, usedServiceImages, bitriseStartedLog) -} - func Test_Docker(t *testing.T) { testCases := map[string]struct { configPath string @@ -222,3 +161,64 @@ func Test_Docker(t *testing.T) { }) } } + +func Test_Docker_JSON_Logs(t *testing.T) { + testCases := map[string]struct { + workflowName string + configPath string + inventoryPath string + requiredContainerImage string + requiredServiceImages []string + }{ + "With group with step execution and service containers": { + workflowName: "docker-login-multiple-containers", + configPath: "docker_multiple_containers_bitrise.yml", + inventoryPath: "docker_multiple_containers_secrets.yml", + requiredContainerImage: "localhost:5001/healthy-image", + requiredServiceImages: []string{ + "localhost:5002/healthy-image", + "localhost:5003/healthy-image", + }, + }, + } + for testName, testCase := range testCases { + t.Run(testName, func(t *testing.T) { + cmd := command.New(binPath(), "run", testCase.workflowName, "--config", testCase.configPath, "--inventory", testCase.inventoryPath, "--output-format", "json") + out, _ := cmd.RunAndReturnTrimmedCombinedOutput() + //require.NoError(t, err, out) + checkRequiredContainers(t, out, testCase.requiredContainerImage, testCase.requiredServiceImages) + }) + } +} + +func checkRequiredContainers(t *testing.T, log string, requiredContainerImage string, requiredServiceImages []string) { + lines := strings.Split(log, "\n") + require.True(t, len(lines) > 0) + + var bitriseStartedEventLog struct { + BitriseStartedEvent models.WorkflowRunPlan `json:"content"` + } + bitriseStartedLog := lines[0] + require.NoError(t, json.Unmarshal([]byte(bitriseStartedLog), &bitriseStartedEventLog)) + bitriseStartedEvent := bitriseStartedEventLog.BitriseStartedEvent + + var usedContainerImages []string + var usedServiceImages []string + + for _, workflowPlans := range bitriseStartedEvent.ExecutionPlan { + for _, stepPlans := range workflowPlans.Steps { + if stepPlans.WithGroupUUID != "" { + withGroupPlan := bitriseStartedEvent.WithGroupPlans[stepPlans.WithGroupUUID] + + usedContainerImages = append(usedContainerImages, withGroupPlan.Container.Image) + for _, servicePlan := range withGroupPlan.Services { + usedServiceImages = append(usedServiceImages, servicePlan.Image) + } + } + } + } + + require.Equal(t, 1, len(usedContainerImages), bitriseStartedLog) + require.EqualValues(t, requiredContainerImage, usedContainerImages[0], bitriseStartedLog) + require.EqualValues(t, requiredServiceImages, usedServiceImages, bitriseStartedLog) +} diff --git a/_tests/integration/modular_config_module.yml b/_tests/integration/modular_config_module.yml index d79f299d..d54dadfb 100644 --- a/_tests/integration/modular_config_module.yml +++ b/_tests/integration/modular_config_module.yml @@ -1,8 +1,13 @@ +step_bundles: + print: + steps: + - script: + inputs: + - content: echo "Hello $NAME!" + workflows: print_hello_world: envs: - NAME: World steps: - - script: - inputs: - - content: echo "Hello $NAME!" + - bundle::print: {} diff --git a/_tests/integration/modular_config_test.go b/_tests/integration/modular_config_test.go index 78655db0..b403bd94 100644 --- a/_tests/integration/modular_config_test.go +++ b/_tests/integration/modular_config_test.go @@ -1,14 +1,17 @@ package integration import ( + "encoding/json" "os" + "strings" "testing" + "github.com/bitrise-io/bitrise/models" "github.com/bitrise-io/go-utils/command" "github.com/stretchr/testify/require" ) -func Test_ModularConfig_Run(t *testing.T) { +func Test_ModularConfig(t *testing.T) { configPth := "modular_config_main.yml" deployDir := os.Getenv("BITRISE_DEPLOY_DIR") @@ -41,3 +44,39 @@ func Test_ModularConfig_Run(t *testing.T) { require.NoError(t, err, out) require.Contains(t, out, "Hello World!") } + +func Test_ModularConfig_Run_JSON_Logs(t *testing.T) { + configPth := "modular_config_main.yml" + + cmd := command.New(binPath(), "run", "print_hello_world", "--config", configPth, "--output-format", "json") + out, err := cmd.RunAndReturnTrimmedCombinedOutput() + require.NoError(t, err, out) + require.Contains(t, out, "Hello World!") + checkRequiredStepBundle(t, out, "print") +} + +func checkRequiredStepBundle(t *testing.T, log string, requiredStepBundle string) { + lines := strings.Split(log, "\n") + require.True(t, len(lines) > 0) + + var bitriseStartedEventLog struct { + BitriseStartedEvent models.WorkflowRunPlan `json:"content"` + } + bitriseStartedLog := lines[0] + require.NoError(t, json.Unmarshal([]byte(bitriseStartedLog), &bitriseStartedEventLog)) + bitriseStartedEvent := bitriseStartedEventLog.BitriseStartedEvent + + var usedStepBundles []string + + for _, workflowPlans := range bitriseStartedEvent.ExecutionPlan { + for _, stepPlans := range workflowPlans.Steps { + if stepPlans.StepBundleUUID != "" { + stepBundlePlan := bitriseStartedEvent.StepBundlePlans[stepPlans.StepBundleUUID] + usedStepBundles = append(usedStepBundles, stepBundlePlan.ID) + } + } + } + + require.Equal(t, 1, len(usedStepBundles), bitriseStartedLog) + require.EqualValues(t, requiredStepBundle, usedStepBundles[0], bitriseStartedLog) +} From 32477e398f65143ee4e7e9b099abac393fee4c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 9 Aug 2024 13:47:14 +0200 Subject: [PATCH 6/9] Fix yaml lint issue --- _tests/integration/modular_config_module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tests/integration/modular_config_module.yml b/_tests/integration/modular_config_module.yml index d54dadfb..2b1affea 100644 --- a/_tests/integration/modular_config_module.yml +++ b/_tests/integration/modular_config_module.yml @@ -10,4 +10,4 @@ workflows: envs: - NAME: World steps: - - bundle::print: {} + - bundle::print: { } From 985468955f345e3e1056ec6f1361fcea5fc1454a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 9 Aug 2024 15:21:11 +0200 Subject: [PATCH 7/9] Fix json log test flakyness --- _tests/integration/docker_test.go | 16 +++++++++++----- _tests/integration/modular_config_test.go | 20 +++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/_tests/integration/docker_test.go b/_tests/integration/docker_test.go index 998ff772..6799f8b9 100644 --- a/_tests/integration/docker_test.go +++ b/_tests/integration/docker_test.go @@ -195,12 +195,18 @@ func checkRequiredContainers(t *testing.T, log string, requiredContainerImage st lines := strings.Split(log, "\n") require.True(t, len(lines) > 0) - var bitriseStartedEventLog struct { - BitriseStartedEvent models.WorkflowRunPlan `json:"content"` + var bitriseStartedEvent models.WorkflowRunPlan + for _, line := range lines { + var eventLogStruct struct { + EventType string `json:"event_type"` + Content models.WorkflowRunPlan `json:"content"` + } + require.NoError(t, json.Unmarshal([]byte(line), &eventLogStruct)) + if eventLogStruct.EventType == "bitrise_started" { + bitriseStartedEvent = eventLogStruct.Content + break + } } - bitriseStartedLog := lines[0] - require.NoError(t, json.Unmarshal([]byte(bitriseStartedLog), &bitriseStartedEventLog)) - bitriseStartedEvent := bitriseStartedEventLog.BitriseStartedEvent var usedContainerImages []string var usedServiceImages []string diff --git a/_tests/integration/modular_config_test.go b/_tests/integration/modular_config_test.go index b403bd94..fc11d082 100644 --- a/_tests/integration/modular_config_test.go +++ b/_tests/integration/modular_config_test.go @@ -59,12 +59,18 @@ func checkRequiredStepBundle(t *testing.T, log string, requiredStepBundle string lines := strings.Split(log, "\n") require.True(t, len(lines) > 0) - var bitriseStartedEventLog struct { - BitriseStartedEvent models.WorkflowRunPlan `json:"content"` + var bitriseStartedEvent models.WorkflowRunPlan + for _, line := range lines { + var eventLogStruct struct { + EventType string `json:"event_type"` + Content models.WorkflowRunPlan `json:"content"` + } + require.NoError(t, json.Unmarshal([]byte(line), &eventLogStruct)) + if eventLogStruct.EventType == "bitrise_started" { + bitriseStartedEvent = eventLogStruct.Content + break + } } - bitriseStartedLog := lines[0] - require.NoError(t, json.Unmarshal([]byte(bitriseStartedLog), &bitriseStartedEventLog)) - bitriseStartedEvent := bitriseStartedEventLog.BitriseStartedEvent var usedStepBundles []string @@ -77,6 +83,6 @@ func checkRequiredStepBundle(t *testing.T, log string, requiredStepBundle string } } - require.Equal(t, 1, len(usedStepBundles), bitriseStartedLog) - require.EqualValues(t, requiredStepBundle, usedStepBundles[0], bitriseStartedLog) + require.Equal(t, 1, len(usedStepBundles), log) + require.EqualValues(t, requiredStepBundle, usedStepBundles[0], log) } From e6bfe30946622fa331cc753a7acf8dbf4aa4427e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 9 Aug 2024 16:16:15 +0200 Subject: [PATCH 8/9] Fix docker tests --- _tests/integration/docker_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_tests/integration/docker_test.go b/_tests/integration/docker_test.go index 6799f8b9..73df4852 100644 --- a/_tests/integration/docker_test.go +++ b/_tests/integration/docker_test.go @@ -224,7 +224,7 @@ func checkRequiredContainers(t *testing.T, log string, requiredContainerImage st } } - require.Equal(t, 1, len(usedContainerImages), bitriseStartedLog) - require.EqualValues(t, requiredContainerImage, usedContainerImages[0], bitriseStartedLog) - require.EqualValues(t, requiredServiceImages, usedServiceImages, bitriseStartedLog) + require.Equal(t, 1, len(usedContainerImages), log) + require.EqualValues(t, requiredContainerImage, usedContainerImages[0], log) + require.EqualValues(t, requiredServiceImages, usedServiceImages, log) } From 9d64db124ecd06c49af2e095d5de0ea880aa0cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Thu, 15 Aug 2024 14:29:46 +0200 Subject: [PATCH 9/9] Pull stepman dep from master branch --- go.mod | 2 +- go.sum | 4 +- tools/tools.go | 12 -- .../bitrise-io/stepman/activator/activator.go | 8 - .../bitrise-io/stepman/activator/git_ref.go | 3 +- .../bitrise-io/stepman/activator/path_ref.go | 11 +- .../{cli => activator/steplib}/activate.go | 142 +++++------------- .../stepman/activator/steplib_ref.go | 64 +++++--- .../bitrise-io/stepman/cli/commands.go | 1 - .../bitrise-io/stepman/cli/errors.go | 5 - .../bitrise-io/stepman/cli/step_list.go | 3 +- vendor/modules.txt | 3 +- 12 files changed, 87 insertions(+), 171 deletions(-) rename vendor/github.com/bitrise-io/stepman/{cli => activator/steplib}/activate.go (60%) delete mode 100644 vendor/github.com/bitrise-io/stepman/cli/errors.go diff --git a/go.mod b/go.mod index 5300e654..15a30f28 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/bitrise-io/go-utils v1.0.13 github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.22 github.com/bitrise-io/goinp v0.0.0-20240103152431-054ed78518ef - github.com/bitrise-io/stepman v0.0.0-20240628140527-5e941cdb67a1 + github.com/bitrise-io/stepman v0.0.0-20240731124408-5b7e38abd0bf github.com/go-git/go-git/v5 v5.12.0 github.com/gofrs/uuid v4.3.1+incompatible github.com/hashicorp/go-version v1.4.0 diff --git a/go.sum b/go.sum index 422151a7..2a292c92 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.22 h1:/SD9xE4LlX/Ju9YZ+n/yW/uDs7h github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.22/go.mod h1:Laih4ji980SQkRgdnMCH0g4u2GZI/5nnbqmYT9UfKFQ= github.com/bitrise-io/goinp v0.0.0-20240103152431-054ed78518ef h1:R5FOa8RHjqZwMN9g1FQ8W7nXxQAG7iwq1Cw+mUk5S9A= github.com/bitrise-io/goinp v0.0.0-20240103152431-054ed78518ef/go.mod h1:27ldH2bkCdYN5CEJ6x92EK+gkd5EcDBkA7dMrSKQFYU= -github.com/bitrise-io/stepman v0.0.0-20240628140527-5e941cdb67a1 h1:/hVIftPENx0k6JuXDgPbpWXCx1Lm4GbvsUVfgr6618A= -github.com/bitrise-io/stepman v0.0.0-20240628140527-5e941cdb67a1/go.mod h1:netRLDQD95IzWZbzmn7CBolzNqH1tErRKS31BrZKt9s= +github.com/bitrise-io/stepman v0.0.0-20240731124408-5b7e38abd0bf h1:Sw+nLHrAqcPE7jbsIgFMvaRsvQOZAA95xFCPUSb0ZKE= +github.com/bitrise-io/stepman v0.0.0-20240731124408-5b7e38abd0bf/go.mod h1:Lq9nEqKerBD35w3eSU8lf83F7uZPkXfmRSZEUDJN40w= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= diff --git a/tools/tools.go b/tools/tools.go index 1180e90d..04a28820 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -134,18 +134,6 @@ func StepmanSetup(collection string) error { return stepman.Setup(collection, "", log) } -// StepmanUpdate ... -func StepmanUpdate(collection string) error { - log := log.NewLogger(log.GetGlobalLoggerOpts()) - return stepman.UpdateLibrary(collection, log) -} - -// StepmanActivate ... -func StepmanActivate(collection, stepID, stepVersion, dir, ymlPth string, isOfflineMode bool) error { - log := log.NewLogger(log.GetGlobalLoggerOpts()) - return stepman.Activate(collection, stepID, stepVersion, dir, ymlPth, false, log, isOfflineMode) -} - // StepmanStepInfo ... func StepmanStepInfo(collection, stepID, stepVersion string) (stepmanModels.StepInfoModel, error) { log := log.NewLogger(log.GetGlobalLoggerOpts()) diff --git a/vendor/github.com/bitrise-io/stepman/activator/activator.go b/vendor/github.com/bitrise-io/stepman/activator/activator.go index dbfe5720..47dbf732 100644 --- a/vendor/github.com/bitrise-io/stepman/activator/activator.go +++ b/vendor/github.com/bitrise-io/stepman/activator/activator.go @@ -3,14 +3,6 @@ package activator type ActivatedStep struct { StepYMLPath string - // TODO: this is a mess and only makes sense in the context of a path:: ref - // This should be cleaned up when all step actions are moved here from the CLI, - // but I don't want to blow up my PR with that change. - OrigStepYMLPath string - - // TODO: is this always the same as the `activatedStepDir` function param in all activations? Can we clean this up? - WorkDir string - // DidStepLibUpdate indicates that the local steplib cache was updated while resolving the exact step version. DidStepLibUpdate bool } diff --git a/vendor/github.com/bitrise-io/stepman/activator/git_ref.go b/vendor/github.com/bitrise-io/stepman/activator/git_ref.go index 706b6b0a..35d58282 100644 --- a/vendor/github.com/bitrise-io/stepman/activator/git_ref.go +++ b/vendor/github.com/bitrise-io/stepman/activator/git_ref.go @@ -51,7 +51,6 @@ even if the repository is open source!`) return ActivatedStep{ StepYMLPath: stepYMLPath, - OrigStepYMLPath: "", // TODO: temporary during refactors, see definition - WorkDir: activatedStepDir, + DidStepLibUpdate: false, }, nil } diff --git a/vendor/github.com/bitrise-io/stepman/activator/path_ref.go b/vendor/github.com/bitrise-io/stepman/activator/path_ref.go index 3f456118..a94b167e 100644 --- a/vendor/github.com/bitrise-io/stepman/activator/path_ref.go +++ b/vendor/github.com/bitrise-io/stepman/activator/path_ref.go @@ -17,7 +17,7 @@ func ActivatePathRefStep( workDir string, ) (ActivatedStep, error) { log.Debugf("Local step found: (path:%s)", id.IDorURI) - // TODO: id.IDorURI is a path to the step dir in this case + // id.IDorURI is a path to the step dir in this case stepAbsLocalPth, err := pathutil.AbsPath(id.IDorURI) if err != nil { return ActivatedStep{}, err @@ -40,8 +40,8 @@ func ActivatePathRefStep( return ActivatedStep{}, fmt.Errorf("step.yml doesn't exist at %s", origStepYMLPth) } - stepYMLPath := filepath.Join(workDir, "current_step.yml") - if err := command.CopyFile(origStepYMLPth, stepYMLPath); err != nil { + activatedStepYMLPath := filepath.Join(workDir, "current_step.yml") + if err := command.CopyFile(origStepYMLPth, activatedStepYMLPath); err != nil { return ActivatedStep{}, err } @@ -50,8 +50,7 @@ func ActivatePathRefStep( } return ActivatedStep{ - StepYMLPath: stepYMLPath, - OrigStepYMLPath: origStepYMLPth, - WorkDir: activatedStepDir, + StepYMLPath: activatedStepYMLPath, + DidStepLibUpdate: false, }, nil } diff --git a/vendor/github.com/bitrise-io/stepman/cli/activate.go b/vendor/github.com/bitrise-io/stepman/activator/steplib/activate.go similarity index 60% rename from vendor/github.com/bitrise-io/stepman/cli/activate.go rename to vendor/github.com/bitrise-io/stepman/activator/steplib/activate.go index d71b102e..0f192a5d 100644 --- a/vendor/github.com/bitrise-io/stepman/cli/activate.go +++ b/vendor/github.com/bitrise-io/stepman/activator/steplib/activate.go @@ -1,4 +1,4 @@ -package cli +package steplib import ( "fmt" @@ -7,92 +7,28 @@ import ( "slices" "github.com/bitrise-io/go-utils/command" - "github.com/bitrise-io/go-utils/log" "github.com/bitrise-io/go-utils/pathutil" "github.com/bitrise-io/stepman/models" "github.com/bitrise-io/stepman/stepman" - "github.com/urfave/cli" ) -var activateCommand = cli.Command{ - Name: "activate", - Usage: "Copy the step with specified --id, and --version, into provided path. If --version flag is not set, the latest version of the step will be used. If --copyyml flag is set, step.yml will be copied to the given path.", - Flags: []cli.Flag{ - cli.StringFlag{ - Name: CollectionKey + ", " + collectionKeyShort, - Usage: "Collection of step.", - EnvVar: CollectionPathEnvKey, - }, - cli.StringFlag{ - Name: IDKey + ", " + idKeyShort, - Usage: "Step id.", - }, - cli.StringFlag{ - Name: VersionKey + ", " + versionKeyShort, - Usage: "Step version.", - }, - cli.StringFlag{ - Name: PathKey + ", " + pathKeyShort, - Usage: "Path where the step will copied.", - }, - cli.StringFlag{ - Name: CopyYMLKey + ", " + copyYMLKeyShort, - Usage: "Path where the activated step's step.yml will be copied.", - }, - cli.BoolFlag{ - Name: UpdateKey + ", " + updateKeyShort, - Usage: "If flag is set, and collection doesn't contains the specified step, the collection will updated.", - }, - }, - Action: func(c *cli.Context) error { - if err := activate(c); err != nil { - failf("Command failed: %s", err) - } - return nil - }, -} - -func activate(c *cli.Context) error { - stepLibURI := c.String(CollectionKey) - if stepLibURI == "" { - return fmt.Errorf("no steplib specified") - } - - id := c.String(IDKey) - if id == "" { - return fmt.Errorf("no step ID specified") - } - - path := c.String(PathKey) - if path == "" { - return fmt.Errorf("no destination path specified") - } - - version := c.String(VersionKey) - copyYML := c.String(CopyYMLKey) - update := c.Bool(UpdateKey) - logger := log.NewDefaultLogger(false) - isOfflineMode := false +var errStepNotAvailableOfflineMode error = fmt.Errorf("step not available in offline mode") - return Activate(stepLibURI, id, version, path, copyYML, update, logger, isOfflineMode) -} - -// Activate ... -func Activate(stepLibURI, id, version, destination, destinationStepYML string, updateLibrary bool, log stepman.Logger, isOfflineMode bool) error { - stepLib, err := stepman.ReadStepSpec(stepLibURI) +func ActivateStep(stepLibURI, id, version, destination, destinationStepYML string, log stepman.Logger, isOfflineMode bool) error { + stepCollection, err := stepman.ReadStepSpec(stepLibURI) if err != nil { return fmt.Errorf("failed to read %s steplib: %s", stepLibURI, err) } - step, version, err := queryStep(stepLib, stepLibURI, id, version, updateLibrary, log) + step, version, err := queryStep(stepCollection, stepLibURI, id, version) if err != nil { return fmt.Errorf("failed to find step: %s", err) } - srcFolder, err := activateStep(stepLib, stepLibURI, id, version, step, log, isOfflineMode) + srcFolder, err := activateStep(stepCollection, stepLibURI, id, version, step, log, isOfflineMode) if err != nil { if err == errStepNotAvailableOfflineMode { - availableVersions := listCachedStepVersion(log, stepLib, stepLibURI, id) + availableVersions := ListCachedStepVersions(log, stepCollection, stepLibURI, id) versionList := "Other versions available in the local cache:" for _, version := range availableVersions { versionList = versionList + fmt.Sprintf("\n- %s", version) @@ -118,17 +54,9 @@ func Activate(stepLibURI, id, version, destination, destinationStepYML string, u return nil } -func queryStep(stepLib models.StepCollectionModel, stepLibURI string, id, version string, updateLibrary bool, log stepman.Logger) (models.StepModel, string, error) { +func queryStep(stepLib models.StepCollectionModel, stepLibURI string, id, version string) (models.StepModel, string, error) { step, stepFound, versionFound := stepLib.GetStep(id, version) - if (!stepFound || !versionFound) && updateLibrary { - var err error - stepLib, err = stepman.UpdateLibrary(stepLibURI, log) - if err != nil { - return models.StepModel{}, "", fmt.Errorf("failed to update %s steplib: %s", stepLibURI, err) - } - step, stepFound, versionFound = stepLib.GetStep(id, version) - } if !stepFound { return models.StepModel{}, "", fmt.Errorf("%s steplib does not contain %s step", stepLibURI, id) } @@ -172,33 +100,6 @@ func activateStep(stepLib models.StepCollectionModel, stepLibURI, id, version st return stepCacheDir, nil } -func listCachedStepVersion(log stepman.Logger, stepLib models.StepCollectionModel, stepLibURI, stepID string) []string { - versions := []models.Semver{} - - for version, step := range stepLib.Steps[stepID].Versions { - _, err := activateStep(stepLib, stepLibURI, stepID, version, step, log, true) - if err != nil { - continue - } - - v, err := models.ParseSemver(version) - if err != nil { - log.Warnf("failed to parse version (%s): %s", version, err) - } - - versions = append(versions, v) - } - - slices.SortFunc(versions, models.CmpSemver) - - versionsStr := make([]string, len(versions)) - for i, v := range versions { - versionsStr[i] = v.String() - } - - return versionsStr -} - func copyStep(src, dst string) error { if exist, err := pathutil.IsPathExists(dst); err != nil { return fmt.Errorf("failed to check if %s path exist: %s", dst, err) @@ -233,3 +134,30 @@ func copyStepYML(libraryURL, id, version, dest string) error { } return nil } + +func ListCachedStepVersions(log stepman.Logger, stepLib models.StepCollectionModel, stepLibURI, stepID string) []string { + versions := []models.Semver{} + + for version, step := range stepLib.Steps[stepID].Versions { + _, err := activateStep(stepLib, stepLibURI, stepID, version, step, log, true) + if err != nil { + continue + } + + v, err := models.ParseSemver(version) + if err != nil { + log.Warnf("failed to parse version (%s): %s", version, err) + } + + versions = append(versions, v) + } + + slices.SortFunc(versions, models.CmpSemver) + + versionsStr := make([]string, len(versions)) + for i, v := range versions { + versionsStr[i] = v.String() + } + + return versionsStr +} diff --git a/vendor/github.com/bitrise-io/stepman/activator/steplib_ref.go b/vendor/github.com/bitrise-io/stepman/activator/steplib_ref.go index 69cb41ce..30e1efda 100644 --- a/vendor/github.com/bitrise-io/stepman/activator/steplib_ref.go +++ b/vendor/github.com/bitrise-io/stepman/activator/steplib_ref.go @@ -5,6 +5,7 @@ import ( "path/filepath" "github.com/bitrise-io/go-utils/pointers" + "github.com/bitrise-io/stepman/activator/steplib" "github.com/bitrise-io/stepman/cli" "github.com/bitrise-io/stepman/models" "github.com/bitrise-io/stepman/stepid" @@ -23,22 +24,50 @@ func ActivateSteplibRefStep( stepYMLPath := filepath.Join(workDir, "current_step.yml") activationResult := ActivatedStep{ StepYMLPath: stepYMLPath, - OrigStepYMLPath: "", // TODO: temporary during refactors, see definition - WorkDir: activatedStepDir, DidStepLibUpdate: false, } - err := cli.Setup(id.SteplibSource, "", log) + stepInfo, didUpdate, err := prepareStepLibForActivation(log, id, didStepLibUpdateInWorkflow, isOfflineMode) + activationResult.DidStepLibUpdate = didUpdate if err != nil { - return activationResult, fmt.Errorf("setup %s: %s", id.SteplibSource, err) + return activationResult, err } - versionConstraint, err := models.ParseRequiredVersion(id.Version) + err = steplib.ActivateStep(id.SteplibSource, id.IDorURI, stepInfo.Version, activatedStepDir, stepYMLPath, log, isOfflineMode) if err != nil { return activationResult, err } + + // TODO: this is sketchy, we should clean this up, but this pointer originates in the CLI codebase + stepInfoPtr.ID = stepInfo.ID + if stepInfoPtr.Step.Title == nil || *stepInfoPtr.Step.Title == "" { + stepInfoPtr.Step.Title = pointers.NewStringPtr(stepInfo.ID) + } + stepInfoPtr.Version = stepInfo.Version + stepInfoPtr.LatestVersion = stepInfo.LatestVersion + stepInfoPtr.OriginalVersion = stepInfo.OriginalVersion + stepInfoPtr.GroupInfo = stepInfo.GroupInfo + + return activationResult, nil +} + +func prepareStepLibForActivation( + log stepman.Logger, + id stepid.CanonicalID, + didStepLibUpdateInWorkflow bool, + isOfflineMode bool, +) (stepInfo models.StepInfoModel, didUpdate bool, err error) { + err = cli.Setup(id.SteplibSource, "", log) + if err != nil { + return models.StepInfoModel{}, false, fmt.Errorf("setup %s: %s", id.SteplibSource, err) + } + + versionConstraint, err := models.ParseRequiredVersion(id.Version) + if err != nil { + return models.StepInfoModel{}, false, err + } if versionConstraint.VersionLockType == models.InvalidVersionConstraint { - return activationResult, fmt.Errorf("version constraint is invalid: %s %s", id.IDorURI, id.Version) + return models.StepInfoModel{}, false, fmt.Errorf("version constraint is invalid: %s %s", id.IDorURI, id.Version) } if shouldUpdateStepLibForStep(versionConstraint, isOfflineMode, didStepLibUpdateInWorkflow) { @@ -47,13 +76,13 @@ func ActivateSteplibRefStep( if err != nil { log.Warnf("Step version constraint is latest or version locked, but failed to update StepLib, err: %s", err) } else { - activationResult.DidStepLibUpdate = true + didUpdate = true } } - stepInfo, err := cli.QueryStepInfoFromLibrary(id.SteplibSource, id.IDorURI, id.Version, log) + stepInfo, err = cli.QueryStepInfoFromLibrary(id.SteplibSource, id.IDorURI, id.Version, log) if err != nil { - return activationResult, err + return stepInfo, didUpdate, err } if stepInfo.Step.Title == nil || *stepInfo.Step.Title == "" { @@ -61,22 +90,7 @@ func ActivateSteplibRefStep( } stepInfo.OriginalVersion = id.Version - err = cli.Activate(id.SteplibSource, id.IDorURI, stepInfo.Version, activatedStepDir, stepYMLPath, false, log, isOfflineMode) - if err != nil { - return activationResult, err - } - - // TODO: this is sketchy, we should clean this up, but this pointer originates in the CLI codebase - stepInfoPtr.ID = stepInfo.ID - if stepInfoPtr.Step.Title == nil || *stepInfoPtr.Step.Title == "" { - stepInfoPtr.Step.Title = pointers.NewStringPtr(stepInfo.ID) - } - stepInfoPtr.Version = stepInfo.Version - stepInfoPtr.LatestVersion = stepInfo.LatestVersion - stepInfoPtr.OriginalVersion = stepInfo.OriginalVersion - stepInfoPtr.GroupInfo = stepInfo.GroupInfo - - return activationResult, nil + return stepInfo, didUpdate, nil } func shouldUpdateStepLibForStep(constraint models.VersionConstraint, isOfflineMode bool, didStepLibUpdateInWorkflow bool) bool { diff --git a/vendor/github.com/bitrise-io/stepman/cli/commands.go b/vendor/github.com/bitrise-io/stepman/cli/commands.go index bbdd19cd..a85d072c 100644 --- a/vendor/github.com/bitrise-io/stepman/cli/commands.go +++ b/vendor/github.com/bitrise-io/stepman/cli/commands.go @@ -66,7 +66,6 @@ var ( flUpdate, }, }, - activateCommand, { Name: "audit", Usage: "Validates Step or Step Collection.", diff --git a/vendor/github.com/bitrise-io/stepman/cli/errors.go b/vendor/github.com/bitrise-io/stepman/cli/errors.go deleted file mode 100644 index 23a9df8b..00000000 --- a/vendor/github.com/bitrise-io/stepman/cli/errors.go +++ /dev/null @@ -1,5 +0,0 @@ -package cli - -import "fmt" - -var errStepNotAvailableOfflineMode error = fmt.Errorf("step not available in offline mode") diff --git a/vendor/github.com/bitrise-io/stepman/cli/step_list.go b/vendor/github.com/bitrise-io/stepman/cli/step_list.go index f85c550e..4b3b82f4 100644 --- a/vendor/github.com/bitrise-io/stepman/cli/step_list.go +++ b/vendor/github.com/bitrise-io/stepman/cli/step_list.go @@ -10,6 +10,7 @@ import ( "github.com/bitrise-io/go-utils/log" "github.com/bitrise-io/go-utils/pointers" "github.com/bitrise-io/go-utils/stringutil" + "github.com/bitrise-io/stepman/activator/steplib" "github.com/bitrise-io/stepman/models" "github.com/bitrise-io/stepman/stepman" "github.com/urfave/cli" @@ -62,7 +63,7 @@ func printRawStepList(log stepman.Logger, stepLibURI string, maintaner string, s } if isShort { // print only step IDs and cached versions - cachedVersions := listCachedStepVersion(log, stepLib, stepLibURI, stepID) + cachedVersions := steplib.ListCachedStepVersions(log, stepLib, stepLibURI, stepID) id := fmt.Sprintf("%s (%s)", stepID, stepGroupInfo.Info.Maintainer) fmt.Printf("%s cached versions: %s\n", printInMaxNChars(id, 55), strings.Join(cachedVersions, ", ")) diff --git a/vendor/modules.txt b/vendor/modules.txt index e3388e88..3ec22e7f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -72,9 +72,10 @@ github.com/bitrise-io/go-utils/v2/retryhttp # github.com/bitrise-io/goinp v0.0.0-20240103152431-054ed78518ef ## explicit; go 1.18 github.com/bitrise-io/goinp/goinp -# github.com/bitrise-io/stepman v0.0.0-20240628140527-5e941cdb67a1 +# github.com/bitrise-io/stepman v0.0.0-20240731124408-5b7e38abd0bf ## explicit; go 1.18 github.com/bitrise-io/stepman/activator +github.com/bitrise-io/stepman/activator/steplib github.com/bitrise-io/stepman/cli github.com/bitrise-io/stepman/models github.com/bitrise-io/stepman/preload