-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate io.buildpacks.rebasable label on rebase
For platforms >= 0.12 - the rebaser will now fail if the io.buildpacks.rebasable label is set to false when the force flag is not set. Signed-off-by: Jesse Brown <jabrown85@gmail.com>
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,6 +250,56 @@ func testRebaser(t *testing.T, when spec.G, it spec.S) { | |
}) | ||
}) | ||
|
||
when("platform API is >= 0.12", func() { | ||
it.Before(func() { | ||
rebaser.PlatformAPI = api.MustParse("0.12") | ||
}) | ||
|
||
when("validating rebasable", func() { | ||
when("rebaseable label is false", func() { | ||
it.Before(func() { | ||
h.AssertNil(t, fakeAppImage.SetLabel(platform.RebaseableLabel, "false")) | ||
}) | ||
|
||
it("returns an error", func() { | ||
_, err := rebaser.Rebase(fakeAppImage, fakeNewBaseImage, fakeAppImage.Name(), additionalNames) | ||
h.AssertError(t, err, "app image is not marked as rebaseable") | ||
}) | ||
|
||
when("force is true", func() { | ||
it("allows rebase", func() { | ||
rebaser.Force = true | ||
_, err := rebaser.Rebase(fakeAppImage, fakeNewBaseImage, fakeAppImage.Name(), additionalNames) | ||
h.AssertNil(t, err) | ||
}) | ||
}) | ||
}) | ||
|
||
when("rebaseable label is not false", func() { | ||
it.Before(func() { | ||
h.AssertNil(t, fakeAppImage.SetLabel(platform.RebaseableLabel, "true")) | ||
}) | ||
|
||
it("allows rebase", func() { | ||
_, err := rebaser.Rebase(fakeAppImage, fakeNewBaseImage, fakeAppImage.Name(), additionalNames) | ||
h.AssertNil(t, err) | ||
}) | ||
}) | ||
|
||
when("rebaseable label is empty", func() { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jabrown85
Author
Contributor
|
||
it.Before(func() { | ||
h.AssertNil(t, fakeAppImage.SetLabel(platform.RebaseableLabel, "")) | ||
}) | ||
|
||
it("allows rebase", func() { | ||
_, err := rebaser.Rebase(fakeAppImage, fakeNewBaseImage, fakeAppImage.Name(), additionalNames) | ||
h.AssertNil(t, err) | ||
}) | ||
}) | ||
}) | ||
|
||
}) | ||
|
||
when("validating mixins", func() { | ||
when("there are no mixin labels", func() { | ||
it("allows rebase", func() { | ||
|
What about when the label is missing? My sense is that we should treat it as safe to rebase, but maybe I'm wrong.