From 333a87ae923356dc2e43aa511635c2c7f5ecd16d Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Fri, 26 Mar 2021 12:55:45 +0000 Subject: 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 --- utils/agl-publish.py | 29 ++++++++++++++++++----------- 1 file 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" -- cgit 1.2.3-korg