Tagging 1.14.0-b1
diff --git a/tools/build/onos-upload-artifacts.py b/tools/build/onos-upload-artifacts.py
index 0cd6c3e..074c14d 100755
--- a/tools/build/onos-upload-artifacts.py
+++ b/tools/build/onos-upload-artifacts.py
@@ -20,6 +20,7 @@
import hashlib
import requests, os
import xml.etree.ElementTree, shutil
+import time
SONATYPE_USER=os.environ.get("SONATYPE_USER")
SONATYPE_PASSWORD=os.environ.get("SONATYPE_PASSWORD")
@@ -42,6 +43,8 @@
</promoteRequest>
'''
+CLOSE_RETRY_ATTEMPTS = 12 * 2
+
def hashlib_compute(hash, input_file, output_file):
with open(input_file, 'rb') as f:
for block in iter(lambda: f.read(100000), b''):
@@ -106,6 +109,31 @@
r = requests.post(url, close_request, headers=headers, auth=(SONATYPE_USER, SONATYPE_PASSWORD))
+def wait_for_staging_repo(description, repo_id):
+ base_url = "https://" + destination_repo_url + "/service/local/staging/profiles" + "/" + SONATYPE_PROFILE
+ if repo_id is None:
+ return
+ close_request = CLOSE_REPO_REQUEST_TEMPLATE.replace("%(description)", description).replace("%(repo_id)", repo_id)
+ url = base_url + "/finish"
+ headers = {'Content-Type': 'application/xml'}
+ repo_query_url = "https://oss.sonatype.org/service/local/staging/repository/" + repo_id
+
+ attempt = 1
+ print ("waiting for repo to close...")
+ while True:
+ r = requests.get(repo_query_url, close_request, headers=headers, auth=(SONATYPE_USER, SONATYPE_PASSWORD))
+ root = xml.etree.ElementTree.fromstring(r.text)
+ transitioning = root.find("transitioning").text
+ if transitioning != "true":
+ break
+ if attempt == CLOSE_RETRY_ATTEMPTS:
+ print ("Unable to close repo")
+ sys.exit(1)
+ attempt = attempt + 1
+ time.sleep(5)
+ print ("Repo closed successfully")
+
+
def stage_file(file, repo_id, dest):
filename_in_repo = os.path.dirname(dest) + "/" + os.path.basename(file)
if destination_repo_url is not None:
@@ -188,4 +216,5 @@
dest = s[1]
upload_file(src, dest)
close_staging_repo(repo_id=repo_id, description=description)
+ wait_for_staging_repo(repo_id=repo_id, description=description)
shutil.rmtree(tempdir)