From 40625a457e59e6321653b3b05dfed907e5162f79 Mon Sep 17 00:00:00 2001 From: Christopher Tomkins-Tinch Date: Fri, 20 Oct 2023 18:15:35 -0400 Subject: [PATCH] variable GOOGLE_PROJECT_ID --- pipes/WDL/tasks/tasks_terra.wdl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pipes/WDL/tasks/tasks_terra.wdl b/pipes/WDL/tasks/tasks_terra.wdl index 47534ac7f..20bc16f9a 100644 --- a/pipes/WDL/tasks/tasks_terra.wdl +++ b/pipes/WDL/tasks/tasks_terra.wdl @@ -65,6 +65,8 @@ task get_gcloud_env_info { # ========== method 2: matching a project returned by the API based on the google project ID + GOOGLE_PROJECT_ID="$(gcloud config list --format='value(core.project)')" + # get list of workspaces, limiting the output to only the fields we need curl -X 'GET' \ 'https://api.firecloud.org/api/workspaces?fields=workspace.name%2Cworkspace.namespace%2Cworkspace.googleProject' \ @@ -72,11 +74,11 @@ task get_gcloud_env_info { -H "Authorization: Bearer $(gcloud auth print-access-token)" > workspace_list.json # extract workspace name - WORKSPACE_NAME=$(jq -cr '.[] | select( .workspace.googleProject == "terra-bf70b335" ).workspace | .name' workspace_list.json) + WORKSPACE_NAME=$(jq -cr '.[] | select( .workspace.googleProject == "'${GOOGLE_PROJECT_ID}'" ).workspace | .name' workspace_list.json) echo "$WORKSPACE_NAME" > workspace_name.txt # extract workspace namespace - WORKSPACE_NAMESPACE=$(jq -cr '.[] | select( .workspace.googleProject == "terra-bf70b335" ).workspace | .namespace' workspace_list.json) + WORKSPACE_NAMESPACE=$(jq -cr '.[] | select( .workspace.googleProject == "'${GOOGLE_PROJECT_ID}'" ).workspace | .namespace' workspace_list.json) echo "$WORKSPACE_NAMESPACE" > workspace_namespace.txt # ========== method 3: resolved by Terra as inputs