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
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) {
type filterType string
const (
Add filterType = "add"
Remove filterType = "remove"
)
func filterBuildArtifacts(filters []artifactFilter, ft filterType) ([]buildArtifact, error) {
var artifacts []buildArtifact
for _, f := range filters {
for _, a := range completeBuildArtifactConfigurations {
matched := false
var match buildArtifact
for _, a := range completeBuildArtifactConfigurations {
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")
}
}
}
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