In Docker, Settings › About on the Daily channel said "0.1.4479 is out … docker pull ghcr.io/yetone/magpie:latest". :latest is the newest release (docker.yml), daily and stable the Daily and Stable channels' (docker-daily.yml, docker-stable.yml), so :latest held 0.1.4504, not the 0.1.4479 announced; on Stable it is weeks apart. docker.yml writes every release's own tag (ghcr.io/yetone/magpie:0.1.4479; checked on ghcr: 4479, 4395, latest, daily, stable, 0.1 all resolve, daily = 4479's digest). update.Image(version) is that tag, and every place that printed the command names it now, with "recreate the container from it" (a compose file on :latest would otherwise run the old tag again): - the GUI's Version row and Update pill (/api/update's new `image`, stuck "container"; app.js updateStuck); - `magpie update` in a container (internal/cli); - a Remote magpie row's tip for a container: UpdateRemotes now keeps the version it asked for on an "unsupported" answer too, so the tip names that version's image; - i18n zh, zh-TW, ja, de for both strings; - docs/docker (en, zh, ja): Updates says Settings › About names the version's own image and that latest may be ahead of the channel; llms-full and search indexes rebuilt (site/docs-index.mjs). Run at this tree (mica, through mica-run): - red on origin/main14b6b9555with the new tests copied in: TestUpdateInContainerSaysPullTheImage (cli: ":latest" in the error), TestRemoteMagpieAskedToFollow (gateway: Version v0.1.100, not the asked v0.1.200), update-stuck.test.cjs container cases and remote-update.test.cjs, both engines; - green here: go test ./internal/update ./internal/cli, internal/gateway and internal/provider -run TestRemote*, internal/gui except TestGatewayModeListsNoOwnSessions, which fails the same on14b6b9555alone (#7064); - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build, gofmt -l (nothing); - node --test site/docker-tags.test.mjs; GUI files in chromium and webkit: update-stuck, remote-update, update-channel, update-stable-newest, update-release-page, update-check, lan-docker, i18n-keys, gui-de, gui-zh-tw, i18n-en-no-cjk (216 pass, 0 fail); gui-ja's "ja has every zh string" is red on main for another string (#7144). Not run before the push: the full `go test -tags nogui ./...` (mote and mica each had another session's full suite running); it runs after. Not tried: a real container pulling the new tag. Not checked at runtime: whether the version's image is already on ghcr; docker.yml pushes it in ~6 minutes, before the release is published, and a missing one makes docker pull fail with "manifest unknown", not pull another version.
58 lines
1.9 KiB
Go
58 lines
1.9 KiB
Go
package gui
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
"testing"
|
|
|
|
"github.com/yetone/magpie/internal/update"
|
|
)
|
|
|
|
// The Docker image runs /magpie as nonroot, in a folder it may not write
|
|
// to and with no password prompt, so the page said "move it to a folder you
|
|
// can write to" (/), which a container can't act on. In a container it says
|
|
// to pull the new image, by the version's own tag: on the Daily channel
|
|
// :latest held another release than the one out (fishmagic80 on X).
|
|
// Outside one the folder is still named (#1277).
|
|
func TestUpdateInContainerSaysPullTheImage(t *testing.T) {
|
|
if runtime.GOOS == "windows" || os.Geteuid() == 0 {
|
|
t.Skip("needs a folder this user may not write to")
|
|
}
|
|
dir := t.TempDir()
|
|
exe := filepath.Join(dir, "magpie")
|
|
if err := os.WriteFile(exe, []byte("magpie"), 0o755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := os.Chmod(dir, 0o555); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer os.Chmod(dir, 0o755)
|
|
wasE, wasC := canElevate, inContainer
|
|
t.Cleanup(func() { canElevate, inContainer = wasE, wasC })
|
|
canElevate = func() bool { return false }
|
|
|
|
inContainer = func() bool { return true }
|
|
u := &updater{state: "available", latest: &update.Release{Version: "0.1.4479"}, channel: "daily"}
|
|
u.placeExe(exe)
|
|
if j := u.json(); u.exe != "" || j.Stuck != "container" || j.StuckDir != "" || j.Image != "ghcr.io/yetone/magpie:0.1.4479" {
|
|
t.Fatalf("in a container: exe %q, %+v", u.exe, j)
|
|
}
|
|
|
|
inContainer = func() bool { return false }
|
|
u = &updater{state: "available", latest: &update.Release{Version: "0.1.4479"}}
|
|
u.placeExe(exe)
|
|
if j := u.json(); j.Stuck != "not-writable" || j.StuckDir != dir || j.Image != "" {
|
|
t.Fatalf("outside one: %+v", j)
|
|
}
|
|
|
|
// a container whose binary may be replaced updates itself as before
|
|
inContainer = func() bool { return true }
|
|
os.Chmod(dir, 0o755)
|
|
u = &updater{}
|
|
u.placeExe(exe)
|
|
if u.exe != exe || u.stuck != "" {
|
|
t.Fatalf("a writable folder in a container: exe %q, stuck %q", u.exe, u.stuck)
|
|
}
|
|
}
|