Skip to content
This repository was archived by the owner on May 4, 2018. It is now read-only.

Commit 3238421

Browse files
author
Jonathan Dowland
authored
Merge pull request #115 from goldmann/dist-git-bugfix
Dist git sync fixes
2 parents 9309102 + f85b265 commit 3238421

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

dogen/generator.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,11 @@ def handle_sources(self):
338338
if algorithms:
339339
for algorithm in algorithms:
340340
self.check_sum(filename, source[algorithm], algorithm)
341-
self.cfg['artifacts'][target] = "%s:%s" % (algorithms[0], source[algorithms[0]])
342-
else:
343-
self.cfg['artifacts'][target] = None
341+
342+
if algorithms:
343+
self.cfg['artifacts'][target] = "%s:%s" % (algorithms[0], source[algorithms[0]])
344+
else:
345+
self.cfg['artifacts'][target] = None
344346

345347
def check_sum(self, filename, checksum, algorithm):
346348
self.log.info("Checking '%s' %s hash..." % (os.path.basename(filename), algorithm))

dogen/plugins/dist_git.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def prepare(self, cfg):
2727
if not self.args.dist_git_enable:
2828
return
2929
self.git.prepare()
30-
self.git.clean()
30+
self.git.clean_scripts()
3131

3232
def after_sources(self, files):
3333
if not self.args.dist_git_enable:
@@ -85,7 +85,7 @@ def update(self):
8585
self.update_value("JBOSS_IMAGE_RELEASE", new_release)
8686
self.update_dist_git(new_version, new_release)
8787

88-
def clean(self):
88+
def clean_scripts(self):
8989
""" Removes the scripts directory from staging and disk """
9090
shutil.rmtree(os.path.join(self.path, "scripts"), ignore_errors=True)
9191

@@ -177,8 +177,12 @@ def update_lookaside_cache(self, artifacts):
177177

178178
def update_dist_git(self, version, release):
179179
with Chdir(self.path):
180-
# Add everything
181-
subprocess.check_call(["git", "add", "."])
180+
# Add new Dockerfile
181+
subprocess.check_call(["git", "add", "Dockerfile"])
182+
183+
# Add the scripts directory if it exists
184+
if os.path.exists(os.path.join(self.path, "scripts")):
185+
subprocess.check_call(["git", "add", "scripts"])
182186

183187
commit_msg = "Sync"
184188

0 commit comments

Comments
 (0)