@@ -135,7 +135,6 @@ def create_snapshot(bucket: str, tag: github.GitTag, workdir: str, parallel: int
135135 LOGGER .warning (f"Skipping snapshot for { tag .name } , cannot determine base branch" )
136136 return False
137137
138- client = s3_create_client ()
139138 if s3_object_exists (bucket , "{tag.name}/v3/layout.json" ):
140139 LOGGER .info (f"Skipping snapshot for { tag .name } as it already exists" )
141140 return True
@@ -164,6 +163,10 @@ def create_snapshot(bucket: str, tag: github.GitTag, workdir: str, parallel: int
164163
165164 stack = j .name .replace ("-generate" , "" )
166165
166+ if s3_object_exists (bucket , "{tag.name}/{stack}/v3/layout.json" ):
167+ LOGGER .info (f"Skipping snapshot for { tag .name } /{ stack } as it already exists" )
168+ continue
169+
167170 # Get the lockfile/concrete hashes to sync to snapshot mirror
168171 job = gl_project .jobs .get (j .id , lazy = True )
169172 artifact_path = f"jobs_scratch_dir/{ stack } /concrete_environment/spack.lock"
@@ -219,6 +222,8 @@ def dryrun_publish(spec, bucket, source, dest, force, gpg_home, workdir):
219222 else :
220223 publish_keys (mirror_url , gnu_pg_home , ref = tag .name )
221224
225+ return True
226+
222227
223228if __name__ == "__main__" :
224229
@@ -255,14 +260,16 @@ def dryrun_publish(spec, bucket, source, dest, force, gpg_home, workdir):
255260 # Iterate all of the project tags and attempt to create a
256261 # snaptshot if it is needed
257262 py_gh_repo = GH .get_repo (args .project )
263+ tempdir = WORKDIR or tempfile .mkdtemp ()
258264 for t in py_gh_repo .get_tags ():
259265 if args .tag and t .name not in args .tag :
260266 LOGGER .debug ("Skipping tag {t.name}" )
261267 continue
262268
263- tempdir = WORKDIR or tempfile .mkdtemp ()
264- if create_snapshot (args .bucket , t , tempdir ):
265- # Now use publish to create the top level mirror if the snapshot exists
266- # Don't re-verify everything, it was already done by create_snapshot
267- publish (args .bucket , t .name , verify = False , workdir = tempdir )
268-
269+ try :
270+ if create_snapshot (args .bucket , t , tempdir ):
271+ # Now use publish to create the top level mirror if the snapshot exists
272+ # Don't re-verify everything, it was already done by create_snapshot
273+ publish (args .bucket , t .name , verify = False , workdir = tempdir )
274+ except Exception as e :
275+ LOGGER .error (f"Failed to create snapshot for { t .name } : { e } " )
0 commit comments