bpo/submit.py: require and pass BPO_JOB_{ID,NAME}

Let's send both to to the bpo server with each request. This is needed
to handle failing jobs (we need to know which job exactly is failing).

Note that this is not directly using a sourcehut specific environment
variable, because with bpo it is also possible to choose a "local"
job service for testing (manual and testsuite). The local job service
will just generate a random number as job id and place that in this
variable.
This commit is contained in:
Oliver Smith 2019-10-04 18:10:43 +02:00
parent 90d3deb7b4
commit a328a64a80
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -12,6 +12,8 @@ for key in ["BPO_API_ENDPOINT",
"BPO_API_HOST",
"BPO_ARCH",
"BPO_BRANCH",
"BPO_JOB_ID",
"BPO_JOB_NAME",
"BPO_TOKEN_FILE",
"BPO_PAYLOAD_FILES", # one file per line
"BPO_PAYLOAD_IS_JSON", # set to "1" to enable
@ -42,6 +44,8 @@ is_json = (os.environ["BPO_PAYLOAD_IS_JSON"] == "1")
# Prepare HTTP headers
headers = {"X-BPO-Arch": os.environ["BPO_ARCH"],
"X-BPO-Branch": os.environ["BPO_BRANCH"],
"X-BPO-Job-Id": os.environ["BPO_JOB_ID"],
"X-BPO-Job-Name": os.environ["BPO_JOB_NAME"],
"X-BPO-Token": token,
"X-BPO-Pkgname": os.environ["BPO_PKGNAME"],
"X-BPO-Version": os.environ["BPO_VERSION"]}