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]
`$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.
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)
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
./script/release/push-release $VERSION
./script/release/build-binary
When prompted test the binaries.
1. Draft a release from the tag on GitHub (the script will open the window for
you)
@ -75,11 +74,17 @@ When prompted test 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)

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
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
GITHUB=https://github.com/$REPO/pull

View File

@ -3,17 +3,11 @@
# Prepare a new release branch
#
set -e
set -o pipefail
. script/release/utils.sh
REPO=git@github.com:docker/compose
. "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
function usage() {
>&2 cat << EOM
Create a new release branch `release-<version>`
Create a new release branch 'release-<version>'
Usage:
@ -29,9 +23,12 @@ EOM
exit 1
}
[ -n "$1" ] || usage
VERSION=$1
BRANCH=bump-$VERSION
REPO=docker/compose
GITHUB_REPO=git@github.com:$REPO
if [ -z "$2" ]; then
BASE_VERSION="master"
@ -41,11 +38,11 @@ fi
DEFAULT_REMOTE=release
REMOTE=$(find_remote $REPO)
REMOTE="$(find_remote "$GITHUB_REPO")"
# If we don't have a docker origin add one
if [ -z "$REMOTE" ]; then
echo "Creating $DEFAULT_REMOTE remote"
git remote add ${DEFAULT_REMOTE} ${REPO}
git remote add ${DEFAULT_REMOTE} ${GITHUB_REPO}
fi
# 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"
# TODO: automate this
$EDITOR docs/install.md
$EDITOR compose/__init__.py
@ -75,22 +71,26 @@ browser "https://github.com/docker/compose/issues?q=milestone%3A$VERSION+is%3Acl
$EDITOR CHANGELOG.md
echo "Verify changes before commit. Exit the shell to commit changes"
git diff
$SHELL
git commit -a -m "Bump $VERSION" --signoff
echo "Verify changes before commit. Exit the shell to commit changes"
$SHELL || true
git commit -a -m "Bump $VERSION" --signoff --no-verify
echo "Push branch to user remote"
GITHUB_USER=$USER
USER_REMOTE=$(find_remote $GITHUB_USER/compose)
USER_REMOTE="$(find_remote $GITHUB_USER/compose)"
if [ -z "$USER_REMOTE" ]; then
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
USER_REMOTE=$(find_remote $GITHUB_USER/compose)
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
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
#
set -e
set -o pipefail
. script/release/utils.sh
. "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
function usage() {
>&2 cat << EOM
@ -22,6 +19,13 @@ EOM
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
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
REPO=docker/compose
GITHUB_REPO=git@github.com:$REPO
@ -35,30 +39,18 @@ if [[ "$build_status" != "success" ]]; then
exit -1
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"
git tag $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"
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"
virtualenv venv-test
@ -68,4 +60,4 @@ docker-compose version
deactivate
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
#
set -e
. "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
function usage() {
>&2 cat << EOM
@ -23,7 +22,7 @@ VERSION="$(git config "branch.${BRANCH}.release")" || usage
COMMIT_MSG="Bump $VERSION"
sha=$(git log --grep $COMMIT_MSG --format="%H")
sha="$(git log --grep "$COMMIT_MSG" --format="%H")"
if [ -z "$sha" ]; then
>&2 echo "No commit with message \"$COMMIT_MSG\""
exit 2
@ -33,7 +32,7 @@ if [[ "$sha" == "$(git rev-parse HEAD)" ]]; then
exit 0
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 cherry-pick $sha

View File

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