mirror of https://github.com/docker/compose.git
Add the git sha to version output
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
3b6cc7a7bb
commit
bea2072b95
|
@ -8,3 +8,4 @@
|
|||
/docs/_site
|
||||
/venv
|
||||
README.rst
|
||||
compose/GITSHA
|
||||
|
|
|
@ -8,6 +8,6 @@ COPY requirements.txt /code/requirements.txt
|
|||
RUN pip install -r /code/requirements.txt
|
||||
|
||||
ADD dist/docker-compose-release.tar.gz /code/docker-compose
|
||||
RUN pip install /code/docker-compose/docker-compose-*
|
||||
RUN pip install --no-deps /code/docker-compose/docker-compose-*
|
||||
|
||||
ENTRYPOINT ["/usr/bin/docker-compose"]
|
||||
|
|
|
@ -7,6 +7,7 @@ include *.md
|
|||
exclude README.md
|
||||
include README.rst
|
||||
include compose/config/*.json
|
||||
include compose/GITSHA
|
||||
recursive-include contrib/completion *
|
||||
recursive-include tests *
|
||||
global-exclude *.pyc
|
||||
|
|
|
@ -12,12 +12,12 @@ from requests.exceptions import SSLError
|
|||
|
||||
from . import errors
|
||||
from . import verbose_proxy
|
||||
from .. import __version__
|
||||
from .. import config
|
||||
from ..project import Project
|
||||
from ..service import ConfigError
|
||||
from .docker_client import docker_client
|
||||
from .utils import call_silently
|
||||
from .utils import get_version_info
|
||||
from .utils import is_mac
|
||||
from .utils import is_ubuntu
|
||||
|
||||
|
@ -71,7 +71,7 @@ def get_client(verbose=False, version=None):
|
|||
client = docker_client(version=version)
|
||||
if verbose:
|
||||
version_info = six.iteritems(client.version())
|
||||
log.info("Compose version %s", __version__)
|
||||
log.info(get_version_info('full'))
|
||||
log.info("Docker base_url: %s", client.base_url)
|
||||
log.info("Docker version: %s",
|
||||
", ".join("%s=%s" % item for item in version_info))
|
||||
|
|
|
@ -7,10 +7,10 @@ import platform
|
|||
import ssl
|
||||
import subprocess
|
||||
|
||||
from docker import version as docker_py_version
|
||||
import docker
|
||||
from six.moves import input
|
||||
|
||||
from .. import __version__
|
||||
import compose
|
||||
|
||||
|
||||
def yesno(prompt, default=None):
|
||||
|
@ -57,13 +57,32 @@ def is_ubuntu():
|
|||
|
||||
|
||||
def get_version_info(scope):
|
||||
versioninfo = 'docker-compose version: %s' % __version__
|
||||
versioninfo = 'docker-compose version {}, build {}'.format(
|
||||
compose.__version__,
|
||||
get_build_version())
|
||||
|
||||
if scope == 'compose':
|
||||
return versioninfo
|
||||
elif scope == 'full':
|
||||
return versioninfo + '\n' \
|
||||
+ "docker-py version: %s\n" % docker_py_version \
|
||||
+ "%s version: %s\n" % (platform.python_implementation(), platform.python_version()) \
|
||||
+ "OpenSSL version: %s" % ssl.OPENSSL_VERSION
|
||||
else:
|
||||
raise RuntimeError('passed unallowed value to `cli.utils.get_version_info`')
|
||||
if scope == 'full':
|
||||
return (
|
||||
"{}\n"
|
||||
"docker-py version: {}\n"
|
||||
"{} version: {}\n"
|
||||
"OpenSSL version: {}"
|
||||
).format(
|
||||
versioninfo,
|
||||
docker.version,
|
||||
platform.python_implementation(),
|
||||
platform.python_version(),
|
||||
ssl.OPENSSL_VERSION)
|
||||
|
||||
raise ValueError("{} is not a valid version scope".format(scope))
|
||||
|
||||
|
||||
def get_build_version():
|
||||
filename = os.path.join(os.path.dirname(compose.__file__), 'GITSHA')
|
||||
if not os.path.exists(filename):
|
||||
return 'unknown'
|
||||
|
||||
with open(filename) as fh:
|
||||
return fh.read().strip()
|
||||
|
|
|
@ -9,18 +9,32 @@ a = Analysis(['bin/docker-compose'],
|
|||
runtime_hooks=None,
|
||||
cipher=block_cipher)
|
||||
|
||||
pyz = PYZ(a.pure,
|
||||
cipher=block_cipher)
|
||||
pyz = PYZ(a.pure, cipher=block_cipher)
|
||||
|
||||
exe = EXE(pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[('compose/config/fields_schema.json', 'compose/config/fields_schema.json', 'DATA')],
|
||||
[('compose/config/service_schema.json', 'compose/config/service_schema.json', 'DATA')],
|
||||
[
|
||||
(
|
||||
'compose/config/fields_schema.json',
|
||||
'compose/config/fields_schema.json',
|
||||
'DATA'
|
||||
),
|
||||
(
|
||||
'compose/config/service_schema.json',
|
||||
'compose/config/service_schema.json',
|
||||
'DATA'
|
||||
),
|
||||
(
|
||||
'compose/GITSHA',
|
||||
'compose/GITSHA',
|
||||
'DATA'
|
||||
)
|
||||
],
|
||||
name='docker-compose',
|
||||
debug=False,
|
||||
strip=None,
|
||||
upx=True,
|
||||
console=True )
|
||||
console=True)
|
||||
|
|
|
@ -10,6 +10,7 @@ fi
|
|||
TAG=$1
|
||||
VERSION="$(python setup.py --version)"
|
||||
|
||||
./script/write-git-sha
|
||||
python setup.py sdist
|
||||
cp dist/docker-compose-$VERSION.tar.gz dist/docker-compose-release.tar.gz
|
||||
docker build -t docker/compose:$TAG -f Dockerfile.run .
|
||||
|
|
|
@ -9,4 +9,5 @@ docker build -t "$TAG" . | tail -n 200
|
|||
docker run \
|
||||
--rm --entrypoint="script/build-linux-inner" \
|
||||
-v $(pwd)/dist:/code/dist \
|
||||
-v $(pwd)/.git:/code/.git \
|
||||
"$TAG"
|
||||
|
|
|
@ -9,6 +9,7 @@ mkdir -p `pwd`/dist
|
|||
chmod 777 `pwd`/dist
|
||||
|
||||
$VENV/bin/pip install -q -r requirements-build.txt
|
||||
./script/write-git-sha
|
||||
su -c "$VENV/bin/pyinstaller docker-compose.spec" user
|
||||
mv dist/docker-compose $TARGET
|
||||
$TARGET version
|
||||
|
|
|
@ -9,6 +9,7 @@ virtualenv -p /usr/local/bin/python venv
|
|||
venv/bin/pip install -r requirements.txt
|
||||
venv/bin/pip install -r requirements-build.txt
|
||||
venv/bin/pip install --no-deps .
|
||||
./script/write-git-sha
|
||||
venv/bin/pyinstaller docker-compose.spec
|
||||
mv dist/docker-compose dist/docker-compose-Darwin-x86_64
|
||||
dist/docker-compose-Darwin-x86_64 version
|
||||
|
|
|
@ -47,6 +47,8 @@ virtualenv .\venv
|
|||
.\venv\Scripts\pip install --no-deps .
|
||||
.\venv\Scripts\pip install --allow-external pyinstaller -r requirements-build.txt
|
||||
|
||||
git rev-parse --short HEAD | out-file -encoding ASCII compose\GITSHA
|
||||
|
||||
# Build binary
|
||||
# pyinstaller has lots of warnings, so we need to run with ErrorAction = Continue
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
|
|
@ -57,6 +57,7 @@ docker push docker/compose:$VERSION
|
|||
echo "Uploading sdist to pypi"
|
||||
pandoc -f markdown -t rst README.md -o README.rst
|
||||
sed -i -e 's/logo.png?raw=true/https:\/\/github.com\/docker\/compose\/raw\/master\/logo.png?raw=true/' README.rst
|
||||
./script/write-git-sha
|
||||
python setup.py sdist
|
||||
if [ "$(command -v twine 2> /dev/null)" ]; then
|
||||
twine upload ./dist/docker-compose-${VERSION}.tar.gz
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Write the current commit sha to the file GITSHA. This file is included in
|
||||
# packaging so that `docker-compose version` can include the git sha.
|
||||
#
|
||||
set -e
|
||||
git rev-parse --short HEAD > compose/GITSHA
|
Loading…
Reference in New Issue