diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2021-03-26 12:55:45 +0000 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2021-04-09 16:49:53 +0200 |
commit | a44217a5f248e79879bf0d66aa5a736b4d710195 (patch) | |
tree | 5b31f7dcd11f58e1beaf9487e814aae4a6e2c861 | |
parent | 6d4445f58b412ba482686903b0aa1c721607fa7d (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" |