Skip to content

Commit

Permalink
Add --keep-build-tags flag; can help prevent race conditions if concu…
Browse files Browse the repository at this point in the history
…rrent builds are running
  • Loading branch information
avirshup committed Nov 8, 2017
1 parent 5b93234 commit 65c6cf7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dockermake/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def make_arg_parser():
'multiple image layers by passing --bust-cache multiple times.')
ca.add_argument('--clear-copy-cache', '--clear-cache', action='store_true',
help="Remove docker-make's cache of files for `copy-from`.")
ca.add_argument('--keep-build-tags', action='store_true',
help="Don't untag intermediate build containers when build is complete")

rt = parser.add_argument_group('Repositories and tags')
rt.add_argument('--repository', '-r', '-u',
Expand Down
3 changes: 2 additions & 1 deletion dockermake/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def build_targets(args, defs, targets):
b.build(client,
nobuild=args.no_build,
usecache=not args.no_cache,
pull=args.pull)
pull=args.pull,
keepbuildtags=args.keep_build_tags)
if not args.no_build:
print(' docker-make built:', b.targetname)

Expand Down
10 changes: 10 additions & 0 deletions test/data/twostep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
first:
FROM: python:3.6-slim
build: |
RUN echo 'test' > /opt/test
target-twostep:
requires:
- first
build: |
RUN echo 'test2' > /opt/test2
7 changes: 7 additions & 0 deletions test/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,10 @@ def _check_files(img, **present):
assert_file_content(img, record['path'], record['content'])


twostep = creates_images('target-twostep',
'dmkbuild_target-twostep_2',
'dmkbuild_target-twostep_1')
def test_keep_build_tags(twostep, docker_client):
run_docker_make('-f data/twostep.yml target-twostep --keep-build-tags')
docker_client.images.get('dmkbuild_target-twostep_1')
docker_client.images.get('dmkbuild_target-twostep_2')

0 comments on commit 65c6cf7

Please sign in to comment.