From 590fcf16fdca5332c2c78a194e01a218f1637a9f Mon Sep 17 00:00:00 2001 From: Rail Aliiev Date: Wed, 30 Mar 2022 18:42:18 -0400 Subject: [PATCH 1/3] ci: build and publish cockroach-sql This patch adds `cockroach-sql` as a separate artifact published to S3. The binary is not stripped (TBD). Fixes #75800 Release note: None --- pkg/cmd/publish-provisional-artifacts/main.go | 19 +++-- .../main_test.go | 72 ++++++++++++++----- pkg/release/release.go | 41 +++++++++-- 3 files changed, 102 insertions(+), 30 deletions(-) diff --git a/pkg/cmd/publish-provisional-artifacts/main.go b/pkg/cmd/publish-provisional-artifacts/main.go index 6fc7e1765ee5..1541a51f65ec 100644 --- a/pkg/cmd/publish-provisional-artifacts/main.go +++ b/pkg/cmd/publish-provisional-artifacts/main.go @@ -173,7 +173,7 @@ func run(svc s3I, flags runFlags, execFn release.ExecFn) { o.VersionStr = versionStr o.BucketName = bucketName o.AbsolutePath = filepath.Join(flags.pkgDir, "cockroach"+release.SuffixFromPlatform(platform)) - + o.CockroachSQLAbsolutePath = filepath.Join(flags.pkgDir, "cockroach-sql"+release.SuffixFromPlatform(platform)) cockroachBuildOpts = append(cockroachBuildOpts, o) } @@ -224,9 +224,10 @@ type opts struct { Platform release.Platform - AbsolutePath string - BucketName string - PkgDir string + AbsolutePath string + CockroachSQLAbsolutePath string + BucketName string + PkgDir string } func putNonRelease(svc s3I, o opts) { @@ -236,7 +237,10 @@ func putNonRelease(svc s3I, o opts) { Branch: o.Branch, BucketName: o.BucketName, Files: append( - []release.NonReleaseFile{release.MakeCRDBBinaryNonReleaseFile(o.AbsolutePath, o.VersionStr)}, + []release.NonReleaseFile{ + release.MakeCRDBBinaryNonReleaseFile(o.AbsolutePath, o.VersionStr), + release.MakeCRDBBinaryNonReleaseFile(o.CockroachSQLAbsolutePath, o.VersionStr), + }, release.MakeCRDBLibraryNonReleaseFiles(o.PkgDir, o.Platform, o.VersionStr)..., ), }, @@ -244,7 +248,7 @@ func putNonRelease(svc s3I, o opts) { } func s3KeyRelease(o opts) (string, string) { - return release.S3KeyRelease(o.Platform, o.VersionStr) + return release.S3KeyRelease(o.Platform, o.VersionStr, "cockroach") } func putRelease(svc s3I, o opts) { @@ -254,9 +258,10 @@ func putRelease(svc s3I, o opts) { Platform: o.Platform, VersionStr: o.VersionStr, Files: append( - []release.ArchiveFile{release.MakeCRDBBinaryArchiveFile(o.AbsolutePath)}, + []release.ArchiveFile{release.MakeCRDBBinaryArchiveFile(o.AbsolutePath, "cockroach")}, release.MakeCRDBLibraryArchiveFiles(o.PkgDir, o.Platform)..., ), + ExtraFiles: []release.ArchiveFile{release.MakeCRDBBinaryArchiveFile(o.CockroachSQLAbsolutePath, "cockroach-sql")}, }) } diff --git a/pkg/cmd/publish-provisional-artifacts/main_test.go b/pkg/cmd/publish-provisional-artifacts/main_test.go index 3b8dd4069550..287134e5c7a9 100644 --- a/pkg/cmd/publish-provisional-artifacts/main_test.go +++ b/pkg/cmd/publish-provisional-artifacts/main_test.go @@ -92,6 +92,7 @@ func (r *mockExecRunner) run(c *exec.Cmd) ([]byte, error) { } if c.Args[0] == "bazel" && c.Args[1] == "build" { path := filepath.Join(r.fakeBazelBin, "pkg", "cmd", "cockroach", "cockroach_", "cockroach") + pathSQL := filepath.Join(r.fakeBazelBin, "pkg", "cmd", "cockroach-sql", "cockroach-sql_", "cockroach-sql") var platform release.Platform for _, arg := range c.Args { if strings.HasPrefix(arg, `--config=`) { @@ -105,13 +106,14 @@ func (r *mockExecRunner) run(c *exec.Cmd) ([]byte, error) { case "crosswindowsbase": platform = release.PlatformWindows path += ".exe" + pathSQL += ".exe" case "ci", "with_ui": default: panic(fmt.Sprintf("Unexpected configuration %s", arg)) } } } - paths = append(paths, path) + paths = append(paths, path, pathSQL) ext := release.SharedLibraryExtensionFromPlatform(platform) for _, lib := range release.CRDBSharedLibraries { libDir := "lib" @@ -151,13 +153,17 @@ func TestProvisional(t *testing.T) { branch: `provisional_201901010101_v0.0.1-alpha`, }, expectedCmds: []string{ - "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crosslinuxbase", + "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crosslinuxbase", "env=[] args=bazel info bazel-bin -c opt --config=ci --config=with_ui --config=crosslinuxbase", "env=[MALLOC_CONF=prof:true] args=./cockroach.linux-2.6.32-gnu-amd64 version", "env=[] args=ldd ./cockroach.linux-2.6.32-gnu-amd64", - "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crossmacosbase", + "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crossmacosbase", "env=[] args=bazel info bazel-bin -c opt --config=ci --config=with_ui --config=crossmacosbase", - "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crosswindowsbase", + "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=." + + "/build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crosswindowsbase", "env=[] args=bazel info bazel-bin -c opt --config=ci --config=with_ui --config=crosswindowsbase", }, expectedGets: nil, @@ -165,13 +171,18 @@ func TestProvisional(t *testing.T) { "s3://binaries.cockroachdb.com/cockroach-v0.0.1-alpha.linux-amd64.tgz " + "CONTENTS ", "s3://binaries.cockroachdb.com/cockroach-v0.0.1-alpha.linux-amd64.tgz.sha256sum CONTENTS ", + "s3://binaries.cockroachdb.com/cockroach-sql-v0.0.1-alpha.linux-amd64 CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crosslinuxbase", "s3://binaries.cockroachdb.com/cockroach-v0.0.1-alpha.darwin-10.9-amd64.tgz " + "CONTENTS ", "s3://binaries.cockroachdb.com/cockroach-v0.0.1-alpha.darwin-10.9-amd64.tgz.sha256sum CONTENTS ", + "s3://binaries.cockroachdb.com/cockroach-sql-v0.0.1-alpha.darwin-10.9-amd64 CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crossmacosbase", "s3://binaries.cockroachdb.com/cockroach-v0.0.1-alpha.windows-6.2-amd64.zip " + "CONTENTS ", "s3://binaries.cockroachdb.com/cockroach-v0.0.1-alpha.windows-6.2-amd64.zip." + "sha256sum CONTENTS ", + "s3://binaries.cockroachdb.com/cockroach-sql-v0.0.1-alpha.windows-6.2-amd64.exe " + + "CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql" + + " '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary v0.0.1-alpha release' -c opt --config=ci --config=with_ui --config=crosswindowsbase", }, }, { @@ -183,40 +194,69 @@ func TestProvisional(t *testing.T) { sha: `00SHA00`, }, expectedCmds: []string{ - "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", + "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=." + + "/build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", "env=[] args=bazel info bazel-bin -c opt --config=ci --config=with_ui --config=crosslinuxbase", "env=[MALLOC_CONF=prof:true] args=./cockroach.linux-2.6.32-gnu-amd64 version", "env=[] args=ldd ./cockroach.linux-2.6.32-gnu-amd64", - "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", + "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", "env=[] args=bazel info bazel-bin -c opt --config=ci --config=with_ui --config=crossmacosbase", - "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", + "env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", "env=[] args=bazel info bazel-bin -c opt --config=ci --config=with_ui --config=crosswindowsbase", }, expectedGets: nil, expectedPuts: []string{ "s3://cockroach//cockroach/cockroach.linux-gnu-amd64.00SHA00 " + - "CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", + "CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp." + + "sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", "s3://cockroach/cockroach/cockroach.linux-gnu-amd64.LATEST/no-cache " + "REDIRECT /cockroach/cockroach.linux-gnu-amd64.00SHA00", - "s3://cockroach//cockroach/lib/libgeos.linux-gnu-amd64.00SHA00.so CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", + "s3://cockroach//cockroach/cockroach-sql.linux-gnu-amd64.00SHA00 CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", + "s3://cockroach/cockroach/cockroach-sql.linux-gnu-amd64.LATEST/no-cache REDIRECT /cockroach/cockroach-sql.linux-gnu-amd64.00SHA00", + "s3://cockroach//cockroach/lib/libgeos.linux-gnu-amd64.00SHA00." + + "so CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", "s3://cockroach/cockroach/lib/libgeos.linux-gnu-amd64.so.LATEST/no-cache REDIRECT /cockroach/lib/libgeos.linux-gnu-amd64.00SHA00.so", - "s3://cockroach//cockroach/lib/libgeos_c.linux-gnu-amd64.00SHA00.so CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", + "s3://cockroach//cockroach/lib/libgeos_c.linux-gnu-amd64.00SHA00." + + "so CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-pc-linux-gnu official-binary' -c opt --config=ci --config=with_ui --config=crosslinuxbase", "s3://cockroach/cockroach/lib/libgeos_c.linux-gnu-amd64.so.LATEST/no-cache REDIRECT /cockroach/lib/libgeos_c.linux-gnu-amd64.00SHA00.so", "s3://cockroach//cockroach/cockroach.darwin-amd64.00SHA00 " + - "CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", + "CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", "s3://cockroach/cockroach/cockroach.darwin-amd64.LATEST/no-cache " + "REDIRECT /cockroach/cockroach.darwin-amd64.00SHA00", - "s3://cockroach//cockroach/lib/libgeos.darwin-amd64.00SHA00.dylib CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", + "s3://cockroach//cockroach/cockroach-sql.darwin-amd64.00SHA00 CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", + "s3://cockroach/cockroach/cockroach-sql.darwin-amd64.LATEST/no-cache REDIRECT /cockroach/cockroach-sql." + + "darwin-amd64.00SHA00", + "s3://cockroach//cockroach/lib/libgeos.darwin-amd64.00SHA00." + + "dylib CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", "s3://cockroach/cockroach/lib/libgeos.darwin-amd64.dylib.LATEST/no-cache REDIRECT /cockroach/lib/libgeos.darwin-amd64.00SHA00.dylib", - "s3://cockroach//cockroach/lib/libgeos_c.darwin-amd64.00SHA00.dylib CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", + "s3://cockroach//cockroach/lib/libgeos_c.darwin-amd64.00SHA00." + + "dylib CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp." + + "sh x86_64-apple-darwin19 official-binary' -c opt --config=ci --config=with_ui --config=crossmacosbase", "s3://cockroach/cockroach/lib/libgeos_c.darwin-amd64.dylib.LATEST/no-cache REDIRECT /cockroach/lib/libgeos_c.darwin-amd64.00SHA00.dylib", "s3://cockroach//cockroach/cockroach.windows-amd64.00SHA00.exe " + - "CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", + "CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp." + + "sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", "s3://cockroach/cockroach/cockroach.windows-amd64.LATEST/no-cache " + "REDIRECT /cockroach/cockroach.windows-amd64.00SHA00.exe", - "s3://cockroach//cockroach/lib/libgeos.windows-amd64.00SHA00.dll CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", + "s3://cockroach//cockroach/cockroach-sql.windows-amd64.00SHA00.exe CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", + "s3://cockroach/cockroach/cockroach-sql.windows-amd64.LATEST/no-cache REDIRECT /cockroach/cockroach-sql.windows-amd64.00SHA00.exe", + "s3://cockroach//cockroach/lib/libgeos.windows-amd64.00SHA00." + + "dll CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", "s3://cockroach/cockroach/lib/libgeos.windows-amd64.dll.LATEST/no-cache REDIRECT /cockroach/lib/libgeos.windows-amd64.00SHA00.dll", - "s3://cockroach//cockroach/lib/libgeos_c.windows-amd64.00SHA00.dll CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", + "s3://cockroach//cockroach/lib/libgeos_c.windows-amd64.00SHA00." + + "dll CONTENTS env=[] args=bazel build //pkg/cmd/cockroach //c-deps:libgeos //pkg/cmd/cockroach-sql " + + "'--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32 official-binary' -c opt --config=ci --config=with_ui --config=crosswindowsbase", "s3://cockroach/cockroach/lib/libgeos_c.windows-amd64.dll.LATEST/no-cache REDIRECT /cockroach/lib/libgeos_c.windows-amd64.00SHA00.dll", }, }, diff --git a/pkg/release/release.go b/pkg/release/release.go index e2ffcf1254a6..45dc9b99c556 100644 --- a/pkg/release/release.go +++ b/pkg/release/release.go @@ -198,7 +198,7 @@ func MakeWorkload(pkgDir string) error { // MakeRelease makes the release binary and associated files. func MakeRelease(platform Platform, opts BuildOptions, pkgDir string) error { - buildArgs := []string{"build", "//pkg/cmd/cockroach", "//c-deps:libgeos"} + buildArgs := []string{"build", "//pkg/cmd/cockroach", "//c-deps:libgeos", "//pkg/cmd/cockroach-sql"} targetTriple := TargetTripleFromPlatform(platform) if opts.Release { if opts.BuildTag == "" { @@ -230,6 +230,10 @@ func MakeRelease(platform Platform, opts BuildOptions, pkgDir string) error { if err := stageBinary("//pkg/cmd/cockroach", platform, bazelBin, pkgDir); err != nil { return err } + // TODO: strip the bianry + if err := stageBinary("//pkg/cmd/cockroach-sql", platform, bazelBin, pkgDir); err != nil { + return err + } if err := stageLibraries(platform, bazelBin, filepath.Join(pkgDir, "lib")); err != nil { return err } @@ -283,7 +287,7 @@ type S3Putter interface { // S3KeyRelease extracts the target archive base and archive // name for the given parameters. -func S3KeyRelease(platform Platform, versionStr string) (string, string) { +func S3KeyRelease(platform Platform, versionStr string, binaryPrefix string) (string, string) { suffix := SuffixFromPlatform(platform) targetSuffix, hasExe := TrimDotExe(suffix) // TODO(tamird): remove this weirdness. Requires updating @@ -293,7 +297,7 @@ func S3KeyRelease(platform Platform, versionStr string) (string, string) { targetSuffix = osVersionRe.ReplaceAllLiteralString(targetSuffix, "") } - archiveBase := fmt.Sprintf("cockroach-%s", versionStr) + archiveBase := fmt.Sprintf("%s-%s", binaryPrefix, versionStr) targetArchiveBase := archiveBase + targetSuffix if hasExe { return targetArchiveBase, targetArchiveBase + ".zip" @@ -435,10 +439,9 @@ type ArchiveFile struct { } // MakeCRDBBinaryArchiveFile generates the ArchiveFile object for a CRDB binary. -func MakeCRDBBinaryArchiveFile(localAbsolutePath string) ArchiveFile { +func MakeCRDBBinaryArchiveFile(localAbsolutePath string, path string) ArchiveFile { base := filepath.Base(localAbsolutePath) _, hasExe := TrimDotExe(base) - path := "cockroach" if hasExe { path += ".exe" } @@ -477,13 +480,14 @@ type PutReleaseOptions struct { VersionStr string // Files are all the files to be included in the archive. - Files []ArchiveFile + Files []ArchiveFile + ExtraFiles []ArchiveFile } // PutRelease uploads a compressed archive containing the release // files and a checksum file of the archive to S3. func PutRelease(svc S3Putter, o PutReleaseOptions) { - targetArchiveBase, targetArchive := S3KeyRelease(o.Platform, o.VersionStr) + targetArchiveBase, targetArchive := S3KeyRelease(o.Platform, o.VersionStr, "cockroach") var body bytes.Buffer if strings.HasSuffix(targetArchive, ".zip") { @@ -585,6 +589,29 @@ func PutRelease(svc S3Putter, o PutReleaseOptions) { if _, err := svc.PutObject(&putObjectInputChecksum); err != nil { log.Fatalf("s3 upload %s: %s", targetChecksum, err) } + for _, f := range o.ExtraFiles { + keyBase, hasExe := TrimDotExe(f.ArchiveFilePath) + targetKey, _ := S3KeyRelease(o.Platform, o.VersionStr, keyBase) + if hasExe { + targetKey += ".exe" + } + log.Printf("Uploading to s3://%s/%s", o.BucketName, targetKey) + handle, err := os.Open(f.LocalAbsolutePath) + if err != nil { + log.Fatalf("failed to open %s: %s", f.LocalAbsolutePath, err) + } + putObjectInput := s3.PutObjectInput{ + Bucket: &o.BucketName, + Key: &targetKey, + Body: handle, + } + if o.NoCache { + putObjectInput.CacheControl = &NoCache + } + if _, err := svc.PutObject(&putObjectInput); err != nil { + log.Fatalf("s3 upload %s: %s", targetKey, err) + } + } } func getPathToBazelBin(execFn ExecFn, pkgDir string, configArgs []string) (string, error) { From 8edf45728ac7f3bfe4723860cb5ed653711b1a26 Mon Sep 17 00:00:00 2001 From: Tommy Reilly Date: Fri, 8 Apr 2022 08:29:41 -0400 Subject: [PATCH 2/3] test: fix bazel sqllite invocation Release note: None --- build/teamcity/cockroach/nightlies/sqlite_logic_test_impl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/teamcity/cockroach/nightlies/sqlite_logic_test_impl.sh b/build/teamcity/cockroach/nightlies/sqlite_logic_test_impl.sh index 52e8d3aaab5a..2132327239f4 100755 --- a/build/teamcity/cockroach/nightlies/sqlite_logic_test_impl.sh +++ b/build/teamcity/cockroach/nightlies/sqlite_logic_test_impl.sh @@ -11,7 +11,7 @@ GO_TEST_JSON_OUTPUT_FILE=/artifacts/test.json.txt exit_status=0 $BAZEL_BIN/pkg/cmd/bazci/bazci_/bazci --config=ci --config=crdb_test_off \ test //pkg/sql/logictest:logictest_test -- \ - --test_arg -bigtest --test_arg -flex-types --test_arg -parallel=4 \ + --test_arg -bigtest --test_arg -flex-types --test_arg -test.parallel=4 \ --test_timeout 86400 --test_filter '^TestSqlLiteLogic$|^TestTenantSQLLiteLogic$' \ --test_env=GO_TEST_JSON_OUTPUT_FILE=$GO_TEST_JSON_OUTPUT_FILE || exit_status=$? process_test_json \ From a4953592d3d17cfcb942ab20e9412ce61618f417 Mon Sep 17 00:00:00 2001 From: Mari Staib Date: Fri, 8 Apr 2022 11:15:24 -0400 Subject: [PATCH 3/3] WORKSPACE: update rules_go version The rules_go version has been bumped to accept the new changes from cockroachdb/rules_go#5. Release note: None --- WORKSPACE | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 03b75070f83c..ff2011c1a8fc 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -13,12 +13,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Load go bazel tools. This gives us access to the go bazel SDK/toolchains. http_archive( name = "io_bazel_rules_go", - sha256 = "a80c384a85ab9f6318419ed38a39b13e8481e9d2ea25a696ea9e25438e017b5f", - strip_prefix = "cockroachdb-rules_go-f96cc04", + sha256 = "8a993815a6a7cfe47e46238383f0e36a80b9ce0ac482f855c7288a31565b5661", + strip_prefix = "cockroachdb-rules_go-58cb947", urls = [ - # cockroachdb/rules_go as of f96cc0445102a7b08bceeb0bba32b4d82467a065 + # cockroachdb/rules_go as of 58cb94707783f529462d4c6d3c698933a1022942 # (upstream release-0.29 plus a few patches). - "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-54-gf96cc04.tar.gz", + "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-56-g58cb947.tar.gz", ], )