username: NORDIXINFRA_GITHUB_USERNAME
password: NORDIXINFRA_GITHUB_TOKEN
+# wrappers to use for jobs
+- wrapper:
+ name: nordix-gerrit-http-api-token
+ wrappers:
+ - credentials-binding:
+ - username-password-separated:
+ credential-id: nordixinfra-nordix-gerrit-http-api-token
+ username: GERRIT_USER
+ password: GERRIT_API_KEY
+
# timeout wrapper to use for jobs
- wrapper:
name: build-timeout
cd "$WORKSPACE"
onap_gerrit_base='gerrit.onap.org:29418'
+nordix_gerrit_rest='https://gerrit.nordix.org'
echo >&2 "Collecting information about what and how to push towards ONAP"
# The git hash of the commit in the review this job runs on
if [ $push_result -ne 0 ]; then
grep '(no new changes)' push_result.txt
fi
+
+# When a push-upstream job completes successfully.
+# The link to the corresponding upstream gerrit review is posted
+# on the Nordix gerrit using Gerrit API and infra user HTTP API Key.
+if grep -q http push_result.txt; then
+ URL=$(sed -ne 's/.*\(http\S*\).*/\1/p' < push_result.txt)
+ echo "URL: $URL"
+ curl --request 'POST' -H 'Content-Type:application/json' \
+ "${nordix_gerrit_rest}/a/changes/${GERRIT_CHANGE_NUMBER}/revisions/${GERRIT_PATCHSET_NUMBER}/review" \
+ --user "${GERRIT_USER}:${GERRIT_API_KEY}" \
+ --data "{\"message\": \"UPSTRAM URL: ${URL}\"}"
+fi