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