Protect the release.sh script against accidental use. Infer VERSION automatically.
This commit is contained in:
parent
749a7d0e4f
commit
ff30eb96b6
2 changed files with 25 additions and 7 deletions
|
@ -21,7 +21,7 @@ run apt-get install -y -q reprepro
|
|||
# Install s3cmd 1.0.1 (earlier versions don't support env variables in the config)
|
||||
run apt-get install -y -q python-pip
|
||||
run pip install s3cmd
|
||||
run /bin/echo -e '[default]\naccess_key=$AWS_ID\nsecret_key=$AWS_KEY\n' > /.s3cfg
|
||||
run /bin/echo -e '[default]\naccess_key=$AWS_ACCESS_KEY\nsecret_key=$AWS_SECRET_KEY\n' > /.s3cfg
|
||||
# Download dependencies
|
||||
run PKG=github.com/kr/pty REV=27435c699; git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV
|
||||
run PKG=github.com/gorilla/context/ REV=708054d61e5; git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV
|
||||
|
|
30
release.sh
30
release.sh
|
@ -14,15 +14,33 @@ set -e
|
|||
|
||||
# Print a usage message and exit.
|
||||
usage() {
|
||||
echo "Usage: $0 VERSION BUCKET"
|
||||
echo "For example: $0 0.5.1-dev sandbox.get.docker.io"
|
||||
cat <<EOF
|
||||
To run, I need:
|
||||
- to be in a container generated by the Dockerfile at the top of the Docker
|
||||
repository;
|
||||
- to be provided with the name of an S3 bucket, in environment variable
|
||||
AWS_S3_BUCKET;
|
||||
- to be provided with AWS credentials for this S3 bucket, in environment
|
||||
variables AWS_ACCESS_KEY and AWS_SECRET_KEY;
|
||||
- a generous amount of good will and nice manners.
|
||||
The canonical way to run me is to run the image produced by the Dockerfile: e.g.:"
|
||||
|
||||
docker run -e AWS_S3_BUCKET=get-staging.docker.io \\
|
||||
AWS_ACCESS_KEY=AKI1234... \\
|
||||
AWS_SECRET_KEY=sEs3mE... \\
|
||||
f0058411
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
VERSION=$1
|
||||
BUCKET=$2
|
||||
[ -z "$VERSION" ] && usage
|
||||
[ -z "$BUCKET" ] && usage
|
||||
[ "$AWS_S3_BUCKET" ] || usage
|
||||
[ "$AWS_ACCESS_KEY" ] || usage
|
||||
[ "$AWS_SECRET_KEY" ] || usage
|
||||
[ -d /go/src/github.com/dotcloud/docker/ ] || usage
|
||||
cd /go/src/github.com/dotcloud/docker/
|
||||
|
||||
VERSION=$(cat VERSION)
|
||||
BUCKET=s3://$AWS_S3_BUCKET
|
||||
|
||||
setup_s3() {
|
||||
# Try creating the bucket. Ignore errors (it might already exist).
|
||||
|
|
Loading…
Reference in a new issue