@@ -43,35 +43,37 @@ def run_build(logfile='/tmp/.shub-log'):
4343
4444 '''run_build will generate the Singularity build from a spec_file from a repo_url.
4545
46- If no arguments are required, the metadata api is queried for the values.
47-
48- :param build_dir: directory to do the build in. If not specified, will use temporary.
49- :param spec_file: the spec_file name to use, assumed to be in git repo
50- :param repo_url: the url to download the repo from
51- :param repo_id: the repo_id to uniquely identify the repo (in case name changes)
52- :param commit: the commit to checkout. If none provided, will use most recent.
53- :param bucket_name: the name of the bucket to send files to
54- :param verbose: print out extra details as we go (default True)
55- :param token: a token to send back to the server to authenticate the collection
56- :param secret: a secret to match to the correct container
57- :param response_url: the build url to send the response back to. Should also come
58- from metadata. If not specified, no response is sent
59- :param branch: the branch to checkout for the build.
60-
61- :: note: this function is currently configured to work with Google Compute
62- Engine metadata api, and should (will) be customized if needed to work elsewhere
46+ If no arguments are required, the metadata api is queried for the values.
47+
48+ Parameters
49+ ==========
50+ build_dir: directory to do the build in. If not specified, will use temporary.
51+ spec_file: the spec_file name to use, assumed to be in git repo
52+ repo_url: the url to download the repo from
53+ repo_id: the repo_id to uniquely identify the repo (in case name changes)
54+ commit: the commit to checkout. If none provided, will use most recent.
55+ bucket_name: the name of the bucket to send files to
56+ verbose: print out extra details as we go (default True)
57+ token: a token to send back to the server to authenticate the collection
58+ secret: a secret to match to the correct container
59+ response_url: the build url to send the response back to. Should also come
60+ from metadata. If not specified, no response is sent
61+ branch: the branch to checkout for the build.
62+
63+ :: note: this function is currently configured to work with Google Compute
64+ Engine metadata api, and should (will) be customized if needed to work elsewhere
6365
6466 '''
6567
6668 # If we are building the image, this will not be set
6769 go = get_build_metadata (key = 'dobuild' )
68- if go == None :
70+ if go is None :
6971 sys .exit (0 )
7072
7173 # If the user wants debug, this will be set
7274 debug = True
7375 enable_debug = get_build_metadata (key = 'debug' )
74- if enable_debug == None :
76+ if enable_debug is None :
7577 debug = False
7678 bot .info ('DEBUG %s' % debug )
7779
@@ -117,7 +119,7 @@ def run_build(logfile='/tmp/.shub-log'):
117119
118120 # Upload image package files to Google Storage
119121 if os .path .exists (finished_image ):
120- bot .info ("%s successfully built" % finished_image )
122+ bot .info ("%s successfully built" % finished_image )
121123 dest_dir = tempfile .mkdtemp (prefix = 'build' )
122124
123125 # The path to the images on google drive will be the github url/commit folder
@@ -175,10 +177,11 @@ def run_build(logfile='/tmp/.shub-log'):
175177
176178def finish_build (verbose = True ):
177179 '''finish_build will finish the build by way of sending the log to the same bucket.
178- the params are loaded from the previous function that built the image, expected in
179- $HOME/params.pkl
180- :: note: this function is currently configured to work with Google Compute
181- Engine metadata api, and should (will) be customized if needed to work elsewhere
180+ the params are loaded from the previous function that built the image, expected in
181+ $HOME/params.pkl
182+
183+ :: note: this function is currently configured to work with Google Compute
184+ Engine metadata api, and should (will) be customized if needed to work elsewhere
182185 '''
183186 # If we are building the image, this will not be set
184187 go = get_build_metadata (key = 'dobuild' )
@@ -218,7 +221,10 @@ def finish_build(verbose=True):
218221
219222def get_build_metadata (key ):
220223 '''get_build_metadata will return metadata about an instance from within it.
221- :param key: the key to look up
224+
225+ Parameters
226+ ==========
227+ key: the key to look up
222228 '''
223229 headers = {"Metadata-Flavor" :"Google" }
224230 url = "http://metadata.google.internal/computeMetadata/v1/instance/attributes/%s" % key
0 commit comments