@@ -160,16 +160,16 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,b
160160 {'key' : 'branch' , 'value' : branch , 'return_text' : True },
161161 {'key' : 'spec_file' , 'value' : spec_file , 'return_text' : True }]
162162
163- # Default spec file is Singularity
164- if spec_file == None :
165- spec_file = "Singularity"
166-
167- if bucket_name == None :
168- bucket_name = "singularity-hub"
169-
170163 # Obtain values from build
171164 params = get_build_params (metadata )
172165
166+ # Default spec file is Singularity
167+ if params ['spec_file' ] == None :
168+ params ['spec_file' ] = "Singularity"
169+
170+ if params ['bucket_name' ] == None :
171+ params ['bucket_name' ] = "singularity-hub"
172+
173173 # Download the repo and image
174174 repo = download_repo (repo_url = params ['repo_url' ],
175175 destination = build_dir )
@@ -189,16 +189,16 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,b
189189 bot .logger .warning ("commit not specified, setting to current %s" , params ['commit' ])
190190
191191
192- if os .path .exists (spec_file ):
193- bot .logger .info ("Found spec file %s in repository" ,spec_file )
192+ if os .path .exists (params [ ' spec_file' ] ):
193+ bot .logger .info ("Found spec file %s in repository" ,params [ ' spec_file' ] )
194194
195195 # If size is None, get from image + 50 padding
196196 if params ['size' ] == None :
197197 bot .logger .info ("Size not detected for build. Will estimate with 200MB padding." )
198- params ['size' ] = estimate_image_size (spec_file = spec_file ,
198+ params ['size' ] = estimate_image_size (spec_file = os . path . abspath ( params [ ' spec_file' ]) ,
199199 sudopw = '' )
200200
201- image = build_from_spec (spec_file = spec_file , # default will package the image
201+ image = build_from_spec (spec_file = params [ ' spec_file' ] , # default will package the image
202202 size = params ['size' ],
203203 sudopw = '' , # with root should not need sudo
204204 output_folder = build_dir ,
@@ -210,7 +210,7 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,b
210210
211211 # Package the image metadata (files, folders, etc)
212212 image_package = package (image_path = image ,
213- spec_path = spec_file ,
213+ spec_path = params [ ' spec_file' ] ,
214214 output_folder = build_dir ,
215215 sudopw = '' ,
216216 remove_image = True ,
@@ -276,7 +276,7 @@ def run_build(build_dir=None,spec_file=None,repo_url=None,token=None,size=None,b
276276 else :
277277 # Tell the user what is actually there
278278 present_files = glob ("*" )
279- bot .logger .error ("Build file %s not found in repository" ,spec_file )
279+ bot .logger .error ("Build file %s not found in repository" ,params [ ' spec_file' ] )
280280 bot .logger .info ("Found files are %s" ,"\n " .join (present_files ))
281281
282282
0 commit comments