From 68b0554248f46f8719d4c4e6b367c359dfba9f4f Mon Sep 17 00:00:00 2001 From: Ricardo Maraschini Date: Fri, 21 Jun 2024 13:51:42 +0200 Subject: [PATCH] feat(user feedback): count lam as an embedded cluster artifact (#4703) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instead of showing lam image push in a different section of the kots output we should count it as part of the embedded cluster artifacts. output: ``` root@bold-sky:/home/dev# ./kots install embedded-cluster-smoke-test-staging-app/ci-airgap --license-file ./license.yaml --namespace kotsadm --app-version-label appver-dev-c51b55a --exclude-admin-console --airgap-bundle ./embedded-cluster-smoke-test-staging-app.airgap • Validating registry information ✓ • Deploying application Pushing application images (1/1) Pushing image 10.96.0.11:5000/embedded-cluster-smoke-test-staging-app/nginx:1.24-alpine Copying blob da33b1ad0ac4 skipped: already exists Copying blob 16eaaaf5f1c0 skipped: already exists Copying blob b407bcc80638 skipped: already exists Copying blob a0fbd691d7c1 skipped: already exists Copying blob 3c854c8cbf46 skipped: already exists Copying blob de5d475193dd skipped: already exists Copying blob 5e845cc16269 skipped: already exists Copying config 249f59e1de done | Writing manifest to image destination Pushing embedded cluster artifacts (1/7) Pushing image 10.96.0.11:5000/embedded-cluster-smoke-test-staging-app/embedded-cluster/embedded-cluster-local-artifact-mirror:dev-c51b55a Copying blob 4ea89e459bc7 skipped: already exists Copying blob dc4977db5b1f skipped: already exists Copying config 0ed66a3165 done | Writing manifest to image destination Pushing embedded cluster artifacts (2/7) Pushing embedded cluster artifacts (3/7) Pushing embedded cluster artifacts (4/7) Pushing embedded cluster artifacts (5/7) Pushing embedded cluster artifacts (6/7) Pushing embedded cluster artifacts (7/7) • Waiting for Admin Console to be ready ✓ • Uploading app archive • Waiting for installation to complete ✗ Error: failed to validate installation: license already exists for app embedded-cluster-smoke-test-staging-app root@bold-sky:/home/dev# ``` --- go.mod | 2 +- go.sum | 4 ++-- pkg/image/airgap.go | 14 +++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 853e76f252..6f758062dd 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 github.com/replicatedhq/embedded-cluster-kinds v1.3.10 - github.com/replicatedhq/kotskinds v0.0.0-20240617103853-2058b19a0c7c + github.com/replicatedhq/kotskinds v0.0.0-20240621084729-1eb1e3eac6f2 github.com/replicatedhq/kurlkinds v1.5.0 github.com/replicatedhq/troubleshoot v0.92.2 github.com/replicatedhq/yaml/v3 v3.0.0-beta5-replicatedhq diff --git a/go.sum b/go.sum index 245753f565..95f20d64b1 100644 --- a/go.sum +++ b/go.sum @@ -1310,8 +1310,8 @@ github.com/redis/go-redis/v9 v9.1.0/go.mod h1:urWj3He21Dj5k4TK1y59xH8Uj6ATueP8AH github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= github.com/replicatedhq/embedded-cluster-kinds v1.3.10 h1:nANfyym6NGwkdY9jVhRR4zClQT2YBskIjs60g+VfFfs= github.com/replicatedhq/embedded-cluster-kinds v1.3.10/go.mod h1:AwopUvvGcaWO4mn9DkbPj5RnLuOy756CNLrcaAlmjMo= -github.com/replicatedhq/kotskinds v0.0.0-20240617103853-2058b19a0c7c h1:CwPf225IhH7JAMQgwa9F5XYoaB6c21s4hla6jVCyAoc= -github.com/replicatedhq/kotskinds v0.0.0-20240617103853-2058b19a0c7c/go.mod h1:QjhIUu3+OmHZ09u09j3FCoTt8F3BYtQglS+OLmftu9I= +github.com/replicatedhq/kotskinds v0.0.0-20240621084729-1eb1e3eac6f2 h1:xL4u2RHhMaGDgz7Lol5MhVYLnWahV3sCJZbfebpPao0= +github.com/replicatedhq/kotskinds v0.0.0-20240621084729-1eb1e3eac6f2/go.mod h1:QjhIUu3+OmHZ09u09j3FCoTt8F3BYtQglS+OLmftu9I= github.com/replicatedhq/kurlkinds v1.5.0 h1:zZ0PKNeh4kXvSzVGkn62DKTo314GxhXg1TSB3azURMc= github.com/replicatedhq/kurlkinds v1.5.0/go.mod h1:rUpBMdC81IhmJNCWMU/uRsMETv9P0xFoMvdSP/TAr5A= github.com/replicatedhq/termui/v3 v3.1.1-0.20200811145416-f40076d26851 h1:eRlNDHxGfVkPCRXbA4BfQJvt5DHjFiTtWy3R/t4djyY= diff --git a/pkg/image/airgap.go b/pkg/image/airgap.go index 2a5b399ed7..f546e612ce 100644 --- a/pkg/image/airgap.go +++ b/pkg/image/airgap.go @@ -241,7 +241,6 @@ func PushECImagesFromTempRegistry(airgapRootDir string, airgap *kotsv1beta1.Airg defer wc.Close() } - totalImages := len(imageInfos) var imageCounter int for imageID, imageInfo := range imageInfos { srcRef, err := tempRegistry.SrcRef(imageID) @@ -288,7 +287,10 @@ func PushECImagesFromTempRegistry(airgapRootDir string, airgap *kotsv1beta1.Airg }, } imageCounter++ - fmt.Printf("Pushing embedded cluster images (%d/%d)\n", imageCounter, totalImages) + fmt.Printf( + "Pushing embedded cluster artifacts (%d/%d)\n", + imageCounter, airgap.Spec.EmbeddedClusterArtifacts.Total(), + ) if err := pushImage(pushImageOpts); err != nil { return errors.Wrapf(err, "failed to push image %s", imageID) } @@ -854,6 +856,11 @@ func PushEmbeddedClusterArtifacts(airgapBundle string, artifactsToPush *kotsv1be artifacts = append(artifacts, dstFilePath) } + var alreadyPushedArtifacts int + if artifactsToPush != nil { + alreadyPushedArtifacts = len(artifactsToPush.Registry.SavedImages) + } + for i, dstFilePath := range artifacts { ociArtifactPath := imageutil.NewEmbeddedClusterOCIArtifactPath(dstFilePath, imageutil.EmbeddedClusterArtifactOCIPathOptions{ RegistryHost: opts.Registry.Endpoint, @@ -878,7 +885,8 @@ func PushEmbeddedClusterArtifacts(airgapBundle string, artifactsToPush *kotsv1be HTTPClient: opts.HTTPClient, } - fmt.Printf("Pushing embedded cluster artifacts (%d/%d)\n", i+1, len(artifacts)) + currentArtifact := i + 1 + alreadyPushedArtifacts + fmt.Printf("Pushing embedded cluster artifacts (%d/%d)\n", currentArtifact, artifactsToPush.Total()) if err := pushOCIArtifact(pushOCIArtifactOpts); err != nil { return errors.Wrapf(err, "failed to push oci artifact %s", ociArtifactPath.Name) }