Skip to content

Commit

Permalink
do not download release for update stemcell unless required
Browse files Browse the repository at this point in the history
  • Loading branch information
dlinsley committed Jul 1, 2024
1 parent 81a933d commit 0383e3c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/commands/update_stemcell.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ type UpdateStemcell struct {
Options struct {
flags.Standard

Version string `short:"v" long:"version" required:"true" description:"desired version of stemcell"`
ReleasesDir string `short:"rd" long:"releases-directory" default:"releases" description:"path to a directory to download releases into"`
WithoutDownload bool `long:"without-download" description:"updates stemcell releases without downloading releases"`
Version string `short:"v" long:"version" required:"true" description:"desired version of stemcell"`
ReleasesDir string `short:"rd" long:"releases-directory" default:"releases" description:"path to a directory to download releases into"`
}
FS billy.Filesystem
MultiReleaseSourceProvider MultiReleaseSourceProvider
Expand Down Expand Up @@ -93,14 +92,15 @@ func (update UpdateStemcell) Execute(args []string) error {
}
lock := &kilnfileLock.Releases[i]

if update.Options.WithoutDownload {
lock.SHA1 = remote.SHA1
} else {
if remote.SHA1 == "" || remote.SHA1 == "not-calculated" {
// release source needs to download.
local, err := releaseSource.DownloadRelease(update.Options.ReleasesDir, remote)
if err != nil {
return fmt.Errorf("while downloading release %q, encountered error: %w", rel.Name, err)
}
lock.SHA1 = local.Lock.SHA1
} else {
lock.SHA1 = remote.SHA1
}
lock.RemotePath = remote.RemotePath
lock.RemoteSource = remote.RemoteSource
Expand Down

0 comments on commit 0383e3c

Please sign in to comment.