expose step type to step env

This commit is contained in:
6543 2024-11-03 00:55:47 +01:00
parent 6ef7cddde8
commit b1e5898538
3 changed files with 3 additions and 0 deletions

View file

@ -95,6 +95,7 @@ This is the reference list of all environment variables available to your pipeli
| `CI_WORKFLOW_NAME` | workflow name | `release` | | `CI_WORKFLOW_NAME` | workflow name | `release` |
| | **Current step** | | | | **Current step** | |
| `CI_STEP_NAME` | step name | `build package` | | `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_NUMBER` | step number | `0` |
| `CI_STEP_STARTED` | step started UNIX timestamp | `1722617519` | | `CI_STEP_STARTED` | step started UNIX timestamp | `1722617519` |
| `CI_STEP_URL` | URL to step in UI | `https://ci.example.com/repos/7/pipeline/8` | | `CI_STEP_URL` | URL to step in UI | `https://ci.example.com/repos/7/pipeline/8` |

View file

@ -96,6 +96,7 @@ func (m *Metadata) Environ() map[string]string {
"CI_WORKFLOW_NUMBER": strconv.Itoa(m.Workflow.Number), "CI_WORKFLOW_NUMBER": strconv.Itoa(m.Workflow.Number),
"CI_STEP_NAME": m.Step.Name, "CI_STEP_NAME": m.Step.Name,
"CI_STEP_TYPE": m.Step.Type,
"CI_STEP_NUMBER": strconv.Itoa(m.Step.Number), "CI_STEP_NUMBER": strconv.Itoa(m.Step.Number),
"CI_STEP_STARTED": "", // will be set by agent "CI_STEP_STARTED": "", // will be set by agent
"CI_STEP_URL": m.getPipelineWebURL(m.Curr, m.Step.Number), "CI_STEP_URL": m.getPipelineWebURL(m.Curr, m.Step.Number),

View file

@ -88,6 +88,7 @@ type (
// Step defines runtime metadata for a step. // Step defines runtime metadata for a step.
Step struct { Step struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Number int `json:"number,omitempty"` Number int `json:"number,omitempty"`
} }