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

Prevent Reupload of Releases #679

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
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
10 changes: 10 additions & 0 deletions cmd/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ var _ = Describe("DeployCmd", func() {
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 upload 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