Skip to content

Commit 37e1814

Browse files
committed
fixing bug that Singularity recipe isnt uploaded to storage
1 parent c4b50ac commit 37e1814

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

singularity/build/google.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def delete_object(storage_service,bucket_name,object_name):
109109

110110

111111
@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)
112-
def upload_file(storage_service,bucket,bucket_path,file_name,verbose=True):
112+
def upload_file(storage_service, bucket,bucket_path, file_name, verbose=True):
113113
'''get_folder will return the folder with folder_name, and if create=True,
114114
will create it if not found. If folder is found or created, the metadata is
115115
returned, otherwise None is returned
@@ -119,7 +119,7 @@ def upload_file(storage_service,bucket,bucket_path,file_name,verbose=True):
119119
:param bucket_path: the path to upload to
120120
'''
121121
# Set up path on bucket
122-
upload_path = "%s/%s" %(bucket['id'],bucket_path)
122+
upload_path = "%s/%s" %(bucket['id'], bucket_path)
123123
if upload_path[-1] != '/':
124124
upload_path = "%s/" %(upload_path)
125125
upload_path = "%s%s" %(upload_path,os.path.basename(file_name))
@@ -237,6 +237,7 @@ def run_build(logfile='/tmp/.shub-log'):
237237

238238
# Output includes:
239239
finished_image = output['image']
240+
finished_recipe = '/%s/Singularity' %build_dir
240241
metadata = output['metadata']
241242
params = output['params']
242243

@@ -251,13 +252,17 @@ def run_build(logfile='/tmp/.shub-log'):
251252
# commits are no longer unique
252253
# storage is by commit
253254

254-
build_files = [finished_image]
255+
# We want to name the recipe file Singularity, always
256+
shutil.move(params['spec_file'], finished_recipe)
257+
258+
build_files = [finished_image, finished_recipe]
259+
255260
bot.info("Sending image to storage:")
256261
bot.info('\n'.join(build_files))
257262

258263
# Start the storage service, retrieve the bucket
259264
storage_service = get_google_service() # default is "storage" "v1"
260-
bucket = get_bucket(storage_service,params["bucket_name"])
265+
bucket = get_bucket(storage_service, params["bucket_name"])
261266

262267
# For each file, upload to storage
263268
files = []

0 commit comments

Comments
 (0)