Commit d630ac4b by Leonard Gram Committed by GitHub

CI: Build all platforms for Enterprise (#20389)

* CI: Build all platforms for Enterprise

* CI: publishes new enterprise builds to grafana.com
parent ea7ccda6
...@@ -47,15 +47,13 @@ fi ...@@ -47,15 +47,13 @@ fi
echo "Build arguments: $OPT" echo "Build arguments: $OPT"
echo "current dir: $(pwd)" echo "current dir: $(pwd)"
# build only amd64 for enterprise go run build.go -goarch armv6 -cc ${CCARMV6} ${OPT} build
if echo "$EXTRA_OPTS" | grep -vq enterprise ; then go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
go run build.go -goarch armv6 -cc ${CCARMV6} ${OPT} build go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build go run build.go -goarch armv7 -libc musl -cc ${CCARMV7_MUSL} ${OPT} build
go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build go run build.go -goarch arm64 -libc musl -cc ${CCARM64_MUSL} ${OPT} build
go run build.go -goarch armv7 -libc musl -cc ${CCARMV7_MUSL} ${OPT} build go run build.go -goos darwin -cc ${CCOSX64} ${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 -goos windows -cc ${CCWIN64} ${OPT} build go run build.go -goos windows -cc ${CCWIN64} ${OPT} build
......
...@@ -46,11 +46,8 @@ func main() { ...@@ -46,11 +46,8 @@ func main() {
baseURL = createBaseURL(archiveProviderRoot, "enterprise", product, nightly) baseURL = createBaseURL(archiveProviderRoot, "enterprise", product, nightly)
var err error var err error
buildArtifacts, err = filterBuildArtifacts([]artifactFilter{ buildArtifacts, err = filterBuildArtifacts([]artifactFilter{
{os: "deb", arch: "amd64"}, {os: "win-installer", arch: "amd64"},
{os: "rhel", arch: "amd64"}, }, Remove)
{os: "linux", arch: "amd64"},
{os: "win", arch: "amd64"},
})
if err != nil { if err != nil {
log.Fatalf("Could not filter to the selected build artifacts, err=%v", err) log.Fatalf("Could not filter to the selected build artifacts, err=%v", err)
......
...@@ -186,21 +186,32 @@ type artifactFilter struct { ...@@ -186,21 +186,32 @@ type artifactFilter struct {
arch string arch string
} }
func filterBuildArtifacts(filters []artifactFilter) ([]buildArtifact, error) { type filterType string
const (
Add filterType = "add"
Remove filterType = "remove"
)
func filterBuildArtifacts(filters []artifactFilter, ft filterType) ([]buildArtifact, error) {
var artifacts []buildArtifact var artifacts []buildArtifact
for _, f := range filters {
for _, a := range completeBuildArtifactConfigurations {
matched := false matched := false
var match buildArtifact
for _, a := range completeBuildArtifactConfigurations { for _, f := range filters {
if f.os == a.os && f.arch == a.arch { if f.os == a.os && f.arch == a.arch {
artifacts = append(artifacts, a) match = a
matched = true matched = true
break break
} }
} }
if !matched { if matched && ft == Add {
return nil, fmt.Errorf("No buildArtifact for os=%v, arch=%v", f.os, f.arch) artifacts = append(artifacts, match)
} else if !matched && ft == Remove {
artifacts = append(artifacts, match)
} }
} }
return artifacts, nil return artifacts, nil
......
...@@ -153,18 +153,28 @@ func TestFilterBuildArtifacts(t *testing.T) { ...@@ -153,18 +153,28 @@ func TestFilterBuildArtifacts(t *testing.T) {
{os: "rhel", arch: "amd64"}, {os: "rhel", arch: "amd64"},
{os: "linux", arch: "amd64"}, {os: "linux", arch: "amd64"},
{os: "win", arch: "amd64"}, {os: "win", arch: "amd64"},
}) }, Add)
if len(buildArtifacts) != 4 { if len(buildArtifacts) != 4 {
t.Errorf("Expected 4 build artifacts after filtering, but was %v", len(buildArtifacts)) t.Errorf("Expected 4 build artifacts after filtering, but was %v", len(buildArtifacts))
} }
_, err := filterBuildArtifacts([]artifactFilter{ buildArtifacts, err := filterBuildArtifacts([]artifactFilter{
{os: "foobar", arch: "amd64"}, {os: "win-installer", arch: "amd64"},
}) }, Remove)
if err == nil { if err != nil {
t.Errorf("Expected an error as a we tried to filter on a nonexiststant os.") 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")
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment