mirror of https://github.com/docker/compose.git
Merge pull request #6251 from docker/decontainerize-release
Decontainerize release script
This commit is contained in:
commit
756eae0f01
|
@ -1,15 +0,0 @@
|
||||||
FROM python:3.6
|
|
||||||
RUN mkdir -p /src && pip install -U Jinja2==2.10 \
|
|
||||||
PyGithub==1.39 \
|
|
||||||
pypandoc==1.4 \
|
|
||||||
GitPython==2.1.9 \
|
|
||||||
requests==2.18.4 \
|
|
||||||
twine==1.11.0 && \
|
|
||||||
apt-get update && apt-get install -y pandoc
|
|
||||||
|
|
||||||
VOLUME /src/script/release
|
|
||||||
WORKDIR /src
|
|
||||||
COPY . /src
|
|
||||||
RUN python setup.py develop
|
|
||||||
ENTRYPOINT ["python", "script/release/release.py"]
|
|
||||||
CMD ["--help"]
|
|
|
@ -9,8 +9,7 @@ The following things are required to bring a release to a successful conclusion
|
||||||
|
|
||||||
### Local Docker engine (Linux Containers)
|
### Local Docker engine (Linux Containers)
|
||||||
|
|
||||||
The release script runs inside a container and builds images that will be part
|
The release script builds images that will be part of the release.
|
||||||
of the release.
|
|
||||||
|
|
||||||
### Docker Hub account
|
### Docker Hub account
|
||||||
|
|
||||||
|
@ -20,11 +19,9 @@ following repositories:
|
||||||
- docker/compose
|
- docker/compose
|
||||||
- docker/compose-tests
|
- docker/compose-tests
|
||||||
|
|
||||||
### A local Python environment
|
### Python
|
||||||
|
|
||||||
While most of the release script is running inside a Docker container,
|
The release script is written in Python and requires Python 3.3 at minimum.
|
||||||
fetching local Docker credentials depends on the `docker` Python package
|
|
||||||
being available locally.
|
|
||||||
|
|
||||||
### A Github account and Github API token
|
### A Github account and Github API token
|
||||||
|
|
||||||
|
@ -59,6 +56,18 @@ Said account needs to be a member of the maintainers group for the
|
||||||
Moreover, the `~/.pypirc` file should exist on your host and contain the
|
Moreover, the `~/.pypirc` file should exist on your host and contain the
|
||||||
relevant pypi credentials.
|
relevant pypi credentials.
|
||||||
|
|
||||||
|
The following is a sample `.pypirc` provided as a guideline:
|
||||||
|
|
||||||
|
```
|
||||||
|
[distutils]
|
||||||
|
index-servers =
|
||||||
|
pypi
|
||||||
|
|
||||||
|
[pypi]
|
||||||
|
username = user
|
||||||
|
password = pass
|
||||||
|
```
|
||||||
|
|
||||||
## Start a feature release
|
## Start a feature release
|
||||||
|
|
||||||
A feature release is a release that includes all changes present in the
|
A feature release is a release that includes all changes present in the
|
||||||
|
|
|
@ -1,36 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
docker image inspect compose/release-tool > /dev/null
|
if test -d ./.release-venv; then
|
||||||
if test $? -ne 0; then
|
true
|
||||||
docker build -t compose/release-tool -f $(pwd)/script/release/Dockerfile $(pwd)
|
else
|
||||||
|
./script/release/setup-venv.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z $GITHUB_TOKEN; then
|
args=$*
|
||||||
echo "GITHUB_TOKEN environment variable must be set"
|
|
||||||
exit 1
|
if test -z $args; then
|
||||||
|
args="--help"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z $BINTRAY_TOKEN; then
|
./.release-venv/bin/python ./script/release/release.py $args
|
||||||
echo "BINTRAY_TOKEN environment variable must be set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z $(python -c "import docker; print(docker.version)" 2>/dev/null); then
|
|
||||||
echo "This script requires the 'docker' Python package to be installed locally"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
hub_credentials=$(python -c "from docker import auth; cfg = auth.load_config(); print(auth.encode_header(auth.resolve_authconfig(cfg, 'docker.io')).decode('ascii'))")
|
|
||||||
|
|
||||||
docker run -it \
|
|
||||||
-e GITHUB_TOKEN=$GITHUB_TOKEN \
|
|
||||||
-e BINTRAY_TOKEN=$BINTRAY_TOKEN \
|
|
||||||
-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
|
|
||||||
-e HUB_CREDENTIALS=$hub_credentials \
|
|
||||||
--mount type=bind,source=$(pwd),target=/src \
|
|
||||||
--mount type=bind,source=$HOME/.gitconfig,target=/root/.gitconfig \
|
|
||||||
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
|
|
||||||
--mount type=bind,source=$HOME/.ssh,target=/root/.ssh \
|
|
||||||
--mount type=bind,source=/tmp,target=/tmp \
|
|
||||||
-v $HOME/.pypirc:/root/.pypirc \
|
|
||||||
compose/release-tool $*
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if test -z $PYTHONBIN; then
|
||||||
|
PYTHONBIN=$(which python3)
|
||||||
|
if test -z $PYTHONBIN; then
|
||||||
|
PYTHONBIN=$(which python)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION=$($PYTHONBIN -c "import sys; print('{}.{}'.format(*sys.version_info[0:2]))")
|
||||||
|
if test $(echo $VERSION | cut -d. -f1) -lt 3; then
|
||||||
|
echo "Python 3.3 or above is required"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $(echo $VERSION | cut -d. -f2) -lt 3; then
|
||||||
|
echo "Python 3.3 or above is required"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$PYTHONBIN -m venv ./.release-venv
|
||||||
|
|
||||||
|
VENVBINS=./.release-venv/bin
|
||||||
|
|
||||||
|
$VENVBINS/pip install -U Jinja2==2.10 \
|
||||||
|
PyGithub==1.39 \
|
||||||
|
pypandoc==1.4 \
|
||||||
|
GitPython==2.1.9 \
|
||||||
|
requests==2.18.4 \
|
||||||
|
twine==1.11.0
|
||||||
|
|
||||||
|
$VENVBINS/python setup.py develop
|
Loading…
Reference in New Issue