Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

前端不能更新,且丢失版本号 #12

Open
fzdy-zz opened this issue Jul 4, 2024 · 6 comments
Open

前端不能更新,且丢失版本号 #12

fzdy-zz opened this issue Jul 4, 2024 · 6 comments

Comments

@fzdy-zz
Copy link

fzdy-zz commented Jul 4, 2024

image

@nfervor
Copy link

nfervor commented Jul 4, 2024

这反馈的啥,前端哪有2.14.3xx

@cooip-jm
Copy link

cooip-jm commented Jul 4, 2024

2.14.347是后端
上面一行是前端

@nfervor
Copy link

nfervor commented Jul 4, 2024

那你会不会看代码,前端就是不显示版本号,就是显示这样的,反馈就一张图,要不你自己改。
image

@cooip-jm
Copy link

cooip-jm commented Jul 4, 2024

那你会不会看代码,前端就是不显示版本号,就是显示这样的,反馈就一张图,要不你自己改。


type FEVersionInfo struct {
	Sha string `json:"sha"`
}

func getFEVersion() (v string) {
	var info FEVersionInfo
	_, err := lib.HC.R().SetResult(&info).Get("https://api.github.com/repos/sub-store-org/Sub-Store-Front-End/commits/master")
	if err != nil {
		lib.PrintError("Failed to get versions info:", err)
	}
	return info.Sha
}

func (c *Container) SetLatestVersion() {
	switch c.ContainerType {
	case vars.ContainerTypeFE:
		c.Version = getFEVersion()[:7]

为啥用sha做version???

自己本地改一下算了

@fzdy-zz
Copy link
Author

fzdy-zz commented Jul 5, 2024

image

https://github.com/sub-store-org/Sub-Store-Manager-Cli/blob/master/docker/version.go

/*
	type FEVersionInfo struct {
		Sha string `json:"sha"`
	}

	func getFEVersion() (v string) {
		var info FEVersionInfo
		_, err := lib.HC.R().SetResult(&info).Get("https://api.github.com/repos/sub-store-org/Sub-Store-Front-End/commits/master")
		if err != nil {
			lib.PrintError("Failed to get versions info:", err)
		}
		return info.Sha
	}
*/
func getFEVersionInfos() (json []ReleaseInfo) {
	_, err := lib.HC.R().SetResult(&json).Get("https://api.github.com/repos/sub-store-org/Sub-Store-Front-End/releases")
	if err != nil {
		lib.PrintError("Failed to get versions info:", err)
	}
	return
}

func getFEVersionStrs() (v []string) {
	for _, info := range getFEVersionInfos() {
		v = append(v, info.TagName)
	}
	return
}

func (c *Container) SetLatestVersion() {
	switch c.ContainerType {
	case vars.ContainerTypeFE:
		feVersions := getFEVersionStrs()
		if len(feVersions) == 0 {
			lib.PrintError("no Front versions found", nil)
			return
		}
		c.Version = feVersions[0]
	case vars.ContainerTypeBE:
		beVersions := getBEVersionStrs()
		if len(beVersions) == 0 {
			lib.PrintError("no BE versions found", nil)
			return
		}
		c.Version = beVersions[0]
	}
}

就不PR了,可能使用SHA有其它考量。

@DesnLee
Copy link
Member

DesnLee commented Jul 6, 2024

最初的设计是总是使用最新版本的前端,就一直这样用了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants