@@ -1315,12 +1315,16 @@ def pulp_upload_file_packages_by_folder(c, source):
13151315 for root , dirs , files in os .walk (source ):
13161316 for path in files :
13171317 file = os .path .join (root , path ).split ('/' ,1 )[1 ]
1318- # file repositories have been configured with autopublish set to true
1319- cmd = f'file content upload --repository { repo_name } --file { source } /{ file } --relative-path { file } '
1318+ # First upload file as an artifact
1319+ cmd = f"artifact upload --file { source } /{ file } --chunk-size 500MB | jq -r '.sha256' | tr -d '\n '"
1320+ artifact_sha256 = run_pulp_cmd (c , cmd )
1321+ # Then create the content of type file
1322+ cmd = f'file content create --repository { repo_name } --relative-path { file } --sha256 { artifact_sha256 } '
13201323 run_pulp_cmd (c , cmd )
13211324
13221325@task
13231326def pulp_create_rpm_publication (c , product , list_os_rel , list_arch ):
1327+ max_push_attempts = 3
13241328 rpm_distros = ["centos" , "el" ]
13251329 for os_rel in json .loads (list_os_rel ):
13261330 if not "el-" in os_rel :
@@ -1329,16 +1333,37 @@ def pulp_create_rpm_publication(c, product, list_os_rel, list_arch):
13291333 for arch in json .loads (list_arch ):
13301334 for distro in rpm_distros :
13311335 repo_name = f"repo-{ distro } -{ release } -{ arch } -{ product } "
1332- cmd = f'rpm publication create --repository { repo_name } --checksum-type sha256'
1333- run_pulp_cmd (c , cmd )
1336+ attempts = 0
1337+ while attempts < max_push_attempts :
1338+ try :
1339+ cmd = f'rpm publication create --repository { repo_name } --checksum-type sha256'
1340+ run_pulp_cmd (c , cmd )
1341+ break
1342+ except UnexpectedExit :
1343+ attempts += 1
1344+ time .sleep (5 )
1345+ print (f'Next attempt: { attempts } ' )
1346+ if attempts == max_push_attempts :
1347+ raise Failure (f'Error creating rpm publication' )
13341348
13351349@task
13361350def pulp_create_deb_publication (c ):
1351+ max_push_attempts = 3
13371352 deb_distros = ["debian" , "ubuntu" ]
13381353 for distro in deb_distros :
13391354 repo_name = f"repo-{ distro } "
1340- cmd = f'deb publication create --repository { repo_name } '
1341- run_pulp_cmd (c , cmd )
1355+ attempts = 0
1356+ while attempts < max_push_attempts :
1357+ try :
1358+ cmd = f'deb publication create --repository { repo_name } '
1359+ run_pulp_cmd (c , cmd )
1360+ break
1361+ except UnexpectedExit :
1362+ attempts += 1
1363+ time .sleep (5 )
1364+ print (f'Next attempt: { attempts } ' )
1365+ if attempts == max_push_attempts :
1366+ raise Failure (f'Error creating deb publication' )
13421367
13431368@task
13441369def pulp_upload_rpm_packages_by_folder (c , source , product ):
@@ -1393,7 +1418,7 @@ def pulp_upload_deb_packages_by_folder(c, source, product):
13931418 for root , dirs , files in os .walk (source ):
13941419 for path in files :
13951420 file = os .path .join (root , path ).split ('/' ,1 )[1 ]
1396- cmd = f"artifact upload --file { source } /{ file } | jq -r '.pulp_href' | tr -d '\n '"
1421+ cmd = f"artifact upload --file { source } /{ file } --chunk-size 500MB | jq -r '.pulp_href' | tr -d '\n '"
13971422 artifact_href = run_pulp_cmd (c , cmd )
13981423
13991424 package_data = {
0 commit comments