From c0e88b229a77e3ae412bc2afe2a62f6e62b64475 Mon Sep 17 00:00:00 2001
From: Knative Prow Robot <knative-prow-robot@google.com>
Date: Thu, 23 Dec 2021 05:17:28 -0800
Subject: [PATCH] Using proper image (#133)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Chris SuszyƄski <ksuszyns@redhat.com>
---
 pkg/cli/ics/constants.go |  5 -----
 pkg/sender/in_cluster.go | 13 ++-----------
 2 files changed, 2 insertions(+), 16 deletions(-)
 delete mode 100644 pkg/cli/ics/constants.go

diff --git a/pkg/cli/ics/constants.go b/pkg/cli/ics/constants.go
deleted file mode 100644
index 2daec77e7..000000000
--- a/pkg/cli/ics/constants.go
+++ /dev/null
@@ -1,5 +0,0 @@
-package ics
-
-// ContainerBasename holds a OCI container base name.
-// TODO: set value from .env file during the build.
-var ContainerBasename = "quay.io/cardil" //nolint:gochecknoglobals
diff --git a/pkg/sender/in_cluster.go b/pkg/sender/in_cluster.go
index 811dff44f..3647da032 100644
--- a/pkg/sender/in_cluster.go
+++ b/pkg/sender/in_cluster.go
@@ -2,7 +2,6 @@ package sender
 
 import (
 	"fmt"
-	"regexp"
 
 	cloudevents "github.com/cloudevents/sdk-go/v2"
 	batchv1 "k8s.io/api/batch/v1"
@@ -11,6 +10,7 @@ import (
 	"knative.dev/kn-plugin-event/pkg/cli/ics"
 	"knative.dev/kn-plugin-event/pkg/event"
 	"knative.dev/kn-plugin-event/pkg/k8s"
+	"knative.dev/kn-plugin-event/pkg/metadata"
 )
 
 type inClusterSender struct {
@@ -44,7 +44,7 @@ func (i *inClusterSender) Send(ce cloudevents.Event) error {
 					RestartPolicy: corev1.RestartPolicyNever,
 					Containers: []corev1.Container{{
 						Name:  "kn-event-sender",
-						Image: imageFor("kn-event-sender"),
+						Image: metadata.ResolveImage(),
 						Env: []corev1.EnvVar{{
 							Name:  "K_SINK",
 							Value: url.String(),
@@ -63,12 +63,3 @@ func (i *inClusterSender) Send(ce cloudevents.Event) error {
 	}
 	return nil
 }
-
-func imageFor(artifact string) string {
-	basename := ics.ContainerBasename
-	r := regexp.MustCompile(".+[A-Za-z0-9]$")
-	if r.MatchString(basename) {
-		basename += "/"
-	}
-	return basename + artifact
-}