diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2021-03-26 12:55:45 +0000 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2021-03-26 12:55:45 +0000 |
commit | 333a87ae923356dc2e43aa511635c2c7f5ecd16d (patch) | |
tree | 71fbc8426af82b9a9ac2f35a01a37db1b0cd3c21 | |
parent | 003acac3ec67492eace409a6d281829185a9129d (diff) |
SPEC-3414: Use the right env variable name
According to which api we sent the metadata, a different token will be used.
Change-Id: I174a3b1ea30452f78390e5205d1c4d15f1bc999b
Bug-AGL: SPEC-3414
Signed-off-by: Corentin LABBE <clabbe@baylibre.com>
-rwxr-xr-x | utils/agl-publish.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/utils/agl-publish.py b/utils/agl-publish.py index b559566..e2e50fc 100755 --- a/utils/agl-publish.py +++ b/utils/agl-publish.py @@ -7,17 +7,6 @@ import os import json import urllib -if not "KCI_PUSH_TOKEN" in os.environ: - print("Missing env variable KCI_PUSH_TOKEN") - ptoken=None -else: - ptoken=os.environ["KCI_PUSH_TOKEN"] -if not "KCI_UPLOAD_TOKEN" in os.environ: - print("Missing env variable KCI_UPLOAD_TOKEN") - utoken=None -else: - utoken=os.environ["KCI_UPLOAD_TOKEN"] - parser = argparse.ArgumentParser(description="AGL create bmeta", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--arch', action='store', help="arch of the build", required=True) parser.add_argument('--branch', action='store', help="branch of the build", required=True) @@ -27,6 +16,24 @@ parser.add_argument('--machine', action='store', help="machine of the build", re parser.add_argument('--api', action='store', help="URL to kernelci backend API", required=True) args = parser.parse_args() +KCI_PUSH_TOKEN = "AGL_KCIAPI_TOKEN" +KCI_UPLOAD_TOKEN = "AGL_KCIAPI_TOKEN" + +if args.api == 'http://kernelci.dev.baylibre.com:8081/': + KCI_PUSH_TOKEN = "BAY_KCIAPI_TOKEN" + KCI_UPLOAD_TOKEN = "BAY_KCIAPI_TOKEN" + +if not KCI_PUSH_TOKEN in os.environ: + print("Missing env variable %s" % KCI_PUSH_TOKEN) + ptoken=None +else: + ptoken=os.environ[KCI_PUSH_TOKEN] +if not KCI_UPLOAD_TOKEN in os.environ: + print("Missing env variable %s" % KCI_UPLOAD_TOKEN) + utoken=None +else: + utoken=os.environ[KCI_UPLOAD_TOKEN] + bmeta = {} bmeta["arch"] = args.arch bmeta["build_log"] = "build.log" |