diff --git a/airflow/podman_image.go b/airflow/podman_image.go index af5e426d8..e3a24c924 100644 --- a/airflow/podman_image.go +++ b/airflow/podman_image.go @@ -69,19 +69,11 @@ func (p *PodmanImage) Push(cloudDomain, token, remoteImageTag string) error { registry := "registry." + cloudDomain remoteImage := fmt.Sprintf("%s/%s", registry, imageName(p.imageName, remoteImageTag)) - err := p.podmanBind.Tag(p.conn, imageName(p.imageName, "latest"), remoteImageTag, fmt.Sprintf("%s/%s", registry, p.imageName), nil) - if err != nil { - return fmt.Errorf("command 'podman tag %s %s' failed: %w", p.imageName, remoteImage, err) - } options := new(images.PushOptions) - if err := p.podmanBind.Push(p.conn, p.imageName, remoteImage, options); err != nil { + if err := p.podmanBind.Push(p.conn, imageName(p.imageName, "latest"), remoteImage, options); err != nil { return fmt.Errorf("error pushing %s image to %s: %w", p.imageName, registry, err) } - err = p.podmanBind.Untag(p.conn, imageName(p.imageName, "latest"), remoteImageTag, fmt.Sprintf("%s/%s", registry, p.imageName), nil) - if err != nil { - return fmt.Errorf("command 'podman untag %s' failed: %w", remoteImage, err) - } return nil } diff --git a/airflow/podman_image_test.go b/airflow/podman_image_test.go index bfcda1b6a..2f021e9e1 100644 --- a/airflow/podman_image_test.go +++ b/airflow/podman_image_test.go @@ -13,9 +13,7 @@ import ( func TestPodmanPushSuccess(t *testing.T) { bindMock := new(mocks.PodmanBind) podmanImageMock := &PodmanImage{imageName: "test", podmanBind: bindMock, conn: context.TODO()} - bindMock.On("Tag", podmanImageMock.conn, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) bindMock.On("Push", podmanImageMock.conn, mock.Anything, mock.Anything, mock.Anything).Return(nil) - bindMock.On("Untag", podmanImageMock.conn, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) err := podmanImageMock.Push("test.astro.io", "token", "2") assert.NoError(t, err) @@ -24,20 +22,9 @@ func TestPodmanPushSuccess(t *testing.T) { func TestPodmanPushFailure(t *testing.T) { bindMock := new(mocks.PodmanBind) podmanImageMock := &PodmanImage{imageName: "test", podmanBind: bindMock, conn: context.TODO()} - bindMock.On("Tag", podmanImageMock.conn, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(errPodman).Once() - err := podmanImageMock.Push("test.astro.io", "token", "2") - assert.Contains(t, err.Error(), "command 'podman tag test registry.test.astro.io/test/airflow:2' failed") - - bindMock.On("Tag", podmanImageMock.conn, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) bindMock.On("Push", podmanImageMock.conn, mock.Anything, mock.Anything, mock.Anything).Return(errPodman).Once() - err = podmanImageMock.Push("test.astro.io", "token", "2") + err := podmanImageMock.Push("test.astro.io", "token", "2") assert.Contains(t, err.Error(), "error pushing test image to registry.test.astro.io") - - bindMock.On("Push", podmanImageMock.conn, mock.Anything, mock.Anything, mock.Anything).Return(nil) - bindMock.On("Untag", podmanImageMock.conn, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(errPodman) - - err = podmanImageMock.Push("test.astro.io", "token", "2") - assert.Contains(t, err.Error(), "command 'podman untag registry.test.astro.io/test/airflow:2' failed") }