Skip to content

Commit 27f84b2

Browse files
committed
kiln upload-release fails when given a compiled release
Authored-by: Matt Royal <mroyal@pivotal.io> [#171270560] kiln upload-release fails when given a compiled release
1 parent 9d898d9 commit 27f84b2

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

commands/upload_release.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ func (command UploadRelease) Execute(args []string) error {
6666
}
6767

6868
manifest := part.Metadata.(builder.ReleaseManifest)
69+
if manifest.StemcellOS != "" {
70+
return fmt.Errorf("cannot upload compiled release %q - only uncompiled releases are allowed", command.Options.LocalPath)
71+
}
6972

7073
requirement := release.Requirement{Name: manifest.Name, Version: manifest.Version}
7174
_, found, err := releaseUploader.GetMatchedRelease(requirement)

commands/upload_release_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,27 @@ var _ = Describe("UploadRelease", func() {
9898
Expect(releaseUploader.UploadReleaseCallCount()).To(Equal(0))
9999
})
100100
})
101+
102+
When("the release tarball is compiled", func() {
103+
BeforeEach(func() {
104+
_, err := test_helpers.WriteTarballWithFile("banana-release.tgz", "release.MF", `
105+
name: banana
106+
version: 1.2.3
107+
compiled_packages:
108+
- stemcell: plan9/42
109+
`, fs)
110+
Expect(err).NotTo(HaveOccurred())
111+
})
112+
113+
It("errors and does not upload", func() {
114+
err := uploadRelease.Execute([]string{
115+
"--local-path", "banana-release.tgz",
116+
"--upload-target-id", "orange-bucket",
117+
})
118+
Expect(err).To(MatchError(ContainSubstring("compiled release")))
119+
Expect(releaseUploader.UploadReleaseCallCount()).To(Equal(0))
120+
})
121+
})
101122
})
102123

103124
When("the release tarball is invalid", func() {

0 commit comments

Comments
 (0)