Jelajahi Sumber

Merge pull request #1636 from porter-dev/belanger/fix-registry-image-tag

Use the registry tag if the preview environment build method is `registry`
abelanger5 4 tahun lalu
induk
melakukan
f1eb25ea7b
1 mengubah file dengan 13 tambahan dan 0 penghapusan
  1. 13 0
      cli/cmd/apply.go

+ 13 - 0
cli/cmd/apply.go

@@ -289,6 +289,19 @@ func (d *Driver) applyApplication(resource *models.Resource, client *api.Client,
 		tag = commit.Sha[:7]
 	}
 
+	// if the method is registry and a tag is defined, we use the provided tag
+	if appConfig.Build.Method == "registry" {
+		imageSpl := strings.Split(appConfig.Build.Image, ":")
+
+		if len(imageSpl) == 2 {
+			tag = imageSpl[1]
+		}
+
+		if tag == "" {
+			tag = "latest"
+		}
+	}
+
 	sharedOpts := &deploy.SharedOpts{
 		ProjectID:       d.target.Project,
 		ClusterID:       d.target.Cluster,