Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform provenance verification in dedicated scratch dir #2297

Merged
merged 1 commit into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/anago/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ func (d *DefaultRelease) CheckProvenance() error {

func (d *defaultReleaseImpl) CheckStageProvenance(bucket, buildVersion string) error {
checker := release.NewProvenanceChecker(&release.ProvenanceCheckerOptions{
StageBucket: bucket,
ScratchDirectory: filepath.Join(workspaceDir, "provenance-workdir"),
StageBucket: bucket,
})

return checker.CheckStageProvenance(buildVersion)
Expand Down
11 changes: 9 additions & 2 deletions pkg/release/provenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ func (pc *ProvenanceChecker) CheckStageProvenance(buildVersion string) error {
}

// Run the check of the artifacts
return pc.impl.checkProvenance(pc.options, statement)
if err := pc.impl.checkProvenance(pc.options, statement); err != nil {
return errors.Wrap(err, "verifying provenance of staged artifacts")
}
logrus.Infof(
"Successfully verified provenance information of %d staged artifacts",
len(statement.Subject),
)
return nil
}

type ProvenanceCheckerOptions struct {
Expand All @@ -103,7 +110,7 @@ func (di *defaultProvenanceCheckerImpl) downloadStagedArtifacts(
) error {
logrus.Infof("Synching stage from %s to %s", path, opts.StageDirectory)
if !util.Exists(opts.StageDirectory) {
if err := os.Mkdir(opts.StageDirectory, os.FileMode(0o755)); err != nil {
if err := os.MkdirAll(opts.StageDirectory, os.FileMode(0o755)); err != nil {
return errors.Wrap(err, "creating local working directory")
}
}
Expand Down