Skip to content

Commit 1ea6feb

Browse files
committed
Parse GitlabFeatures from the JobResponse
This is the other half of the capability signalling that Gitlab does. Not only does a runner signal what features it is capable of supporting when making a request, but the server also provides some information back to the runner about what capabilities it provides. There are currently three capabilities Gitlab can indicate it has (this commit only adds parsing not support): - Separating the trace into sections for easier viewing. - Prefix masking (it's not totally clear why this is a Gitlab feature - but this is the mechanism by which the prefix masks are communicated to a runner willing to mask them). - Failure reasons. The end goal here is support for prefix masking, so that things like PAT tokens are all automatically masked system-wide in logs.
1 parent e4d8dce commit 1ea6feb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

gitlab-runner/src/client.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ pub(crate) struct JobDependency {
168168
pub artifacts_file: Option<JobArtifactFile>,
169169
}
170170

171+
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]
172+
pub(crate) struct GitlabFeatures {
173+
#[serde(default)]
174+
pub trace_sections: bool,
175+
#[serde(default, deserialize_with = "deserialize_null_default")]
176+
pub token_mask_prefixes: Vec<String>,
177+
#[serde(default, deserialize_with = "deserialize_null_default")]
178+
pub failure_reasons: Vec<String>,
179+
}
180+
171181
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]
172182
pub(crate) struct JobResponse {
173183
pub id: u64,
@@ -180,6 +190,8 @@ pub(crate) struct JobResponse {
180190
pub dependencies: Vec<JobDependency>,
181191
#[serde(deserialize_with = "deserialize_null_default")]
182192
pub artifacts: Vec<JobArtifact>,
193+
#[serde(default)]
194+
pub features: Option<GitlabFeatures>,
183195
#[serde(flatten)]
184196
unparsed: JsonValue,
185197
}

0 commit comments

Comments
 (0)