mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 12:49:29 +08:00
build: releaser supports releasing only some artifacts.
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
@ -103,7 +104,7 @@ func (t buildArtifact) getUrl(baseArchiveUrl, version string, releaseType Releas
|
||||
return url
|
||||
}
|
||||
|
||||
var buildArtifactConfigurations = []buildArtifact{
|
||||
var completeBuildArtifactConfigurations = []buildArtifact{
|
||||
{
|
||||
os: "deb",
|
||||
arch: "arm64",
|
||||
@ -161,6 +162,31 @@ var buildArtifactConfigurations = []buildArtifact{
|
||||
},
|
||||
}
|
||||
|
||||
type artifactFilter struct {
|
||||
os string
|
||||
arch string
|
||||
}
|
||||
|
||||
func filterBuildArtifacts(filters []artifactFilter) ([]buildArtifact, error) {
|
||||
var artifacts []buildArtifact
|
||||
for _, f := range filters {
|
||||
matched := false
|
||||
|
||||
for _, a := range completeBuildArtifactConfigurations {
|
||||
if f.os == a.os && f.arch == a.arch {
|
||||
artifacts = append(artifacts, a)
|
||||
matched = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !matched {
|
||||
return nil, errors.New(fmt.Sprintf("No buildArtifact for os=%v, arch=%v", f.os, f.arch))
|
||||
}
|
||||
}
|
||||
return artifacts, nil
|
||||
}
|
||||
|
||||
func newBuild(baseArchiveUrl string, ba buildArtifact, version string, rt ReleaseType, sha256 string) build {
|
||||
return build{
|
||||
Os: ba.os,
|
||||
|
Reference in New Issue
Block a user