Fix some bugs in the release scripts

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2015-09-22 10:10:11 -04:00
parent dc56e4f97e
commit 1a2a0dd53d
7 changed files with 78 additions and 52 deletions

View File

@ -7,7 +7,7 @@ Create a branch, update version, and add release notes by running `make-branch`
./script/release/make-branch $VERSION [$BASE_VERSION] ./script/release/make-branch $VERSION [$BASE_VERSION]
`$BASE_VERSION` will default to master. Use the last version tag for a bug fix `$BASE_VERSION` will default to master. Use the last version tag for a bug fix
release. release.
As part of this script you'll be asked to: As part of this script you'll be asked to:
@ -40,15 +40,14 @@ As part of this script you'll be asked to:
## To release a version (whether RC or stable) ## To release a version (whether RC or stable)
Check out the bump branch and run the `push-release` script Check out the bump branch and run the `build-binary` script
git checkout bump-$VERSION git checkout bump-$VERSION
./script/release/push-release $VERSION ./script/release/build-binary
When prompted test the binaries. When prompted test the binaries.
1. Draft a release from the tag on GitHub (the script will open the window for 1. Draft a release from the tag on GitHub (the script will open the window for
you) you)
@ -75,11 +74,17 @@ When prompted test the binaries.
3. Attach the binaries. 3. Attach the binaries.
4. Publish the release on GitHub. 4. If everything looks good, it's time to push the release.
5. Check that both binaries download (following the install instructions) and run.
6. Email maintainers@dockerproject.org and engineering@docker.com about the new release. ./script/release/push-release
5. Publish the release on GitHub.
6. Check that both binaries download (following the install instructions) and run.
7. Email maintainers@dockerproject.org and engineering@docker.com about the new release.
## If its a stable release (not an RC) ## If its a stable release (not an RC)

21
script/release/build-binaries Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
#
# Build the release binaries
#
. "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
REPO=docker/compose
# Build the binaries
script/clean
script/build-linux
# TODO: build osx binary
# script/prepare-osx
# script/build-osx
# TODO: build or fetch the windows binary
echo "You need to build the osx/windows binaries, that step is not automated yet."
echo "Create a github release"
# TODO: script more of this https://developer.github.com/v3/repos/releases/
browser https://github.com/$REPO/releases/new

View File

@ -20,6 +20,12 @@ EOM
[ -n "$1" ] || usage [ -n "$1" ] || usage
if [ -z "$(command -v hub 2> /dev/null)" ]; then
>&2 echo "$0 requires https://hub.github.com/."
>&2 echo "Please install it and ake sure it is available on your \$PATH."
exit 2
fi
REPO=docker/compose REPO=docker/compose
GITHUB=https://github.com/$REPO/pull GITHUB=https://github.com/$REPO/pull

View File

@ -3,17 +3,11 @@
# Prepare a new release branch # Prepare a new release branch
# #
set -e . "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
set -o pipefail
. script/release/utils.sh
REPO=git@github.com:docker/compose
function usage() { function usage() {
>&2 cat << EOM >&2 cat << EOM
Create a new release branch `release-<version>` Create a new release branch 'release-<version>'
Usage: Usage:
@ -29,9 +23,12 @@ EOM
exit 1 exit 1
} }
[ -n "$1" ] || usage [ -n "$1" ] || usage
VERSION=$1 VERSION=$1
BRANCH=bump-$VERSION BRANCH=bump-$VERSION
REPO=docker/compose
GITHUB_REPO=git@github.com:$REPO
if [ -z "$2" ]; then if [ -z "$2" ]; then
BASE_VERSION="master" BASE_VERSION="master"
@ -41,11 +38,11 @@ fi
DEFAULT_REMOTE=release DEFAULT_REMOTE=release
REMOTE=$(find_remote $REPO) REMOTE="$(find_remote "$GITHUB_REPO")"
# If we don't have a docker origin add one # If we don't have a docker origin add one
if [ -z "$REMOTE" ]; then if [ -z "$REMOTE" ]; then
echo "Creating $DEFAULT_REMOTE remote" echo "Creating $DEFAULT_REMOTE remote"
git remote add ${DEFAULT_REMOTE} ${REPO} git remote add ${DEFAULT_REMOTE} ${GITHUB_REPO}
fi fi
# handle the difference between a branch and a tag # handle the difference between a branch and a tag
@ -65,7 +62,6 @@ git config "branch.${BRANCH}.release" $VERSION
echo "Update versions in docs/install.md and compose/__init__.py" echo "Update versions in docs/install.md and compose/__init__.py"
# TODO: automate this
$EDITOR docs/install.md $EDITOR docs/install.md
$EDITOR compose/__init__.py $EDITOR compose/__init__.py
@ -75,22 +71,26 @@ browser "https://github.com/docker/compose/issues?q=milestone%3A$VERSION+is%3Acl
$EDITOR CHANGELOG.md $EDITOR CHANGELOG.md
echo "Verify changes before commit. Exit the shell to commit changes"
git diff git diff
$SHELL echo "Verify changes before commit. Exit the shell to commit changes"
git commit -a -m "Bump $VERSION" --signoff $SHELL || true
git commit -a -m "Bump $VERSION" --signoff --no-verify
echo "Push branch to user remote" echo "Push branch to user remote"
GITHUB_USER=$USER GITHUB_USER=$USER
USER_REMOTE=$(find_remote $GITHUB_USER/compose) USER_REMOTE="$(find_remote $GITHUB_USER/compose)"
if [ -z "$USER_REMOTE" ]; then if [ -z "$USER_REMOTE" ]; then
echo "No user remote found for $GITHUB_USER" echo "No user remote found for $GITHUB_USER"
read -n1 -r -p "Enter the name of your github user: " GITHUB_USER read -r -p "Enter the name of your github user: " GITHUB_USER
# assumes there is already a user remote somewhere # assumes there is already a user remote somewhere
USER_REMOTE=$(find_remote $GITHUB_USER/compose) USER_REMOTE=$(find_remote $GITHUB_USER/compose)
fi fi
if [ -z "$USER_REMOTE" ]; then
>&2 echo "No user remote found. You need to 'git push' your branch."
exit 2
fi
git push $USER_REMOTE git push $USER_REMOTE
browser https://github.com/docker/compose/compare/docker:release...$GITHUB_USER:$BRANCH?expand=1 browser https://github.com/$REPO/compare/docker:release...$GITHUB_USER:$BRANCH?expand=1

View File

@ -3,10 +3,7 @@
# Create the official release # Create the official release
# #
set -e . "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
set -o pipefail
. script/release/utils.sh
function usage() { function usage() {
>&2 cat << EOM >&2 cat << EOM
@ -22,6 +19,13 @@ EOM
BRANCH="$(git rev-parse --abbrev-ref HEAD)" BRANCH="$(git rev-parse --abbrev-ref HEAD)"
VERSION="$(git config "branch.${BRANCH}.release")" || usage VERSION="$(git config "branch.${BRANCH}.release")" || usage
if [ -z "$(command -v jq 2> /dev/null)" ]; then
>&2 echo "$0 requires https://stedolan.github.io/jq/"
>&2 echo "Please install it and ake sure it is available on your \$PATH."
exit 2
fi
API=https://api.github.com/repos API=https://api.github.com/repos
REPO=docker/compose REPO=docker/compose
GITHUB_REPO=git@github.com:$REPO GITHUB_REPO=git@github.com:$REPO
@ -35,30 +39,18 @@ if [[ "$build_status" != "success" ]]; then
exit -1 exit -1
fi fi
# Build the binaries and sdists
script/build-linux
# TODO: build osx binary
# script/prepare-osx
# script/build-osx
python setup.py sdist --formats=gztar,zip
echo "Test those binaries! Exit the shell to continue."
$SHELL
echo "Tagging the release as $VERSION" echo "Tagging the release as $VERSION"
git tag $VERSION git tag $VERSION
git push $GITHUB_REPO $VERSION git push $GITHUB_REPO $VERSION
echo "Create a github release"
# TODO: script more of this https://developer.github.com/v3/repos/releases/
browser https://github.com/$REPO/releases/new
echo "Uploading sdist to pypi" echo "Uploading sdist to pypi"
python setup.py sdist upload python setup.py sdist
if [ "$(command -v twine 2> /dev/null)" ]; then
twine upload ./dist/docker-compose-${VERSION}.tar.gz
else
python setup.py upload
fi
echo "Testing pip package" echo "Testing pip package"
virtualenv venv-test virtualenv venv-test
@ -68,4 +60,4 @@ docker-compose version
deactivate deactivate
echo "Now publish the github release, and test the downloads." echo "Now publish the github release, and test the downloads."
echo "Email maintainers@dockerproject.org and engineering@docker.com about the new release. echo "Email maintainers@dockerproject.org and engineering@docker.com about the new release."

View File

@ -3,8 +3,7 @@
# Move the "bump to <version>" commit to the HEAD of the branch # Move the "bump to <version>" commit to the HEAD of the branch
# #
set -e . "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
function usage() { function usage() {
>&2 cat << EOM >&2 cat << EOM
@ -23,7 +22,7 @@ VERSION="$(git config "branch.${BRANCH}.release")" || usage
COMMIT_MSG="Bump $VERSION" COMMIT_MSG="Bump $VERSION"
sha=$(git log --grep $COMMIT_MSG --format="%H") sha="$(git log --grep "$COMMIT_MSG" --format="%H")"
if [ -z "$sha" ]; then if [ -z "$sha" ]; then
>&2 echo "No commit with message \"$COMMIT_MSG\"" >&2 echo "No commit with message \"$COMMIT_MSG\""
exit 2 exit 2
@ -33,7 +32,7 @@ if [[ "$sha" == "$(git rev-parse HEAD)" ]]; then
exit 0 exit 0
fi fi
commits=$(git log --format="%H" HEAD..$sha | wc -l) commits=$(git log --format="%H" "$sha..HEAD" | wc -l)
git rebase --onto $sha~1 HEAD~$commits $BRANCH git rebase --onto $sha~1 HEAD~$commits $BRANCH
git cherry-pick $sha git cherry-pick $sha

View File

@ -4,6 +4,7 @@
# #
set -e set -e
set -o pipefail
function browser() { function browser() {
@ -17,4 +18,6 @@ function find_remote() {
for remote in $(git remote); do for remote in $(git remote); do
git config --get remote.${remote}.url | grep $url > /dev/null && echo -n $remote git config --get remote.${remote}.url | grep $url > /dev/null && echo -n $remote
done done
# Always return true, extra remotes cause it to return false
true
} }