Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script for the PublishRelease TC build configuration #50053

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

jlinder
Copy link
Collaborator

@jlinder jlinder commented Jun 10, 2020

Before: the script wasn't implemented.

Now:

Part of the new release process, this script

  • tags the selected SHA to the provided name
  • compiles the binaries and archive and uploads them to S3 as the
    versioned name
  • uploads the docker image to docker.io/cockroachdb/cockroach
  • pushes the tag to github.com/cockroachdb/cockroach
  • push all the artificats to their respective latest locations as
    appropriate

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@jlinder jlinder requested review from otan and dt June 10, 2020 16:50
# Work around headless d-bus problem by forcing docker to use
# plain-text credentials for dockerhub.
# https://github.com/docker/docker-credential-helpers/issues/105#issuecomment-420480401
mkdir -p ~/.docker
Copy link
Contributor

@otan otan Jun 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this section of docker login may make sense to modularise

@jlinder jlinder force-pushed the release/teamcity-publish-release branch from 5d5463b to 4d29a21 Compare August 6, 2020 03:24
@blathers-crl blathers-crl bot requested a review from otan August 6, 2020 03:24
@jlinder jlinder requested a review from pbardea August 6, 2020 15:31
@jlinder jlinder force-pushed the release/teamcity-publish-release branch from 4d29a21 to 663a76c Compare August 6, 2020 15:51
@jlinder jlinder force-pushed the release/teamcity-publish-release branch from 663a76c to ae88bb9 Compare August 13, 2020 22:04
@jlinder
Copy link
Collaborator Author

jlinder commented Aug 14, 2020

bors ping

@craig
Copy link
Contributor

craig bot commented Aug 14, 2020

pong

@jlinder jlinder force-pushed the release/teamcity-publish-release branch 2 times, most recently from f62d96e to 5a06605 Compare August 20, 2020 15:14
# for the `metadata` part at the end because Docker tags don't support
# `+` in the tag name.
# https://github.com/cockroachdb/cockroach/blob/master/pkg/util/version/version.go#L75
build_name="$(echo "${NAME}" | grep -E -o '^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[-.0-9A-Za-z]+)?$')"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using +dryrun instead of .dryrun or -dryrun and found docker image tags don't allow + in the tag name. I chose to not allow + in the build name so this problem isn't encountered. This means we can't have releases (or even internal builds that we want CC to consume) with +'s in them. I'm open to alternative ways of solving this if you've any ideas.


# TODO: update publish-artifacts with option to leave one or more cockroach binaries in the local filesystem
curl -f -s -S -o- "https://${s3_download_hostname}/cockroach-${build_name}.linux-amd64.tgz" | tar ixfz - --strip-components 1
cp cockroach build/deploy
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only copying cockroach (and not the libgeo libs) so this can be backported to v20.1 and before. Will make a follow-on PR to add libgeo for master.

AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \
AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
TC_BUILD_BRANCH="$build_name" \
publish-provisional-artifacts -bless -release -bucket "${bucket}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not copying / linking the files for dryrun but it should for binaries.cockroachdb.com since it is used in bless provisional artifacts already. I'll fix this post this PR.

# example: v20.1-latest
if [[ -z "$PRE_RELEASE" ]]; then
#TODO: implement me!
echo "Pushing latest-RELEASE_BRANCH S3 binaries and archive is not implemented."
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a new feature and not necessary for this initial test, leaving this for implementation in a subsequent PR.

s3_download_hostname="${bucket}"
git_repo_for_tag="cockroachdb/cockroach"
else
bucket="${BUCKET:-cockroach-builds-test}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you all think about using the binaries-test.cockroachdb.com here? (I'm not sure what the history is of the bucket.)

@jlinder jlinder force-pushed the release/teamcity-publish-release branch from 5a06605 to c5bf9b2 Compare August 20, 2020 15:33
@jlinder jlinder marked this pull request as ready for review August 20, 2020 15:37
Copy link
Contributor

@pbardea pbardea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - with minor comments

# Matching the version name regex from within the cockroach code except
# for the `metadata` part at the end because Docker tags don't support
# `+` in the tag name.
# https://github.com/cockroachdb/cockroach/blob/master/pkg/util/version/version.go#L75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried about this link rotting - maybe using the permalink (

`^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-.]+)?(\+[0-9A-Za-z-.]+|)?$`,
) would at least allow future readers to trace back the history if this changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Updated.

# ^major ^minor ^patch ^preRelease

if [[ -z "$build_name" ]] ; then
echo 'Invalid NAME. Must be of the format "vMAJOR.MINOR.PATCH(-PRERELEASE)?".'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also print the NAME that we're trying to parse here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be helpful. Added.

exit 1
fi

release_branch=$(echo ${build_name} | grep -E -o '^v[0-9]+\.[0-9]+')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check if we've successfully parse the release_branch here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think so because this is a subset of what is checked for build_name and if the build_name fails then it won't make it here.

@jlinder jlinder force-pushed the release/teamcity-publish-release branch 2 times, most recently from 290c240 to 9d126ac Compare August 20, 2020 18:53
@jlinder
Copy link
Collaborator Author

jlinder commented Aug 20, 2020

TFTR!

bors r=pbardea

@craig
Copy link
Contributor

craig bot commented Aug 20, 2020

🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

Before: the script wasn't implemented.

Now:

Part of the new release process, this script

- tags the selected SHA to the provided name
- compiles the binaries and archive and uploads them to S3 as the
  versioned name
- uploads the docker image to docker.io/cockroachdb/cockroach
- pushes the tag to github.com/cockroachdb/cockroach
- push all the artificats to their respective `latest` locations as
  appropriate

Release note: None
@jlinder jlinder force-pushed the release/teamcity-publish-release branch from 9d126ac to d73710d Compare August 20, 2020 19:21
@craig
Copy link
Contributor

craig bot commented Aug 20, 2020

👎 Rejected by PR status

@jlinder
Copy link
Collaborator Author

jlinder commented Aug 20, 2020

bors r=pbardea

@craig
Copy link
Contributor

craig bot commented Aug 20, 2020

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants