refs TG-2: test Jenkins comment
This commit is contained in:
Vendored
+7
-19
@@ -32,8 +32,8 @@ pipeline {
|
||||
def result = currentBuild.currentResult ?: 'UNKNOWN'
|
||||
|
||||
withCredentials([string(credentialsId: 'TAIGA_TOKEN', variable: 'TAIGA_TOKEN')]) {
|
||||
sh """
|
||||
set -e
|
||||
sh(returnStatus: true, script: """
|
||||
set +e
|
||||
|
||||
REF=\$(git log -1 --pretty=%B | grep -oE 'TG-[0-9]+' | head -1 | cut -d- -f2 || true)
|
||||
|
||||
@@ -67,7 +67,8 @@ def get_json(path):
|
||||
try:
|
||||
with urllib.request.urlopen(req) as r:
|
||||
return json.loads(r.read().decode("utf-8"))
|
||||
except urllib.error.HTTPError:
|
||||
except Exception as e:
|
||||
print(f"Taiga lookup warning: {e}")
|
||||
return None
|
||||
|
||||
targets = [
|
||||
@@ -111,24 +112,11 @@ req = urllib.request.Request(
|
||||
try:
|
||||
with urllib.request.urlopen(req) as r:
|
||||
print(f"Commented Taiga TG-{ref} ({label}), HTTP {r.status}")
|
||||
except urllib.error.HTTPError as e:
|
||||
body = e.read().decode("utf-8", errors="replace")
|
||||
print(f"Taiga comment failed: HTTP {e.code}")
|
||||
print(body)
|
||||
except Exception as e:
|
||||
print(f"Taiga comment warning: {e}")
|
||||
raise SystemExit(0)
|
||||
|
||||
url = f"{taiga_url}/api/v1/{endpoint}/{data['id']}/comments"
|
||||
req = urllib.request.Request(
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
method="POST",
|
||||
)
|
||||
|
||||
with urllib.request.urlopen(req) as r:
|
||||
print(f"Commented Taiga TG-{ref} ({label}), HTTP {r.status}")
|
||||
PY
|
||||
""".stripIndent()
|
||||
""".stripIndent())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user