feat(PipelinesService): Add support for pipeline inputs with type validation
Add support for the "inputs" parameter when creating pipelines via the GitLab
API. Pipeline inputs allow passing typed parameters to pipelines that use the
`spec:inputs` keyword in their `.gitlab-ci.yml` configuration.
Implementation details:
- Add PipelineInputOptions type as a map[string]any to hold input values
- Implement custom MarshalJSON to validate input types at serialization time
- Support the following value types as per GitLab API requirements:
* string
* integers (int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64)
* floats (float32, float64)
* bool
* string slice ([]string)
- Return `ErrInvalidPipelineInputType` for unsupported types to fail fast and
provide clear error messages
Testing improvements:
- Refactor `TestCreatePipeline` to use table-driven tests
- Add test coverage for the existing "variables" parameter
- Add test cases for pipeline inputs with various data types
- Add test case for invalid input type error handling
- Verify correct JSON serialization of both variables and inputs
This enables users to trigger pipelines with inputs like:
```go
client.Pipelines.CreatePipeline(projectID, &CreatePipelineOptions{
Ref: Ptr("main"),
Inputs: PipelineInputOptions{
"environment": "production",
"replicas": 3,
"enable_debug": false,
"regions": []string{"us-east", "eu-west"},
},
})
```
Issue: #2154
-
mentioned in commit 7108931a
-
mentioned in merge request gitlab-org/cli!2399 (merged)
-
mentioned in merge request gitlab-com/gl-infra/platform/runway/runwayctl!1233 (merged)
-
mentioned in merge request gitlab-org/release-tools!4481 (merged)
-
mentioned in merge request gitlab-com/gl-infra/woodhouse!681 (merged)
-
🔨 @glrenovatebotmentioned in merge request gitlab-com/gl-infra/oncall-robot-assistant!104
-
mentioned in merge request fforster/epic-update!15 (merged)
-
mentioned in merge request fforster/gitlab-mcp!171 (merged)
-
mentioned in merge request gitlab-com/gl-infra/autolabels!99 (merged)
-
mentioned in merge request gitlab-com/gl-infra/ringctl!357 (merged)
-
🤘 @pascal.sickmentioned in merge request sickit/token-operator!15 (merged)
-
mentioned in merge request schober-server/kubernetes/images/gitlab-token-refresher!35
-
mentioned in merge request ydkn/gitlab-runner-cleanup!42
-
mentioned in merge request gitlab-org/terraform-provider-gitlab!2677 (merged)
-
mentioned in merge request hojerdev/git-sync!64 (merged)
-
mentioned in merge request sue445/tanuki_reminder!262 (merged)
-
mentioned in merge request sue445/create-merge-request!149 (merged)
-
mentioned in merge request gitlab-org/container-registry!2558 (merged)