diff --git a/helm/gen3/Chart.yaml b/helm/gen3/Chart.yaml index 767c2d364..53cadf6cf 100644 --- a/helm/gen3/Chart.yaml +++ b/helm/gen3/Chart.yaml @@ -68,7 +68,7 @@ dependencies: repository: "file://../guppy" condition: guppy.enabled - name: hatchery - version: 0.1.55 + version: 0.1.56 repository: "file://../hatchery" condition: hatchery.enabled - name: indexd @@ -169,7 +169,7 @@ type: application # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.74 +version: 0.2.75 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/helm/gen3/README.md b/helm/gen3/README.md index f29d461ee..6ca2da660 100644 --- a/helm/gen3/README.md +++ b/helm/gen3/README.md @@ -1,6 +1,6 @@ # gen3 -![Version: 0.2.74](https://img.shields.io/badge/Version-0.2.74-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: master](https://img.shields.io/badge/AppVersion-master-informational?style=flat-square) +![Version: 0.2.75](https://img.shields.io/badge/Version-0.2.75-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: master](https://img.shields.io/badge/AppVersion-master-informational?style=flat-square) Helm chart to deploy Gen3 Data Commons @@ -37,7 +37,7 @@ Helm chart to deploy Gen3 Data Commons | file://../gen3-network-policies | gen3-network-policies | 0.1.2 | | file://../gen3-user-data-library | gen3-user-data-library | 0.1.6 | | file://../guppy | guppy | 0.1.27 | -| file://../hatchery | hatchery | 0.1.55 | +| file://../hatchery | hatchery | 0.1.56 | | file://../indexd | indexd | 0.1.34 | | file://../manifestservice | manifestservice | 0.1.33 | | file://../metadata | metadata | 0.1.32 | diff --git a/helm/hatchery/Chart.yaml b/helm/hatchery/Chart.yaml index af8cc36e5..983b94d63 100644 --- a/helm/hatchery/Chart.yaml +++ b/helm/hatchery/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.55 +version: 0.1.56 # This is the version number of the application being deployed. This version number should be diff --git a/helm/hatchery/README.md b/helm/hatchery/README.md index 72d70a970..ffbe050e5 100644 --- a/helm/hatchery/README.md +++ b/helm/hatchery/README.md @@ -1,6 +1,6 @@ # hatchery -![Version: 0.1.55](https://img.shields.io/badge/Version-0.1.55-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: master](https://img.shields.io/badge/AppVersion-master-informational?style=flat-square) +![Version: 0.1.56](https://img.shields.io/badge/Version-0.1.56-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: master](https://img.shields.io/badge/AppVersion-master-informational?style=flat-square) A Helm chart for gen3 Hatchery diff --git a/helm/hatchery/templates/workspace-launch-test-cron.yaml b/helm/hatchery/templates/workspace-launch-test-cron.yaml index 2227f33fe..5f9a9d7dc 100644 --- a/helm/hatchery/templates/workspace-launch-test-cron.yaml +++ b/helm/hatchery/templates/workspace-launch-test-cron.yaml @@ -294,6 +294,20 @@ spec: number_of_images = len(images_to_test) number_of_runs = 0 + logging.info("Checking for existing workspace for clean up...") + try: + resp = self.get_workspace_status() + except requests.exceptions.RequestException as e: + logging.error(f"Couldn't get status for workspace user. Error: {e}") + if resp.json()["status"] != "Not Found": + logging.info("Found running workspaces. Attempting to terminate...") + try: + self.terminate_workspace() + logging.info("Workspace terminated. Waiting to start testing...") + time.sleep(120) + except requests.exceptions.RequestException as e: + logging.error(f"Couldn't terminate workspace with error : {e}") + for image_name, id in images_to_test.items(): logging.info(f"Testing image: {image_name}") final_result.append(self.start_workspace_launch_test(image_name, id)) @@ -341,12 +355,20 @@ spec: except requests.exceptions.RequestException as e: error_msg = f"Error connecting to workspace via proxy endpoint. Error: {e}" - - # Terminate active running workspace + + self.terminate_and_set_logs(image_name, workspace_id, proxy_status_code) + + + def terminate_workspace(self): terminate_url = self.commons_url + "/lw-workspace/terminate" + return requests.post(terminate_url, headers= self.headers) + + + def terminate_and_set_logs(self, image_name, workspace_id, proxy_status_code): + # Terminate active running workspace try: logging.info("Attempting to terminate workspace...") - terminate_response = requests.post(terminate_url, headers= self.headers) + terminate_response = self.terminate_workspace() terminate_response.raise_for_status() logging.info("Workspace terminated...") except requests.exceptions.RequestException as e: @@ -366,6 +388,12 @@ spec: "proxy_status": proxy_status_code, } return json_result + + + def get_workspace_status(self): + status_url = self.commons_url + "/lw-workspace/status" + status_response = requests.get(status_url, headers=self.headers) + return status_response def monitor_workspace_status(self, interval=10, timeout_limit=10): @@ -376,11 +404,10 @@ spec: interval (int, optional): Interval (in seconds) to hit the options endpoint. Defaults to 10 seconds. timeout_limit(int, optional): Time limit, in minutes, at which a workspace launch is considered a failure. """ - status_url = self.commons_url + "/lw-workspace/status" while True: try: - status_response = requests.get(status_url, headers=self.headers) + status_response = self.get_workspace_status() status_response.raise_for_status() except requests.exceptions.RequestException as e: error_msg = f"Error checking workspace status: {e}"