mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CI: Build all platforms for Enterprise (#20389)
* CI: Build all platforms for Enterprise * CI: publishes new enterprise builds to grafana.com
This commit is contained in:
parent
ea7ccda647
commit
d630ac4b68
@ -47,15 +47,13 @@ fi
|
||||
echo "Build arguments: $OPT"
|
||||
echo "current dir: $(pwd)"
|
||||
|
||||
# build only amd64 for enterprise
|
||||
if echo "$EXTRA_OPTS" | grep -vq enterprise ; then
|
||||
go run build.go -goarch armv6 -cc ${CCARMV6} ${OPT} build
|
||||
go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
|
||||
go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
|
||||
go run build.go -goarch armv7 -libc musl -cc ${CCARMV7_MUSL} ${OPT} build
|
||||
go run build.go -goarch arm64 -libc musl -cc ${CCARM64_MUSL} ${OPT} build
|
||||
go run build.go -goos darwin -cc ${CCOSX64} ${OPT} build
|
||||
fi
|
||||
go run build.go -goarch armv6 -cc ${CCARMV6} ${OPT} build
|
||||
go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
|
||||
go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
|
||||
go run build.go -goarch armv7 -libc musl -cc ${CCARMV7_MUSL} ${OPT} build
|
||||
go run build.go -goarch arm64 -libc musl -cc ${CCARM64_MUSL} ${OPT} build
|
||||
go run build.go -goos darwin -cc ${CCOSX64} ${OPT} build
|
||||
|
||||
|
||||
go run build.go -goos windows -cc ${CCWIN64} ${OPT} build
|
||||
|
||||
|
@ -46,11 +46,8 @@ func main() {
|
||||
baseURL = createBaseURL(archiveProviderRoot, "enterprise", product, nightly)
|
||||
var err error
|
||||
buildArtifacts, err = filterBuildArtifacts([]artifactFilter{
|
||||
{os: "deb", arch: "amd64"},
|
||||
{os: "rhel", arch: "amd64"},
|
||||
{os: "linux", arch: "amd64"},
|
||||
{os: "win", arch: "amd64"},
|
||||
})
|
||||
{os: "win-installer", arch: "amd64"},
|
||||
}, Remove)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Could not filter to the selected build artifacts, err=%v", err)
|
||||
|
@ -186,21 +186,32 @@ type artifactFilter struct {
|
||||
arch string
|
||||
}
|
||||
|
||||
func filterBuildArtifacts(filters []artifactFilter) ([]buildArtifact, error) {
|
||||
var artifacts []buildArtifact
|
||||
for _, f := range filters {
|
||||
matched := false
|
||||
type filterType string
|
||||
|
||||
for _, a := range completeBuildArtifactConfigurations {
|
||||
const (
|
||||
Add filterType = "add"
|
||||
Remove filterType = "remove"
|
||||
)
|
||||
|
||||
func filterBuildArtifacts(filters []artifactFilter, ft filterType) ([]buildArtifact, error) {
|
||||
var artifacts []buildArtifact
|
||||
|
||||
for _, a := range completeBuildArtifactConfigurations {
|
||||
matched := false
|
||||
var match buildArtifact
|
||||
|
||||
for _, f := range filters {
|
||||
if f.os == a.os && f.arch == a.arch {
|
||||
artifacts = append(artifacts, a)
|
||||
match = a
|
||||
matched = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !matched {
|
||||
return nil, fmt.Errorf("No buildArtifact for os=%v, arch=%v", f.os, f.arch)
|
||||
if matched && ft == Add {
|
||||
artifacts = append(artifacts, match)
|
||||
} else if !matched && ft == Remove {
|
||||
artifacts = append(artifacts, match)
|
||||
}
|
||||
}
|
||||
return artifacts, nil
|
||||
|
@ -153,18 +153,28 @@ func TestFilterBuildArtifacts(t *testing.T) {
|
||||
{os: "rhel", arch: "amd64"},
|
||||
{os: "linux", arch: "amd64"},
|
||||
{os: "win", arch: "amd64"},
|
||||
})
|
||||
}, Add)
|
||||
|
||||
if len(buildArtifacts) != 4 {
|
||||
t.Errorf("Expected 4 build artifacts after filtering, but was %v", len(buildArtifacts))
|
||||
}
|
||||
|
||||
_, err := filterBuildArtifacts([]artifactFilter{
|
||||
{os: "foobar", arch: "amd64"},
|
||||
})
|
||||
buildArtifacts, err := filterBuildArtifacts([]artifactFilter{
|
||||
{os: "win-installer", arch: "amd64"},
|
||||
}, Remove)
|
||||
|
||||
if err == nil {
|
||||
t.Errorf("Expected an error as a we tried to filter on a nonexiststant os.")
|
||||
if err != nil {
|
||||
t.Errorf("Expected all artifacts except win-msi, not error=%v", err)
|
||||
}
|
||||
|
||||
if len(buildArtifacts) != len(completeBuildArtifactConfigurations)-1 {
|
||||
t.Errorf("Expected %v artifacts but was %v", completeBuildArtifactConfigurations, buildArtifacts)
|
||||
}
|
||||
|
||||
for _, ba := range buildArtifacts {
|
||||
if ba.arch == "amd64" && ba.os == "win-installer" {
|
||||
t.Errorf("win-installer/amd64 should be gone due to filtering")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user