diff --git a/_tests/integration/step_info_test.go b/_tests/integration/step_info_test.go index e272558c..c7bbf059 100644 --- a/_tests/integration/step_info_test.go +++ b/_tests/integration/step_info_test.go @@ -3,6 +3,7 @@ package integration import ( "strings" "testing" + "os" "github.com/bitrise-io/go-utils/command" "github.com/stretchr/testify/require" @@ -47,6 +48,14 @@ func TestStepInfo(t *testing.T) { require.Equal(t, localTestStepDefinitionJSON, out) } + t.Log("local step - environment variable path --format json") + { + os.Setenv("STEP", ".") + out, err := command.New(binPath(), "step-info", "--collection", "path", "--id", "$STEP/test-step", "--format", "json").RunAndReturnTrimmedCombinedOutput() + require.NoError(t, err, out) + require.Equal(t, localTestStepDefinitionJSON, out) + } + t.Log("git step") { out, err := command.New(binPath(), "step-info", "--collection", "git", "--id", "https://github.com/bitrise-steplib/steps-xamarin-user-management.git", "--version", "1.0.3").RunAndReturnTrimmedCombinedOutput() diff --git a/cli/step_info.go b/cli/step_info.go index 9114d0df..168bb20a 100644 --- a/cli/step_info.go +++ b/cli/step_info.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "os" "path/filepath" "time" @@ -162,7 +163,8 @@ func QueryStepInfoFromGit(gitURL, tagOrBranch string) (models.StepInfoModel, err } // QueryStepInfoFromPath returns step info from a local path source -func QueryStepInfoFromPath(dir string) (models.StepInfoModel, error) { +func QueryStepInfoFromPath(envdir string) (models.StepInfoModel, error) { + dir := os.ExpandEnv(envdir) stepDefinitionPth := filepath.Join(dir, "step.yml") if exist, err := pathutil.IsPathExists(stepDefinitionPth); err != nil { return models.StepInfoModel{}, fmt.Errorf("query local step info: check if step.yml exist: %s", err)