From b1e5898538f32d155bd0c670f5cd96ddee52d66e Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 3 Nov 2024 00:55:47 +0100 Subject: [PATCH] expose step type to step env --- docs/docs/20-usage/50-environment.md | 1 + pipeline/frontend/metadata/environment.go | 1 + pipeline/frontend/metadata/types.go | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/docs/20-usage/50-environment.md b/docs/docs/20-usage/50-environment.md index 9f6bd75e7..3f2794cb4 100644 --- a/docs/docs/20-usage/50-environment.md +++ b/docs/docs/20-usage/50-environment.md @@ -95,6 +95,7 @@ This is the reference list of all environment variables available to your pipeli | `CI_WORKFLOW_NAME` | workflow name | `release` | | | **Current step** | | | `CI_STEP_NAME` | step name | `build package` | +| `CI_STEP_TYPE` | step type (`commands`, `plugin`, `service`, `clone` or `cache`) | `commands` | | `CI_STEP_NUMBER` | step number | `0` | | `CI_STEP_STARTED` | step started UNIX timestamp | `1722617519` | | `CI_STEP_URL` | URL to step in UI | `https://ci.example.com/repos/7/pipeline/8` | diff --git a/pipeline/frontend/metadata/environment.go b/pipeline/frontend/metadata/environment.go index 25ac55d31..fdf6b43bd 100644 --- a/pipeline/frontend/metadata/environment.go +++ b/pipeline/frontend/metadata/environment.go @@ -96,6 +96,7 @@ func (m *Metadata) Environ() map[string]string { "CI_WORKFLOW_NUMBER": strconv.Itoa(m.Workflow.Number), "CI_STEP_NAME": m.Step.Name, + "CI_STEP_TYPE": m.Step.Type, "CI_STEP_NUMBER": strconv.Itoa(m.Step.Number), "CI_STEP_STARTED": "", // will be set by agent "CI_STEP_URL": m.getPipelineWebURL(m.Curr, m.Step.Number), diff --git a/pipeline/frontend/metadata/types.go b/pipeline/frontend/metadata/types.go index 5fa56e85e..3ecfcb96b 100644 --- a/pipeline/frontend/metadata/types.go +++ b/pipeline/frontend/metadata/types.go @@ -88,6 +88,7 @@ type ( // Step defines runtime metadata for a step. Step struct { Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` Number int `json:"number,omitempty"` }