From bd9b56914fdc676a30a754fe64bf9a7a50e53585 Mon Sep 17 00:00:00 2001 From: Abiola Ibrahim Date: Wed, 30 Oct 2024 04:54:45 +0100 Subject: [PATCH 1/6] core: update disk images Signed-off-by: Abiola Ibrahim --- embedded/images/images.txt | 16 ++++++++-------- embedded/images/images_sha.sh | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/embedded/images/images.txt b/embedded/images/images.txt index 827cd7f5..fe91b474 100644 --- a/embedded/images/images.txt +++ b/embedded/images/images.txt @@ -1,8 +1,8 @@ -arm64 none https://github.com/abiosoft/colima-core/releases/download/v0.7.6/ubuntu-24.04-minimal-cloudimg-arm64-none.qcow2 7e63afa385d4e4fd760e35367c61c521efaedf930ac93830e68beb635c2691d266495052d99fc76c56c8c5134a3c31c26b20797b6d6d96f426628aa191543ad3 ubuntu-24.04-minimal-cloudimg-arm64-none.qcow2 -arm64 docker https://github.com/abiosoft/colima-core/releases/download/v0.7.6/ubuntu-24.04-minimal-cloudimg-arm64-docker.qcow2 c6d253678b449a6c17b44ca2dfa73ca9f3375c2d8c8f125bf32c74e0aaaa0534eb67c8c0d2bf5744344135b774359e96a6d058915d09b7b929a231c2bd31f038 ubuntu-24.04-minimal-cloudimg-arm64-docker.qcow2 -arm64 containerd https://github.com/abiosoft/colima-core/releases/download/v0.7.6/ubuntu-24.04-minimal-cloudimg-arm64-containerd.qcow2 c731467c1cf2a6c84c1608005353c6e9f851e1c7985e99b4b112aed39be81226924f8af90e875ac3228397d4597136c585fc669e336785e9749824f1fc2acb48 ubuntu-24.04-minimal-cloudimg-arm64-containerd.qcow2 -arm64 incus https://github.com/abiosoft/colima-core/releases/download/v0.7.6/ubuntu-24.04-minimal-cloudimg-arm64-incus.qcow2 dbd583b3385e3506aa161e17f3a368f4b5190365d9b73264ecbf09f285b38540ae8d52510159b037eb14bc83527a57d88eac53e88ecb7cc565cbef39928e5590 ubuntu-24.04-minimal-cloudimg-arm64-incus.qcow2 -amd64 none https://github.com/abiosoft/colima-core/releases/download/v0.7.6/ubuntu-24.04-minimal-cloudimg-amd64-none.qcow2 a8cf07d803c2d89e120dffec9284a5ca079c4d3c7a7c9f5e80247d02685658d4ad804ef29e1cfa598c914cb966b96e7f4d7d9be94a2dca32018928b5516c906a ubuntu-24.04-minimal-cloudimg-amd64-none.qcow2 -amd64 docker https://github.com/abiosoft/colima-core/releases/download/v0.7.6/ubuntu-24.04-minimal-cloudimg-amd64-docker.qcow2 50ed3755f16d2f709a4b18e1ddb2dbbe798570777c602b1103220783396362c6f6b0160f18336e27038628b1223ae59066d788b883e1b153053a01a9b42fe5f0 ubuntu-24.04-minimal-cloudimg-amd64-docker.qcow2 -amd64 containerd https://github.com/abiosoft/colima-core/releases/download/v0.7.6/ubuntu-24.04-minimal-cloudimg-amd64-containerd.qcow2 b601ab51da7bd1a63d7d4926674105eab890ea36880c55c3f9795422734d206263d99c01242c8e61ad3e845ae673cfd7a968ea17007c596974b0b552513cdb16 ubuntu-24.04-minimal-cloudimg-amd64-containerd.qcow2 -amd64 incus https://github.com/abiosoft/colima-core/releases/download/v0.7.6/ubuntu-24.04-minimal-cloudimg-amd64-incus.qcow2 7c8c6b5c14dc43c51c85fdcdfe5740c23051ea5c94643c7aacce704c708ec38c5247cc7c6dff216d1d928c4abfec6fd3eaae141ed35d31417145c42ea57894f5 ubuntu-24.04-minimal-cloudimg-amd64-incus.qcow2 +arm64 none https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-arm64-none.qcow2 837236b93ef520ee63f559a893b212df93ba42098d2f7b384fcdc4d7f38b28701498023cac23d2197dd3ae4eb5c7104e7506cae3679d25e055c2127d8f1aece4 ubuntu-24.04-minimal-cloudimg-arm64-none.qcow2 +arm64 docker https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-arm64-docker.qcow2 3a4e66446d953b5ab612c4ef8c2d7ca9d07c180216c436a4afe15cdcd94e0736de48e4779ce85f9190f22fa918719259710971dbb215c73d15addb6bf23b280c ubuntu-24.04-minimal-cloudimg-arm64-docker.qcow2 +arm64 containerd https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-arm64-containerd.qcow2 6946bcc5829d5373cc6ce7777c618ee22dce27e4a57a1d7502b0e9053ad95bbe901065f60e487ded5d386f9cd8bc333fc91201958c0a5d0cf8a42741cf73ef77 ubuntu-24.04-minimal-cloudimg-arm64-containerd.qcow2 +arm64 incus https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-arm64-incus.qcow2 2f0ba625799ddddd6d2112ed7a4c6d21c5d1d847af104a9ad723a7dba1ee5e04819c2a8c60b84549df96a01bc006a2b97c4dd3fd283de476ecfc16b394b8b1d8 ubuntu-24.04-minimal-cloudimg-arm64-incus.qcow2 +amd64 none https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-amd64-none.qcow2 14075a7def430ef2632a93974b2cd8f7ba9e40cf96074d09b254ab9d4480c8be870922970ae72f236f0b14f5282a89d46d95b8eab89d8bef16d9b1d8d216a0d6 ubuntu-24.04-minimal-cloudimg-amd64-none.qcow2 +amd64 docker https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-amd64-docker.qcow2 1e128da890e9d8b07a3c2556fe200ce3c724108d099eacce311b520507f6e2d114430991d1b68ecf9ad66a915eb315f433a950bdff09450224c34d9529b88890 ubuntu-24.04-minimal-cloudimg-amd64-docker.qcow2 +amd64 containerd https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-amd64-containerd.qcow2 a3f2ed75afc52fbf769215ef2b87a5f75ef2ac96bf620c566c93305e5d3aca32a1be38ebf511b6edd9e15a96dc987d7c71e4c482d64f21134e335cad6da3c148 ubuntu-24.04-minimal-cloudimg-amd64-containerd.qcow2 +amd64 incus https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-amd64-incus.qcow2 9e04ab8d61559267010dc6f5315020abbaf14bd4cee91a2021ad30178255cfa85a962c0ffeb8759afedbe88ba8cac90963cfa3756d56974c5db2e21eb21e0700 ubuntu-24.04-minimal-cloudimg-amd64-incus.qcow2 diff --git a/embedded/images/images_sha.sh b/embedded/images/images_sha.sh index 0dfb28ff..01bf13a7 100644 --- a/embedded/images/images_sha.sh +++ b/embedded/images/images_sha.sh @@ -4,7 +4,7 @@ set -eux BASE_URL=https://github.com/abiosoft/colima-core/releases/download BASE_FILENAME=ubuntu-24.04-minimal-cloudimg -VERSION=v0.7.6 +VERSION=v0.7.6-1 RUNTIMES="none docker containerd incus" ARCHS="arm64 amd64" From 60fce42c958ab8d37578a3532f53ea3ee8c7b143 Mon Sep 17 00:00:00 2001 From: Abiola Ibrahim Date: Wed, 30 Oct 2024 05:34:37 +0100 Subject: [PATCH 2/6] cli: improve output of update command Signed-off-by: Abiola Ibrahim --- app/app.go | 18 +++++++++++++++++- environment/container.go | 2 +- environment/container/containerd/containerd.go | 4 ++-- environment/container/docker/docker.go | 4 ++-- environment/container/incus/incus.go | 4 ++-- environment/container/kubernetes/kubernetes.go | 5 ++--- util/debutil/debutil.go | 17 ++++++++++------- 7 files changed, 36 insertions(+), 18 deletions(-) diff --git a/app/app.go b/app/app.go index 1d42b5f0..aa785a16 100644 --- a/app/app.go +++ b/app/app.go @@ -471,7 +471,23 @@ func (c *colimaApp) Update() error { return err } - return container.Update(ctx) + oldVersion := container.Version(ctx) + + updated, err := container.Update(ctx) + if err != nil { + return err + } + + if updated { + fmt.Println() + fmt.Println("Previous") + fmt.Println(oldVersion) + fmt.Println() + fmt.Println("Current") + fmt.Println(container.Version(ctx)) + } + + return nil } func generateSSHConfig(modifySSHConfig bool) error { diff --git a/environment/container.go b/environment/container.go index 24151ced..5b2a245c 100644 --- a/environment/container.go +++ b/environment/container.go @@ -23,7 +23,7 @@ type Container interface { // Teardown tears down/uninstall the container runtime. Teardown(ctx context.Context) error // Update the container runtime. - Update(ctx context.Context) error + Update(ctx context.Context) (bool, error) // Version returns the container runtime version. Version(ctx context.Context) string // Running returns if the container runtime is currently running. diff --git a/environment/container/containerd/containerd.go b/environment/container/containerd/containerd.go index 0129777c..f5c7db11 100644 --- a/environment/container/containerd/containerd.go +++ b/environment/container/containerd/containerd.go @@ -103,6 +103,6 @@ func (c containerdRuntime) Version(ctx context.Context) string { return version } -func (c *containerdRuntime) Update(ctx context.Context) error { - return fmt.Errorf("update not supported for the %s runtime", Name) +func (c *containerdRuntime) Update(ctx context.Context) (bool, error) { + return false, fmt.Errorf("update not supported for the %s runtime", Name) } diff --git a/environment/container/docker/docker.go b/environment/container/docker/docker.go index 9dd7fcb6..70127486 100644 --- a/environment/container/docker/docker.go +++ b/environment/container/docker/docker.go @@ -135,12 +135,12 @@ func (d dockerRuntime) Version(ctx context.Context) string { return version } -func (d *dockerRuntime) Update(ctx context.Context) error { +func (d *dockerRuntime) Update(ctx context.Context) (bool, error) { packages := []string{ "docker-ce", "docker-ce-cli", "containerd.io", } - return debutil.UpdateRuntime(ctx, d.guest, d, Name, packages...) + return debutil.UpdateRuntime(ctx, d.guest, d, packages...) } diff --git a/environment/container/incus/incus.go b/environment/container/incus/incus.go index 6c95dbe6..01ecd7b9 100644 --- a/environment/container/incus/incus.go +++ b/environment/container/incus/incus.go @@ -280,7 +280,7 @@ type networkInfo struct { Type string `json:"type"` } -func (c *incusRuntime) Update(ctx context.Context) error { +func (c *incusRuntime) Update(ctx context.Context) (bool, error) { packages := []string{ "incus", "incus-base", @@ -289,5 +289,5 @@ func (c *incusRuntime) Update(ctx context.Context) error { "incus-ui-canonical", } - return debutil.UpdateRuntime(ctx, c.guest, c, Name, packages...) + return debutil.UpdateRuntime(ctx, c.guest, c, packages...) } diff --git a/environment/container/kubernetes/kubernetes.go b/environment/container/kubernetes/kubernetes.go index ed44de16..d32502b3 100644 --- a/environment/container/kubernetes/kubernetes.go +++ b/environment/container/kubernetes/kubernetes.go @@ -264,7 +264,6 @@ func (c kubernetesRuntime) Version(context.Context) string { return version } -func (c *kubernetesRuntime) Update(ctx context.Context) error { - // update not supported - return nil +func (c *kubernetesRuntime) Update(ctx context.Context) (bool, error) { + return false, fmt.Errorf("update not supported for the %s runtime", Name) } diff --git a/util/debutil/debutil.go b/util/debutil/debutil.go index 3e14d24e..462a2e88 100644 --- a/util/debutil/debutil.go +++ b/util/debutil/debutil.go @@ -32,15 +32,15 @@ func UpdateRuntime( ctx context.Context, guest environment.GuestActions, chain cli.CommandChain, - runtime string, packageNames ...string, -) error { +) (bool, error) { a := chain.Init(ctx) log := a.Logger() packages := packages(packageNames) - updatesAvailable := false + hasUpdates := false + updated := false a.Stage("refreshing package manager") a.Add(func() error { @@ -58,13 +58,13 @@ func UpdateRuntime( "-c", packages.Upgradable(), ) - updatesAvailable = err == nil + hasUpdates = err == nil return nil }) a.Add(func() (err error) { - if !updatesAvailable { - log.Warnf("no updates available for %s runtime", runtime) + if !hasUpdates { + log.Warnln("no updates available") return } @@ -75,10 +75,13 @@ func UpdateRuntime( packages.Install(), ) if err == nil { + updated = true log.Println("done") } return }) - return a.Exec() + // it is necessary to execute the chain here to get the correct value for `updated`. + err := a.Exec() + return updated, err } From c534ae4d1ef7ba3ef7c552531f6e6963e816aed2 Mon Sep 17 00:00:00 2001 From: Abiola Ibrahim Date: Wed, 30 Oct 2024 06:55:23 +0100 Subject: [PATCH 3/6] docker: fix version output for multiple contexts Signed-off-by: Abiola Ibrahim --- environment/container/docker/docker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment/container/docker/docker.go b/environment/container/docker/docker.go index 70127486..4ca8844a 100644 --- a/environment/container/docker/docker.go +++ b/environment/container/docker/docker.go @@ -131,7 +131,7 @@ func (d dockerRuntime) Dependencies() []string { } func (d dockerRuntime) Version(ctx context.Context) string { - version, _ := d.host.RunOutput("docker", "version", "--format", `client: v{{.Client.Version}}{{printf "\n"}}server: v{{.Server.Version}}`) + version, _ := d.host.RunOutput("docker", "--context", config.CurrentProfile().ID, "version", "--format", `client: v{{.Client.Version}}{{printf "\n"}}server: v{{.Server.Version}}`) return version } From 1896dabd183f8b171d4890621d46e6b4e289d234 Mon Sep 17 00:00:00 2001 From: Abiola Ibrahim Date: Wed, 30 Oct 2024 06:55:51 +0100 Subject: [PATCH 4/6] incus: fix version output for multiple remotes Signed-off-by: Abiola Ibrahim --- environment/container/incus/incus.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment/container/incus/incus.go b/environment/container/incus/incus.go index 01ecd7b9..9174479c 100644 --- a/environment/container/incus/incus.go +++ b/environment/container/incus/incus.go @@ -152,7 +152,7 @@ func (c *incusRuntime) Teardown(ctx context.Context) error { // Version implements environment.Container. func (c *incusRuntime) Version(ctx context.Context) string { - version, _ := c.guest.RunOutput("incus", "version") + version, _ := c.host.RunOutput("incus", "version", config.CurrentProfile().ID+":") return version } From 9fd701d86a16737a3210abecce1b9a09732b2518 Mon Sep 17 00:00:00 2001 From: Abiola Ibrahim Date: Wed, 30 Oct 2024 09:25:52 +0100 Subject: [PATCH 5/6] cli: improve error message for update command Signed-off-by: Abiola Ibrahim --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index aa785a16..289f6c0d 100644 --- a/app/app.go +++ b/app/app.go @@ -458,7 +458,7 @@ func (c colimaApp) Active() bool { func (c *colimaApp) Update() error { ctx := context.Background() if !c.guest.Running(ctx) { - return fmt.Errorf("%s is not running", config.CurrentProfile().DisplayName) + return fmt.Errorf("runtime cannot be updated, %s is not running", config.CurrentProfile().DisplayName) } runtime, err := c.currentRuntime(ctx) From 23ef852f5f28a5d18ced2411b9a9ce9d6fd7db39 Mon Sep 17 00:00:00 2001 From: Abiola Ibrahim Date: Wed, 30 Oct 2024 09:40:54 +0100 Subject: [PATCH 6/6] k3s: update version Signed-off-by: Abiola Ibrahim --- embedded/defaults/colima.yaml | 2 +- environment/container/kubernetes/kubernetes.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/embedded/defaults/colima.yaml b/embedded/defaults/colima.yaml index 3349b518..4b9db906 100644 --- a/embedded/defaults/colima.yaml +++ b/embedded/defaults/colima.yaml @@ -38,7 +38,7 @@ kubernetes: # Kubernetes version to use. # This needs to exactly match a k3s version https://github.com/k3s-io/k3s/releases # Default: latest stable release - version: v1.30.2+k3s1 + version: v1.31.2+k3s1 # Additional args to pass to k3s https://docs.k3s.io/cli/server # Default: traefik is disabled diff --git a/environment/container/kubernetes/kubernetes.go b/environment/container/kubernetes/kubernetes.go index d32502b3..6baa27e3 100644 --- a/environment/container/kubernetes/kubernetes.go +++ b/environment/container/kubernetes/kubernetes.go @@ -18,7 +18,7 @@ import ( const ( Name = "kubernetes" - DefaultVersion = "v1.30.2+k3s1" + DefaultVersion = "v1.31.2+k3s1" ConfigKey = "kubernetes_config" )