Skip to content
New issue

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

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

Already on GitHub? # to your account

Prevent Reupload of Releases #679

Merged
merged 10 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 4 additions & 0 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ func (c DeployCmd) Run(opts DeployOpts) error {

if opts.FixReleases {
bytes, err = c.releaseUploader.UploadReleasesWithFix(bytes)
} else if opts.SkipUploadReleases {
c.ui.PrintLinef("Release-Check skipped.")
} else {
bytes, err = c.releaseUploader.UploadReleases(bytes)
}
Expand Down Expand Up @@ -125,6 +127,8 @@ func setFlags(flags []string, opts DeployOpts) DeployOpts {
opts.Recreate = true
case "recreate-persistent-disks":
opts.RecreatePersistentDisks = true
case "skip-upload-releases":
opts.SkipUploadReleases = true
}
}

Expand Down
11 changes: 10 additions & 1 deletion cmd/deploy_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package cmd_test

import (
"errors"

Check failure on line 4 in cmd/deploy_test.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

File is not properly formatted (goimports)

"github.com/cppforlife/go-patch/patch"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -209,6 +208,16 @@
Expect(bytes).To(Equal([]byte("after-upload-manifest-with-fix")))
})

It("skips the upload of all releases in the corresponding deployment", func() {
deployOpts.SkipUploadReleases = true

err := act()
Expect(err).ToNot(HaveOccurred())
Expect(releaseUploader.UploadReleasesWithFixCallCount()).To(Equal(0))
Expect(releaseUploader.UploadReleasesCallCount()).To(Equal(0))
Expect(ui.Said).To(ContainElement("Release-Check skipped."))
})

It("returns error and does not deploy if uploading releases fails", func() {
deployOpts.Args.Manifest = opts.FileBytesArg{
Bytes: []byte(`
Expand Down
1 change: 1 addition & 0 deletions cmd/opts/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ type DeployOpts struct {
Fix bool `long:"fix" description:"Recreate an instance with an unresponsive agent instead of erroring"`
FixReleases bool `long:"fix-releases" description:"Reupload releases in manifest and replace corrupt or missing jobs/packages"`
SkipDrain []boshdir.SkipDrain `long:"skip-drain" value-name:"[INSTANCE-GROUP[/INSTANCE-ID]]" description:"Skip running drain and pre-stop scripts for specific instance groups" optional:"true" optional-value:"*"`
SkipUploadReleases bool `long:"skip-upload-releases" description:"Skips the download procedure for releases"`

Canaries string `long:"canaries" description:"Override manifest values for canaries"`
MaxInFlight string `long:"max-in-flight" description:"Override manifest values for max_in_flight"`
Expand Down
Loading