Skip to content

Commit

Permalink
Ensure global env are signed with steps (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
petetomasik authored Jan 8, 2025
1 parent 0b9dbcc commit 093f8aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion buildkite/data_source_signed_pipeline_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (s *signedPipelineStepsDataSource) Read(
}
}

if err := signature.SignSteps(ctx, p.Steps, key, data.Repository.ValueString()); err != nil {
if err := signature.SignSteps(ctx, p.Steps, key, data.Repository.ValueString(), signature.WithEnv(p.Env.ToMap())); err != nil {
resp.Diagnostics.AddError("Failed to sign pipeline", err.Error())
return
}
Expand Down
6 changes: 5 additions & 1 deletion buildkite/data_source_signed_pipeline_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func TestAccBuildkiteSignedPipelineStepsDataSource(t *testing.T) {
steps:
- label: ":pipeline:"
command: buildkite-agent pipeline upload
env:
LOCAL_ENV: "bar"
env:
GLOBAL_ENV: "foo"
`)

privateJWKS, _, err := jwkutil.NewKeyPair(jwksKeyID, jwa.EdDSA)
Expand All @@ -49,7 +53,7 @@ func TestAccBuildkiteSignedPipelineStepsDataSource(t *testing.T) {
t.Fatalf("Failed to parse pipeline: %v", err)
}

if err := signature.SignSteps(context.Background(), p.Steps, privateKey, repository); err != nil {
if err := signature.SignSteps(context.Background(), p.Steps, privateKey, repository, signature.WithEnv(p.Env.ToMap())); err != nil {
t.Fatalf("Failed to sign pipeline: %v", err)
}

Expand Down

0 comments on commit 093f8aa

Please sign in to comment.