Skip to content

Commit

Permalink
Add BUILD_URL to IQE environment (#13)
Browse files Browse the repository at this point in the history
* Generating a build_url env var based on component name and pipeline run name.
  • Loading branch information
bacciotti authored Nov 14, 2024
1 parent f55075c commit 271bf7c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions files/bin/deploy-iqe-cji.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,18 @@ def build_number(self) -> str:
try:
build_number = check_run_id[:5]
except TypeError:
display("There was a probelem with {check_run_id=}. Using default value of 1.")
display("There was a problem with {check_run_id=}. Using default value of 1.")
build_number = "1"

return build_number

@cached_property
def build_url(self) -> str:
"""Create a build URL for the pipeline run"""

application = os.environ.get("APPLICATION")
return f"https://console.redhat.com/application-pipeline/workspaces/cost-mgmt-dev/applications/{application}/{self.pipeline_run_name}"

@cached_property
def selenium_arg(self) -> list[str]:
return ["--selenium"] if self.selenium.lower() == "true" else []
Expand All @@ -83,7 +90,8 @@ def env(self) -> dict[str, str]:
def iqe_env_vars_arg(self) -> t.Iterable[str]:
job_name = f"JOB_NAME={self.pipeline_run_name}"
build_number = f"BUILD_NUMBER={self.build_number}"
env_var_params = [job_name, build_number]
build_url = f"BUILD_URL={self.build_url}"
env_var_params = [job_name, build_number, build_url]
return chain.from_iterable(("--env-var", var) for var in env_var_params)

@cached_property
Expand Down

0 comments on commit 271bf7c

Please sign in to comment.