Skip to content

Commit

Permalink
Merge #33516
Browse files Browse the repository at this point in the history
33516: build,Makefile: break up the release process into two phases r=bdarnell a=danhhz

I need the bound the time I can spend babysitting the next release if
anything goes wrong, so this is done in a purely additive manner which,
in the worst case, will allow falling back to the previous release
process. Once we're happy with the new one, we can clean up the old code
and scripts.

The first phase is to build provisional binaries. These are exactly the
bits we intend to ship as whatever version we're releasing. The
provisional SHA is marked in git by a tag with the form
`provisional_yyyymmddhhss_<semver>`. The various binaries (a combination
of platform, fully static vs not, race vs not) are uploaded to their
final places in s3, but nothing points at them.

At this point, the release coordinator will stage these binaries on the
long running clusters for verification. A followup PR will also allow
them to be used for a run of the nightly and weekly roachtests.

If any issues are found, a new SHA is selected, a new provisional tag is
pushed for it, binaries are built again, and verification is resumed.

Once we have provisional binaries that we're happy with, they're
blessed, which is the second phase. This makes and uploads the source
archive artifact. If the release is the latest stable release, it also
updates the various latest pointers.

The continuous publication of binaries for every green master build is
still supported but currently a bit of a hack. Ideally, the teamcity
build for it would work by releasing the provisional binaries and
immediately blessing them. However, the latest pointers work differently
between the two, so for now, this entire process is left inside the
provisional binaries step and blessing is disallowed for non-releases.
Perhaps we can unify the behaviors a bit and clean this up at some
point. The standalone workload binary is no longer continuously
published, since it's now built into the cockroach binary.

To pull all of this off, a small bit of functionality had to be added to
the Makefile. The version that a binary self reports is usually
determined automatically based on the "closest" git tag of whatever
checkout built it. We don't want the provisional tags to be considered
in this, so when we build the provisional binary, we need to override
the version. A BUILDINFO_TAG override is added for this to the various
ways to make a binary `make {mkrelease,build,...}` as well as `make
archive`.

As far as I can tell, everything is uploaded to the same place and with
the same folder and binary names as before, _except_ the folder inside
the artifact for the latest binary is now `cockroach_<semver>_<suffix`
instead of `cockroach_latest_<suffix>`. This should be fine, since both
`crl-stage-binaries` and `roachprod stage untar it with
`--strip-components 1`. (In fact, I think finally doing the TODO to
always make latest a redirect may be as simple as adding the `-L` flags
to curl in those two places.)

Release note: None

Co-authored-by: Daniel Harrison <daniel.harrison@gmail.com>
  • Loading branch information
craig[bot] and danhhz committed Jan 8, 2019
2 parents 1c3332b + c74f12f commit 12e2815
Show file tree
Hide file tree
Showing 5 changed files with 592 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -752,14 +752,17 @@ $(go-targets-ccl): $(C_LIBS_CCL)
BUILDINFO = .buildinfo/tag .buildinfo/rev
BUILD_TAGGED_RELEASE =

## Override for .buildinfo/tag
BUILDINFO_TAG :=

$(go-targets): bin/.bootstrap $(BUILDINFO) $(CGO_FLAGS_FILES) $(PROTOBUF_TARGETS)
$(go-targets): $(SQLPARSER_TARGETS) $(EXECGEN_TARGETS) $(OPTGEN_TARGETS)
$(go-targets): override LINKFLAGS += \
-X "github.com/cockroachdb/cockroach/pkg/build.tag=$(shell cat .buildinfo/tag)" \
-X "github.com/cockroachdb/cockroach/pkg/build.tag=$(if $(BUILDINFO_TAG),$(BUILDINFO_TAG),$(shell cat .buildinfo/tag))" \
-X "github.com/cockroachdb/cockroach/pkg/build.rev=$(shell cat .buildinfo/rev)" \
-X "github.com/cockroachdb/cockroach/pkg/build.cgoTargetTriple=$(TARGET_TRIPLE)" \
$(if $(BUILDCHANNEL),-X "github.com/cockroachdb/cockroach/pkg/build.channel=$(BUILDCHANNEL)") \
$(if $(BUILD_TAGGED_RELEASE),-X "github.com/cockroachdb/cockroach/pkg/util/log.crashReportEnv=$(shell cat .buildinfo/tag)")
$(if $(BUILD_TAGGED_RELEASE),-X "github.com/cockroachdb/cockroach/pkg/util/log.crashReportEnv=$(if $(BUILDINFO_TAG),$(BUILDINFO_TAG),$(shell cat .buildinfo/tag))")

# The build.utcTime format must remain in sync with TimeFormat in
# pkg/build/info.go. It is not installed in tests to avoid busting the cache on
Expand Down Expand Up @@ -987,8 +990,9 @@ ARCHIVE_EXTRAS = \
# TODO(benesch): Make this recipe use `git ls-files --recurse-submodules`
# instead of scripts/ls-files.sh once Git v2.11 is widely deployed.
.INTERMEDIATE: $(ARCHIVE).tmp
$(ARCHIVE).tmp: ARCHIVE_BASE = cockroach-$(shell cat .buildinfo/tag)
$(ARCHIVE).tmp: ARCHIVE_BASE = cockroach-$(if $(BUILDINFO_TAG),$(BUILDINFO_TAG),$(shell cat .buildinfo/tag))
$(ARCHIVE).tmp: $(ARCHIVE_EXTRAS)
echo "$(if $(BUILDINFO_TAG),$(BUILDINFO_TAG),$(shell cat .buildinfo/tag))" > .buildinfo/tag
scripts/ls-files.sh | $(TAR) -cf $@ -T - $(TAR_XFORM_FLAG),^,$(ARCHIVE_BASE)/src/github.com/cockroachdb/cockroach/, $^
(cd build/archive/contents && $(TAR) -rf ../../../$@ $(TAR_XFORM_FLAG),^,$(ARCHIVE_BASE)/, *)

Expand Down Expand Up @@ -1429,6 +1433,7 @@ bins = \
bin/langgen \
bin/protoc-gen-gogoroach \
bin/publish-artifacts \
bin/publish-provisional-artifacts \
bin/optgen \
bin/returncheck \
bin/roachprod \
Expand Down
15 changes: 15 additions & 0 deletions build/teamcity-bless-provisional-binaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# Any arguments to this script are passed through unmodified to
# ./pkg/cmd/publish-provisional-artifacts.

set -euxo pipefail

export BUILDER_HIDE_GOPATH_SRC=1

build/builder.sh go install ./pkg/cmd/publish-provisional-artifacts
build/builder.sh env \
AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \
AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
TC_BUILD_BRANCH="$TC_BUILD_BRANCH" \
publish-provisional-artifacts -bless "$@"
15 changes: 15 additions & 0 deletions build/teamcity-publish-provisional-binaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# Any arguments to this script are passed through unmodified to
# ./pkg/cmd/publish-provisional-artifacts.

set -euxo pipefail

export BUILDER_HIDE_GOPATH_SRC=1

build/builder.sh go install ./pkg/cmd/publish-provisional-artifacts
build/builder.sh env \
AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \
AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
TC_BUILD_BRANCH="$TC_BUILD_BRANCH" \
publish-provisional-artifacts -provisional "$@"
1 change: 1 addition & 0 deletions build/variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ define VALID_VARS
BENCHTIMEOUT
BUILDCHANNEL
BUILDINFO
BUILDINFO_TAG
BUILDTARGET
BUILDTYPE
BUILD_DIR
Expand Down
Loading

0 comments on commit 12e2815

Please sign in to comment.