Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package arkade for openSUSE:Factory checked in at 2025-10-23 18:31:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/arkade (Old) and /work/SRC/openSUSE:Factory/.arkade.new.1980 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "arkade" Thu Oct 23 18:31:38 2025 rev:58 rq:1313214 version:0.11.52 Changes: -------- --- /work/SRC/openSUSE:Factory/arkade/arkade.changes 2025-10-18 14:38:05.727123491 +0200 +++ /work/SRC/openSUSE:Factory/.arkade.new.1980/arkade.changes 2025-10-23 18:31:54.084232322 +0200 @@ -1,0 +2,6 @@ +Thu Oct 23 12:35:57 UTC 2025 - Johannes Kastl <[email protected]> + +- Update to version 0.11.52: + * Add actuated registry template to system install app + +------------------------------------------------------------------- Old: ---- arkade-0.11.51.obscpio New: ---- arkade-0.11.52.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ arkade.spec ++++++ --- /var/tmp/diff_new_pack.XfCuH8/_old 2025-10-23 18:31:54.740260369 +0200 +++ /var/tmp/diff_new_pack.XfCuH8/_new 2025-10-23 18:31:54.744260541 +0200 @@ -17,7 +17,7 @@ Name: arkade -Version: 0.11.51 +Version: 0.11.52 Release: 0 Summary: Open Source Kubernetes Marketplace License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.XfCuH8/_old 2025-10-23 18:31:54.788262422 +0200 +++ /var/tmp/diff_new_pack.XfCuH8/_new 2025-10-23 18:31:54.796262764 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/alexellis/arkade</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">0.11.51</param> + <param name="revision">0.11.52</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.XfCuH8/_old 2025-10-23 18:31:54.832264303 +0200 +++ /var/tmp/diff_new_pack.XfCuH8/_new 2025-10-23 18:31:54.836264474 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/alexellis/arkade</param> - <param name="changesrevision">6df799d60833803dd6718ea66d32c17fe2890b5a</param></service></servicedata> + <param name="changesrevision">6c49e0164b22b14d844369eab5bd780521b028e8</param></service></servicedata> (No newline at EOF) ++++++ arkade-0.11.51.obscpio -> arkade-0.11.52.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arkade-0.11.51/cmd/system/registry.go new/arkade-0.11.52/cmd/system/registry.go --- old/arkade-0.11.51/cmd/system/registry.go 2025-10-17 09:35:44.000000000 +0200 +++ new/arkade-0.11.52/cmd/system/registry.go 2025-10-23 12:55:55.000000000 +0200 @@ -1,13 +1,17 @@ package system import ( + "context" "fmt" "os" + "path/filepath" "strings" + "text/template" "github.com/alexellis/arkade/pkg/archive" "github.com/alexellis/arkade/pkg/env" "github.com/alexellis/arkade/pkg/get" + execute "github.com/alexellis/go-execute/v2" "github.com/spf13/cobra" ) @@ -23,7 +27,15 @@ cmd.Flags().StringP("version", "v", "", "Version of the registry binary pack, leave blank for latest") cmd.Flags().String("path", "/usr/local/bin", "Install path, where the distribution binaries will installed") cmd.Flags().Bool("progress", true, "Show download progress") + cmd.Flags().Bool("overwrite", false, "Overwrite existing binary if found") cmd.Flags().String("arch", "", "CPU architecture i.e. amd64") + cmd.Flags().String("type", "", "Type of registry - '' means binary only. 'mirror' creates a pull through cache.") + cmd.Flags().String("docker-password", "", "Password for Docker Hub registry authentication (only for 'mirror' type)") + cmd.Flags().String("docker-password-file", "", "Path to a file containing access token for registry authentication (only for 'mirror' type)") + cmd.Flags().String("docker-username", "", "Username for registry authentication (only for 'mirror' type)") + cmd.Flags().String("bind-addr", "0.0.0.0", "Bind address for the registry server (only for 'mirror' type)") + cmd.Flags().String("storage", "/var/lib/registry", "Path to registry storage (only for 'mirror' type)") + cmd.Flags().String("tls", "", "Give \"actuated\" or leave empty.") cmd.PreRunE = func(cmd *cobra.Command, args []string) error { _, err := cmd.Flags().GetString("path") @@ -44,6 +56,9 @@ version, _ := cmd.Flags().GetString("version") progress, _ := cmd.Flags().GetBool("progress") + installType, _ := cmd.Flags().GetString("type") + overwrite, _ := cmd.Flags().GetBool("overwrite") + arch, osVer := env.GetClientArch() if cmd.Flags().Changed("arch") { archFlag, _ := cmd.Flags().GetString("arch") @@ -51,6 +66,7 @@ } toolName := "registry" + fmt.Printf("Installing %s to %s\n", toolName, installPath) if strings.ToLower(osVer) != "linux" { @@ -100,38 +116,214 @@ return err } - outPath, err := get.DownloadFileP(url, progress) - if err != nil { - return err - } - defer os.Remove(outPath) - fmt.Printf("Downloaded to: %s\n", outPath) + if _, err := os.Stat(filepath.Join(installPath, toolName)); os.IsNotExist(err) || overwrite { + outPath, err := get.DownloadFileP(url, progress) + if err != nil { + return err + } + defer os.Remove(outPath) + fmt.Printf("Downloaded to: %s\n", outPath) - f, err := os.OpenFile(outPath, os.O_RDONLY, 0644) - if err != nil { - return err - } - defer f.Close() + f, err := os.OpenFile(outPath, os.O_RDONLY, 0644) + if err != nil { + return err + } - tempDirName := fmt.Sprintf("%s/%s", os.TempDir(), toolName) - defer os.RemoveAll(tempDirName) - if err := archive.UntarNested(f, tempDirName, true, false); err != nil { - return err + defer f.Close() + + tempDirName := fmt.Sprintf("%s/%s", os.TempDir(), toolName) + defer os.RemoveAll(tempDirName) + if err := archive.UntarNested(f, tempDirName, true, false); err != nil { + return err + } + + fmt.Printf("Copying %s binary to: %s\n", toolName, installPath) + + if err := os.MkdirAll(installPath, 0755); err != nil && !os.IsExist(err) { + fmt.Printf("Error creating directory %s, error: %s\n", installPath, err.Error()) + } + + if _, err := get.CopyFile(fmt.Sprintf("%s/%s", tempDirName, toolName), fmt.Sprintf("%s/%s", installPath, toolName)); err != nil { + if strings.Contains(err.Error(), "text file busy") { + return fmt.Errorf("stop any running \"%s\" processes, error: %w", toolName, err) + } + return err + } + } else { + fmt.Printf("%s already exists in %s, skipping download and install.\n", toolName, installPath) } - fmt.Printf("Copying %s binary to: %s\n", toolName, installPath) + if installType == "mirror" { + accessToken, _ := cmd.Flags().GetString("access-token") + accessTokenFile, _ := cmd.Flags().GetString("access-token-file") + bindAddr, _ := cmd.Flags().GetString("bind-addr") + storage, _ := cmd.Flags().GetString("storage") + username, _ := cmd.Flags().GetString("username") + tls, _ := cmd.Flags().GetString("tls") - if err := os.MkdirAll(installPath, 0755); err != nil && !os.IsExist(err) { - fmt.Printf("Error creating directory %s, error: %s\n", installPath, err.Error()) + fmt.Printf("Setting up registry mirror service\n") + if err := setupRegistryMirrorService(installPath, accessToken, accessTokenFile, bindAddr, storage, username, tls); err != nil { + return err + } + fmt.Printf(`View logs: + + sudo journalctl -u registry-mirror.service -f +`) } - _, err = get.CopyFile(fmt.Sprintf("%s/%s", tempDirName, toolName), fmt.Sprintf("%s/%s", installPath, toolName)) + return nil + } + + return cmd +} + +func setupRegistryMirrorService(installPath, accessToken, accessTokenFile, bindAddr, storagePath, username, tls string) error { + + registryEtc := "/etc/registry" + os.MkdirAll(registryEtc, 0755) + os.MkdirAll(storagePath, 0755) + + cfg := template.New("registry-config") + tmpl, err := cfg.Parse(configTmp) + if err != nil { + return err + } + + token := accessToken + if accessTokenFile != "" { + data, err := os.ReadFile(accessTokenFile) if err != nil { return err } + token = strings.TrimSpace(string(data)) + } - return nil + if len(token) > 0 && len(username) == 0 { + return fmt.Errorf("username must be provided when access token is set") } - return cmd + bindAddr, port, found := strings.Cut(bindAddr, ":") // remove port if present + if !found { + port = "5000" + } + + bindAddr = fmt.Sprintf("%s:%s", strings.TrimRight(bindAddr, ":"), port) + + buf := &strings.Builder{} + if err := tmpl.Execute(buf, map[string]string{ + "USERNAME": username, + "TOKEN": token, + "BRIDGE": bindAddr, + "TLS": tls, + "REMOTE_URL": "https://registry-1.docker.io", + }); err != nil { + return err + } + + if err := os.WriteFile(fmt.Sprintf("%s/config.yml", registryEtc), []byte(buf.String()), 0644); err != nil { + return err + } + + fmt.Printf("Wrote: %s\n", fmt.Sprintf("%s/config.yml", registryEtc)) + + reg := template.New("registry-service") + svcTmpl, err := reg.Parse(registrySvcTmpl) + if err != nil { + return err + } + + svcBuf := &strings.Builder{} + if err := svcTmpl.Execute(svcBuf, map[string]string{ + "ConfigPath": fmt.Sprintf("%s/config.yml", registryEtc), + "TLS": tls, + }); err != nil { + return err + } + + servicePath := "/etc/systemd/system/registry-mirror.service" + if err := os.WriteFile(servicePath, []byte(svcBuf.String()), 0644); err != nil { + return err + } + + fmt.Printf("Wrote: %s\n", servicePath) + + fmt.Printf("Starting \"registry-mirror\" service\n") + taskReload := execute.ExecTask{ + Command: "systemctl", + Args: []string{"daemon-reload"}, + StreamStdio: false, + } + if _, err := taskReload.Execute(context.Background()); err != nil { + return err + } + + taskEnable := execute.ExecTask{ + Command: "systemctl", + Args: []string{"enable", "registry-mirror.service", "--now"}, + StreamStdio: true, + } + if _, err := taskEnable.Execute(context.Background()); err != nil { + return err + } + + viewLogLines := 10 + viewLogs := execute.ExecTask{ + Command: "journalctl", + Args: []string{"-u", "registry-mirror.service", "--lines", fmt.Sprintf("%d", viewLogLines)}, + StreamStdio: true, + } + if _, err := viewLogs.Execute(context.Background()); err != nil { + return err + } + + return nil + } + +var configTmp = `version: 0.1 +log: + accesslog: + disabled: true + level: warn + formatter: text + +storage: + filesystem: + rootdirectory: /var/lib/registry + +proxy: + remoteurl: {{ .REMOTE_URL }} +{{- if ne .USERNAME "" }} + username: {{ .USERNAME }} + + # A Docker Hub Personal Access token created with "Public repos only" scope + password: {{ .TOKEN }} +{{- end }} + +http: + addr: {{ .BRIDGE }} + relativeurls: false + draintimeout: 60s + +{{- if eq .TLS "actuated" }} + # Enable self-signed TLS from the TLS certificate and key + # managed by actuated for server <> microVM communication + tls: + certificate: /var/lib/actuated/certs/server.crt + key: /var/lib/actuated/certs/server.key +{{- end }} +` + +var registrySvcTmpl = `[Unit] +Description=Registry +After=network.target {{ if eq .TLS "actuated" }}actuated.service{{ end }} + +[Service] +Type=simple +Restart=always +RestartSec=5s +ExecStart=/usr/local/bin/registry serve {{.ConfigPath}} + +[Install] +WantedBy=multi-user.target +` ++++++ arkade.obsinfo ++++++ --- /var/tmp/diff_new_pack.XfCuH8/_old 2025-10-23 18:31:56.380330487 +0200 +++ /var/tmp/diff_new_pack.XfCuH8/_new 2025-10-23 18:31:56.388330830 +0200 @@ -1,5 +1,5 @@ name: arkade -version: 0.11.51 -mtime: 1760686544 -commit: 6df799d60833803dd6718ea66d32c17fe2890b5a +version: 0.11.52 +mtime: 1761216955 +commit: 6c49e0164b22b14d844369eab5bd780521b028e8 ++++++ vendor.tar.gz ++++++
