Use environemnt variable for tuxSuite
To ensure jenkins jobs can run on both OpenCI
and Arm CI, replace harcoded variables with
enironment variable.
These are system-wide environment variable and
are configured in:
Manage Jenkins > System > Global Properties
Change-Id: Icd8de032d02b08b1e9d45926ae063654a47bf72b
Signed-off-by: Saheer Babu <saheer.babu@arm.com>
diff --git a/jenkins/tuxsuite-setup.sh b/jenkins/tuxsuite-setup.sh
index d51ec30..9435810 100755
--- a/jenkins/tuxsuite-setup.sh
+++ b/jenkins/tuxsuite-setup.sh
@@ -11,6 +11,6 @@
cat > ~/.config/tuxsuite/config.ini <<EOF
[default]
token=$TUXSUITE_TOKEN
-group=tfc
-project=ci
+group=$TUXSUITE_GROUP
+project=$TUXSUITE_PROJECT
EOF
diff --git a/lava_helper/lava_wait_jobs.py b/lava_helper/lava_wait_jobs.py
index 3761372..8b0cdea 100755
--- a/lava_helper/lava_wait_jobs.py
+++ b/lava_helper/lava_wait_jobs.py
@@ -154,7 +154,9 @@
def lava_id_to_url(id, user_args):
if LAVA_RPC_connector.is_tux_id(id):
- return "https://tuxapi.tuxsuite.com/v1/groups/tfc/projects/ci/tests/{}".format(id)
+ tuxsuite_group = os.environ.get("TUXSUITE_GROUP")
+ tuxsuite_project = os.environ.get("TUXSUITE_PROJECT")
+ return "https://tuxapi.tuxsuite.com/v1/groups/{}/projects/{}/tests/{}".format(tuxsuite_group, tuxsuite_project, id)
else:
return "{}/scheduler/job/{}".format(user_args.lava_url, id)
diff --git a/tfm_ci_pylib/lava_rpc_connector.py b/tfm_ci_pylib/lava_rpc_connector.py
index ae486b1..e6c391e 100644
--- a/tfm_ci_pylib/lava_rpc_connector.py
+++ b/tfm_ci_pylib/lava_rpc_connector.py
@@ -124,7 +124,9 @@
def get_job_log(self, job_id, target_out_file):
if self.is_tux_id(job_id):
auth_headers = {}
- log_url = "https://storage.tuxsuite.com/public/tfc/ci/tests/{job_id}/lava-logs.yaml".format(
+ log_url = "https://storage.tuxsuite.com/public/{tuxsuite_group}/{tuxsuite_project}/tests/{job_id}/lava-logs.yaml".format(
+ tuxsuite_group = os.environ.get("TUXSUITE_GROUP"),
+ tuxsuite_project = os.environ.get("TUXSUITE_PROJECT"),
job_id=job_id
)
else:
@@ -230,6 +232,9 @@
validating it againist the remote backend. Returns resulting job id,
and server url for job"""
+ tuxsuite_group = os.environ.get("TUXSUITE_GROUP")
+ tuxsuite_project = os.environ.get("TUXSUITE_PROJECT")
+
try:
if not self.validate_job_yaml(job_definition):
_log.error("Server rejected job's syntax")
@@ -255,7 +260,11 @@
_log.debug(l)
if l.startswith("uid:"):
job_id = l.split(None, 1)[1].strip()
- job_url = "https://tuxapi.tuxsuite.com/v1/groups/tfc/projects/ci/tests/" + job_id
+ job_url = "https://tuxapi.tuxsuite.com/v1/groups/{tuxsuite_group}/projects/{tuxsuite_project}/tests/{job_id}".format(
+ tuxsuite_group = os.environ.get("TUXSUITE_GROUP"),
+ tuxsuite_project = os.environ.get("TUXSUITE_PROJECT"),
+ job_id=job_id
+ )
return (job_id, job_url)
try: