mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
Added some form of support for using go build/ci.go tooling with Firehose branch
This commit is contained in:
parent
d1f03614a4
commit
f972a30c63
2 changed files with 25 additions and 4 deletions
14
build/ci.go
14
build/ci.go
|
|
@ -59,6 +59,7 @@ import (
|
||||||
|
|
||||||
"github.com/cespare/cp"
|
"github.com/cespare/cp"
|
||||||
"github.com/ethereum/go-ethereum/crypto/signify"
|
"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/build"
|
||||||
"github.com/ethereum/go-ethereum/internal/version"
|
"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")
|
log.Printf("skipping archive creation because this is a PR build")
|
||||||
os.Exit(0)
|
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)
|
log.Printf("skipping archive creation because branch %q, tag %q is not on the inclusion list", env.Branch, env.Tag)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
@ -722,22 +723,27 @@ func doDockerBuildx(cmdline []string) {
|
||||||
tags = []string{"latest"}
|
tags = []string{"latest"}
|
||||||
case strings.HasPrefix(env.Tag, "v1."):
|
case strings.HasPrefix(env.Tag, "v1."):
|
||||||
tags = []string{"stable", fmt.Sprintf("release-%v", version.Family), "v" + version.Semantic}
|
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
|
// 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 {
|
for _, spec := range []struct {
|
||||||
file string
|
file string
|
||||||
base string
|
base string
|
||||||
}{
|
}{
|
||||||
{file: "Dockerfile", base: fmt.Sprintf("%s:", *upload)},
|
{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
|
for _, tag := range tags { // latest, stable etc
|
||||||
gethImage := fmt.Sprintf("%s%s", spec.base, tag)
|
gethImage := fmt.Sprintf("%s%s", spec.base, tag)
|
||||||
build.MustRunCommand("docker", "buildx", "build",
|
build.MustRunCommand("docker", "buildx", "build",
|
||||||
"--build-arg", "COMMIT="+env.Commit,
|
"--build-arg", "COMMIT="+env.Commit,
|
||||||
"--build-arg", "VERSION="+version.WithMeta,
|
"--build-arg", "VERSION="+version.WithMeta+"-fh"+tracers.FirehoseProtocolVersion,
|
||||||
"--build-arg", "BUILDNUM="+env.Buildnum,
|
"--build-arg", "BUILDNUM="+env.Buildnum,
|
||||||
"--tag", gethImage,
|
"--tag", gethImage,
|
||||||
"--platform", *platform,
|
"--platform", *platform,
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,17 @@ import (
|
||||||
|
|
||||||
var DryRunFlag = flag.Bool("n", false, "dry run, don't execute commands")
|
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
|
// MustRun executes the given command and exits the host process for
|
||||||
// any error.
|
// any error.
|
||||||
func MustRun(cmd *exec.Cmd) {
|
func MustRun(cmd *exec.Cmd) {
|
||||||
|
|
@ -63,6 +74,10 @@ func printArgs(args []string) string {
|
||||||
return s.String()
|
return s.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RunCommand(cmd string, args ...string) {
|
||||||
|
Run(exec.Command(cmd, args...))
|
||||||
|
}
|
||||||
|
|
||||||
func MustRunCommand(cmd string, args ...string) {
|
func MustRunCommand(cmd string, args ...string) {
|
||||||
MustRun(exec.Command(cmd, args...))
|
MustRun(exec.Command(cmd, args...))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue