mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
builds: introduces enum for relase type.
This commit is contained in:
parent
e2007733f4
commit
2d361eeabf
@ -17,14 +17,18 @@ type releaseFromExternalContent struct {
|
||||
func (re releaseFromExternalContent) prepareRelease(baseArchiveUrl, whatsNewUrl string, releaseNotesUrl string, nightly bool) (*release, error) {
|
||||
version := re.rawVersion[1:]
|
||||
isBeta := strings.Contains(version, "beta")
|
||||
var rt ReleaseType
|
||||
if isBeta {
|
||||
rt = BETA
|
||||
}
|
||||
|
||||
builds := []build{}
|
||||
for _, ba := range re.artifactConfigurations {
|
||||
sha256, err := re.getter.getContents(fmt.Sprintf("%s.sha256", ba.getUrl(baseArchiveUrl, version, isBeta)))
|
||||
sha256, err := re.getter.getContents(fmt.Sprintf("%s.sha256", ba.getUrl(baseArchiveUrl, version, rt)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builds = append(builds, newBuild(baseArchiveUrl, ba, version, isBeta, sha256))
|
||||
builds = append(builds, newBuild(baseArchiveUrl, ba, version, rt, sha256))
|
||||
}
|
||||
|
||||
r := release{
|
||||
|
@ -70,7 +70,7 @@ func createBuildWalker(path string, data *buildData, archiveTypes []buildArtifac
|
||||
data.version = version
|
||||
data.builds = append(data.builds, build{
|
||||
Os: archive.os,
|
||||
Url: archive.getUrl(baseArchiveUrl, version, false),
|
||||
Url: archive.getUrl(baseArchiveUrl, version, NIGHTLY),
|
||||
Sha256: string(shaBytes),
|
||||
Arch: archive.arch,
|
||||
})
|
||||
|
@ -61,13 +61,21 @@ func (p *publisher) postRelease(r *release) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReleaseType int
|
||||
|
||||
const (
|
||||
STABLE ReleaseType = iota + 1
|
||||
BETA
|
||||
NIGHTLY
|
||||
)
|
||||
|
||||
type buildArtifact struct {
|
||||
os string
|
||||
arch string
|
||||
urlPostfix string
|
||||
}
|
||||
|
||||
func (t buildArtifact) getUrl(baseArchiveUrl, version string, isBeta bool) string {
|
||||
func (t buildArtifact) getUrl(baseArchiveUrl, version string, rt ReleaseType) string {
|
||||
prefix := "-"
|
||||
rhelReleaseExtra := ""
|
||||
|
||||
@ -75,7 +83,7 @@ func (t buildArtifact) getUrl(baseArchiveUrl, version string, isBeta bool) strin
|
||||
prefix = "_"
|
||||
}
|
||||
|
||||
if !isBeta && t.os == "rhel" {
|
||||
if rt == BETA && t.os == "rhel" {
|
||||
rhelReleaseExtra = "-1"
|
||||
}
|
||||
|
||||
@ -141,10 +149,10 @@ var buildArtifactConfigurations = []buildArtifact{
|
||||
},
|
||||
}
|
||||
|
||||
func newBuild(baseArchiveUrl string, ba buildArtifact, version string, isBeta bool, sha256 string) build {
|
||||
func newBuild(baseArchiveUrl string, ba buildArtifact, version string, rt ReleaseType, sha256 string) build {
|
||||
return build{
|
||||
Os: ba.os,
|
||||
Url: ba.getUrl(baseArchiveUrl, version, isBeta),
|
||||
Url: ba.getUrl(baseArchiveUrl, version, rt),
|
||||
Sha256: sha256,
|
||||
Arch: ba.arch,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user