Skip to content

Commit d11316c

Browse files
Copilotzarenner
andauthored
Fix detection job environment YAML rendering
Co-authored-by: zarenner <13670625+zarenner@users.noreply.github.com>
1 parent 94f87eb commit d11316c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pkg/workflow/threat_detection.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,9 @@ func (c *Compiler) buildDetectionJob(data *WorkflowData) (*Job, error) {
10301030
// Azure OIDC federation rules require the environment to match the configured OIDC subject claims.
10311031
environment := ""
10321032
if data.SafeOutputs.ThreatDetection.Environment != "" {
1033-
environment = data.SafeOutputs.ThreatDetection.Environment
1033+
// ThreatDetectionConfig.Environment holds the raw environment name; normalize it to
1034+
// a YAML field so Job.Environment renders as "environment: <name>" not just "<name>".
1035+
environment = "environment: " + data.SafeOutputs.ThreatDetection.Environment
10341036
} else if data.EngineConfig != nil && data.EngineConfig.Auth != nil && data.EngineConfig.Auth.Type == "github-oidc" {
10351037
// When engine uses GitHub OIDC, inherit top-level environment for Azure federation
10361038
if data.Environment != "" {
@@ -1048,7 +1050,7 @@ func (c *Compiler) buildDetectionJob(data *WorkflowData) (*Job, error) {
10481050
Needs: needs,
10491051
If: jobCondition,
10501052
RunsOn: c.indentYAMLLines(runsOn, " "),
1051-
Environment: environment,
1053+
Environment: c.indentYAMLLines(environment, " "),
10521054
Permissions: permissions,
10531055
Steps: steps,
10541056
Outputs: outputs,

0 commit comments

Comments
 (0)