Skip to content

Commit

Permalink
fixed skip-image-locking not recording an entry in the lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
djcass44 committed Oct 17, 2023
1 parent 1477338 commit b42b2ba
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cmd/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,26 @@ func lock(cmd *cobra.Command, _ []string) error {
}

// get the digest of the base image
if !skipImageLocking && cfg.Spec.From != containerutil.MagicImageScratch {
if cfg.Spec.From != containerutil.MagicImageScratch {
baseDigest, err := crane.Digest(airutil.ExpandEnv(cfg.Spec.From), crane.WithAuthFromKeychain(ociutil.KeyChain(ociutil.Auth{})))
if err != nil {
return err
}

resolved := cfg.Spec.From
if !skipImageLocking {
resolved = cfg.Spec.From + "@" + baseDigest
} else {
log.Info("warning: this build may not be reproducible - image locking is disabled")
}

lockFile.Packages[""] = lockfile.Package{
Name: cfg.Spec.From,
Resolved: cfg.Spec.From + "@" + baseDigest,
Resolved: resolved,
Integrity: baseDigest,
Type: aybv1.PackageOCI,
}
}
if skipImageLocking {
log.Info("warning: this build may not be reproducible - image locking is disabled")
}

type expandedRepo struct {
URL string
Expand Down

0 comments on commit b42b2ba

Please sign in to comment.