refs TG-2: add test Jenkins
This commit is contained in:
Generated
+1
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
|
|||||||
Vendored
+40
@@ -23,4 +23,44 @@ environment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
withCredentials([string(credentialsId: 'TAIGA_TOKEN', variable: 'TAIGA_TOKEN')]) {
|
||||||
|
sh '''
|
||||||
|
set -e
|
||||||
|
|
||||||
|
REF=$(git log -1 --pretty=%B | grep -oE 'TG-[0-9]+' | head -1 | cut -d- -f2)
|
||||||
|
|
||||||
|
if [ -z "$REF" ]; then
|
||||||
|
echo "No TG-* reference found"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
STATUS="${currentBuild.currentResult}"
|
||||||
|
COMMENT="Jenkins build #${BUILD_NUMBER}: ${STATUS}\\n${BUILD_URL}"
|
||||||
|
|
||||||
|
ISSUE_JSON=$(curl -s \
|
||||||
|
-H "Authorization: Bearer ${TAIGA_TOKEN}" \
|
||||||
|
"https://taiga.grigowashere.ru/api/v1/issues/by_ref?project=2&ref=${REF}")
|
||||||
|
|
||||||
|
ISSUE_ID=$(echo "$ISSUE_JSON" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
|
||||||
|
VERSION=$(echo "$ISSUE_JSON" | python3 -c 'import sys,json; print(json.load(sys.stdin)["version"])')
|
||||||
|
|
||||||
|
python3 - <<PY > /tmp/taiga-comment.json
|
||||||
|
import json
|
||||||
|
comment = """${COMMENT}"""
|
||||||
|
print(json.dumps({"comment": comment, "version": int("${VERSION}")}))
|
||||||
|
PY
|
||||||
|
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: Bearer ${TAIGA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data @/tmp/taiga-comment.json \
|
||||||
|
"https://taiga.grigowashere.ru/api/v1/issues/${ISSUE_ID}/comments"
|
||||||
|
|
||||||
|
echo "Commented Taiga TG-${REF}"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user