Added some form of support for using go build/ci.go tooling with Firehose branch

This commit is contained in:
Matthieu Vachon 2024-12-20 16:18:59 -05:00
parent d1f03614a4
commit f972a30c63
2 changed files with 25 additions and 4 deletions

View file

@ -59,6 +59,7 @@ import (
"github.com/cespare/cp"
"github.com/ethereum/go-ethereum/crypto/signify"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/internal/build"
"github.com/ethereum/go-ethereum/internal/version"
)
@ -679,7 +680,7 @@ func maybeSkipArchive(env build.Environment) {
log.Printf("skipping archive creation because this is a PR build")
os.Exit(0)
}
if env.Branch != "master" && !strings.HasPrefix(env.Tag, "v1.") {
if env.Branch != "master" && !strings.HasPrefix(env.Branch, "firehose") && !strings.HasPrefix(env.Tag, "v1.") && !strings.Contains(env.Tag, "fh") {
log.Printf("skipping archive creation because branch %q, tag %q is not on the inclusion list", env.Branch, env.Tag)
os.Exit(0)
}
@ -722,22 +723,27 @@ func doDockerBuildx(cmdline []string) {
tags = []string{"latest"}
case strings.HasPrefix(env.Tag, "v1."):
tags = []string{"stable", fmt.Sprintf("release-%v", version.Family), "v" + version.Semantic}
case strings.HasPrefix(env.Branch, "firehose"):
tags = []string{"edge-fh" + tracers.FirehoseProtocolVersion}
case strings.Contains(env.Tag, "fh"):
tags = []string{"stable-fh" + tracers.FirehoseProtocolVersion, "v" + version.Semantic + "-fh" + tracers.FirehoseProtocolVersion}
}
// Need to create a mult-arch builder
build.MustRunCommand("docker", "buildx", "create", "--use", "--name", "multi-arch-builder", "--platform", *platform)
build.RunCommand("docker", "buildx", "create", "--use", "--name", "multi-arch-builder", "--platform", *platform)
for _, spec := range []struct {
file string
base string
}{
{file: "Dockerfile", base: fmt.Sprintf("%s:", *upload)},
{file: "Dockerfile.alltools", base: fmt.Sprintf("%s:alltools-", *upload)},
// {file: "Dockerfile.alltools", base: fmt.Sprintf("%s:alltools-", *upload)},
} {
for _, tag := range tags { // latest, stable etc
gethImage := fmt.Sprintf("%s%s", spec.base, tag)
build.MustRunCommand("docker", "buildx", "build",
"--build-arg", "COMMIT="+env.Commit,
"--build-arg", "VERSION="+version.WithMeta,
"--build-arg", "VERSION="+version.WithMeta+"-fh"+tracers.FirehoseProtocolVersion,
"--build-arg", "BUILDNUM="+env.Buildnum,
"--tag", gethImage,
"--platform", *platform,

View file

@ -36,6 +36,17 @@ import (
var DryRunFlag = flag.Bool("n", false, "dry run, don't execute commands")
func Run(cmd *exec.Cmd) {
fmt.Println(">>>", printArgs(cmd.Args))
if !*DryRunFlag {
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
fmt.Println("Command error: " + err.Error())
}
}
}
// MustRun executes the given command and exits the host process for
// any error.
func MustRun(cmd *exec.Cmd) {
@ -63,6 +74,10 @@ func printArgs(args []string) string {
return s.String()
}
func RunCommand(cmd string, args ...string) {
Run(exec.Command(cmd, args...))
}
func MustRunCommand(cmd string, args ...string) {
MustRun(exec.Command(cmd, args...))
}