grim/convey

Parents 7a65a06a16c3
Children fc69cdc14dd1
Make the docker pull and push tasks handle a mix of image and images attributes
--- a/docker/pull.go Mon Oct 11 02:09:05 2021 -0500
+++ b/docker/pull.go Mon Oct 11 02:17:28 2021 -0500
@@ -29,7 +29,7 @@
func (p *Pull) Valid() error {
if p.Image != "" {
- p.Images = yaml.StringOrSlice{p.Image}
+ p.Images = append([]string{p.Image}, p.Images...)
}
p.realPull = &podman.Pull{
--- a/docker/pull_test.go Mon Oct 11 02:09:05 2021 -0500
+++ b/docker/pull_test.go Mon Oct 11 02:17:28 2021 -0500
@@ -6,6 +6,7 @@
. "github.com/onsi/gomega"
"keep.imfreedom.org/grim/convey/podman"
+ "keep.imfreedom.org/grim/convey/yaml"
)
func TestPullImage(t *testing.T) {
@@ -28,6 +29,18 @@
g.Expect(p.Valid()).To(BeNil())
}
+func TestPullImagesMerged(t *testing.T) {
+ g := NewGomegaWithT(t)
+
+ p := &Pull{
+ Image: "foo",
+ Images: []string{"bar"},
+ }
+
+ g.Expect(p.Valid()).To(BeNil())
+ g.Expect(p.Images).To(Equal(yaml.StringOrSlice{"foo", "bar"}))
+}
+
func TestPullImageRequired(t *testing.T) {
g := NewGomegaWithT(t)
--- a/docker/push.go Mon Oct 11 02:09:05 2021 -0500
+++ b/docker/push.go Mon Oct 11 02:17:28 2021 -0500
@@ -29,7 +29,7 @@
func (p *Push) Valid() error {
if p.Image != "" {
- p.Images = yaml.StringOrSlice{p.Image}
+ p.Images = append([]string{p.Image}, p.Images...)
}
p.realPush = &podman.Push{
--- a/docker/push_test.go Mon Oct 11 02:09:05 2021 -0500
+++ b/docker/push_test.go Mon Oct 11 02:17:28 2021 -0500
@@ -6,6 +6,7 @@
. "github.com/onsi/gomega"
"keep.imfreedom.org/grim/convey/podman"
+ "keep.imfreedom.org/grim/convey/yaml"
)
func TestPushImage(t *testing.T) {
@@ -28,6 +29,18 @@
g.Expect(p.Valid()).To(BeNil())
}
+func TestPushImagesMerged(t *testing.T) {
+ g := NewGomegaWithT(t)
+
+ p := &Push{
+ Image: "foo",
+ Images: []string{"bar"},
+ }
+
+ g.Expect(p.Valid()).To(BeNil())
+ g.Expect(p.Images).To(Equal(yaml.StringOrSlice{"foo", "bar"}))
+}
+
func TestPushImageRequired(t *testing.T) {
g := NewGomegaWithT(t)