mirror of
https://github.com/docker/compose.git
synced 2025-07-28 16:14:06 +02:00
Merge branch 'master' into 1.27.x
This commit is contained in:
commit
687ba365cd
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -3,4 +3,4 @@
|
||||
#
|
||||
# KEEP THIS FILE SORTED. Order is important. Last match takes precedence.
|
||||
|
||||
* @ndeloof @rumpl @ulyssessouza
|
||||
* @aiordache @ndeloof @rumpl @ulyssessouza
|
||||
|
@ -11,6 +11,7 @@
|
||||
[Org]
|
||||
[Org."Core maintainers"]
|
||||
people = [
|
||||
"aiordache",
|
||||
"ndeloof",
|
||||
"rumpl",
|
||||
"ulyssessouza",
|
||||
@ -53,6 +54,11 @@
|
||||
Email = "aanand.prasad@gmail.com"
|
||||
GitHub = "aanand"
|
||||
|
||||
[people.aiordache]
|
||||
Name = "Anca Iordache"
|
||||
Email = "anca.iordache@docker.com"
|
||||
GitHub = "aiordache"
|
||||
|
||||
[people.bfirsh]
|
||||
Name = "Ben Firshman"
|
||||
Email = "ben@firshman.co.uk"
|
||||
|
@ -73,13 +73,16 @@ def main():
|
||||
log.error(e.msg)
|
||||
sys.exit(1)
|
||||
except BuildError as e:
|
||||
log.error("Service '{}' failed to build: {}".format(e.service.name, e.reason))
|
||||
reason = ""
|
||||
if e.reason:
|
||||
reason = " : " + e.reason
|
||||
log.error("Service '{}' failed to build{}".format(e.service.name, reason))
|
||||
sys.exit(1)
|
||||
except StreamOutputError as e:
|
||||
log.error(e)
|
||||
sys.exit(1)
|
||||
except NeedsBuildError as e:
|
||||
log.error("Service '%s' needs to be built, but --no-build was passed." % e.service.name)
|
||||
log.error("Service '{}' needs to be built, but --no-build was passed.".format(e.service.name))
|
||||
sys.exit(1)
|
||||
except NoSuchCommand as e:
|
||||
commands = "\n".join(parse_doc_section("commands:", getdoc(e.supercommand)))
|
||||
@ -1436,6 +1439,7 @@ def call_docker(args, dockeropts, environment):
|
||||
key = dockeropts.get('--tlskey')
|
||||
verify = dockeropts.get('--tlsverify')
|
||||
host = dockeropts.get('--host')
|
||||
context = dockeropts.get('--context')
|
||||
tls_options = []
|
||||
if tls:
|
||||
tls_options.append('--tls')
|
||||
@ -1451,6 +1455,10 @@ def call_docker(args, dockeropts, environment):
|
||||
tls_options.extend(
|
||||
['--host', re.sub(r'^https?://', 'tcp://', host.lstrip('='))]
|
||||
)
|
||||
if context:
|
||||
tls_options.extend(
|
||||
['--context', context]
|
||||
)
|
||||
|
||||
args = [executable_path] + tls_options + args
|
||||
log.debug(" ".join(map(pipes.quote, args)))
|
||||
|
@ -1856,7 +1856,8 @@ class _CLIBuilder:
|
||||
|
||||
magic_word = "Successfully built "
|
||||
appear = False
|
||||
with subprocess.Popen(args, stdout=subprocess.PIPE, universal_newlines=True) as p:
|
||||
with subprocess.Popen(args, stdout=subprocess.PIPE,
|
||||
universal_newlines=True) as p:
|
||||
while True:
|
||||
line = p.stdout.readline()
|
||||
if not line:
|
||||
@ -1865,6 +1866,10 @@ class _CLIBuilder:
|
||||
appear = True
|
||||
yield json.dumps({"stream": line})
|
||||
|
||||
p.communicate()
|
||||
if p.returncode != 0:
|
||||
raise StreamOutputError()
|
||||
|
||||
with open(iidfile) as f:
|
||||
line = f.readline()
|
||||
image_id = line.split(":")[1].strip()
|
||||
|
@ -6,4 +6,4 @@ gitpython==3.1.7
|
||||
mock==3.0.5
|
||||
pytest==6.0.1; python_version >= '3.5'
|
||||
pytest==4.6.5; python_version < '3.5'
|
||||
pytest-cov==2.10.0
|
||||
pytest-cov==2.10.1
|
||||
|
@ -1,6 +1,6 @@
|
||||
altgraph==0.17
|
||||
appdirs==1.4.4
|
||||
attrs==19.3.0
|
||||
attrs==20.1.0
|
||||
bcrypt==3.1.7
|
||||
cffi==1.14.1
|
||||
cryptography==3.0
|
||||
|
2
setup.py
2
setup.py
@ -32,7 +32,7 @@ install_requires = [
|
||||
'texttable >= 0.9.0, < 2',
|
||||
'websocket-client >= 0.32.0, < 1',
|
||||
'distro >= 1.5.0, < 2',
|
||||
'docker[ssh] >= 4.2.2, < 5',
|
||||
'docker[ssh] >= 4.3.1, < 5',
|
||||
'dockerpty >= 0.4.1, < 1',
|
||||
'jsonschema >= 2.5.1, < 4',
|
||||
'python-dotenv >= 0.13.0, < 1',
|
||||
|
@ -36,6 +36,7 @@ from compose.parallel import ParallelStreamWriter
|
||||
from compose.project import OneOffFilter
|
||||
from compose.project import Project
|
||||
from compose.service import BuildAction
|
||||
from compose.service import BuildError
|
||||
from compose.service import ConvergencePlan
|
||||
from compose.service import ConvergenceStrategy
|
||||
from compose.service import IpcMode
|
||||
@ -987,6 +988,23 @@ class ServiceTest(DockerClientTestCase):
|
||||
image = self.client.inspect_image('composetest_web')
|
||||
assert image['Config']['Labels']['com.docker.compose.test']
|
||||
|
||||
def test_build_cli_with_build_error(self):
|
||||
base_dir = tempfile.mkdtemp()
|
||||
self.addCleanup(shutil.rmtree, base_dir)
|
||||
|
||||
with open(os.path.join(base_dir, 'Dockerfile'), 'w') as f:
|
||||
f.write('\n'.join([
|
||||
"FROM busybox",
|
||||
"RUN exit 2",
|
||||
]))
|
||||
service = self.create_service('web',
|
||||
build={
|
||||
'context': base_dir,
|
||||
'labels': {'com.docker.compose.test': 'true'}},
|
||||
)
|
||||
with pytest.raises(BuildError):
|
||||
service.build(cli=True)
|
||||
|
||||
def test_up_build_cli(self):
|
||||
base_dir = tempfile.mkdtemp()
|
||||
self.addCleanup(shutil.rmtree, base_dir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user