From 87e5ba064c041c4b2557b35300ecd353d1fd8f2d Mon Sep 17 00:00:00 2001 From: yy Date: Thu, 31 Oct 2024 17:09:31 +0800 Subject: [PATCH] add SEALOS_DEVBOX_INIT env. --- controllers/devbox/internal/controller/helper/devbox.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/controllers/devbox/internal/controller/helper/devbox.go b/controllers/devbox/internal/controller/helper/devbox.go index eb969bc56f0..93989a9bd67 100644 --- a/controllers/devbox/internal/controller/helper/devbox.go +++ b/controllers/devbox/internal/controller/helper/devbox.go @@ -284,6 +284,11 @@ func GenerateDevboxEnvVars(devbox *devboxv1alpha1.Devbox, nextCommitHistory *dev } } + initialized := false + if GetLastSuccessCommitHistory(devbox) != nil { + initialized = true + } + return []corev1.EnvVar{ { Name: "SEALOS_COMMIT_ON_STOP", @@ -293,6 +298,10 @@ func GenerateDevboxEnvVars(devbox *devboxv1alpha1.Devbox, nextCommitHistory *dev Name: "SEALOS_COMMIT_IMAGE_NAME", Value: nextCommitHistory.Image, }, + { + Name: "SEALOS_DEVBOX_INIT", + Value: fmt.Sprintf("%v", initialized), + }, { Name: "SEALOS_COMMIT_IMAGE_SQUASH", Value: fmt.Sprintf("%v", doSquash),