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