Skip to content

Commit

Permalink
variable GOOGLE_PROJECT_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkinsc committed Oct 20, 2023
1 parent 23912ed commit 40625a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pipes/WDL/tasks/tasks_terra.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ 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' \
-H 'accept: application/json' \
-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
Expand Down

0 comments on commit 40625a4

Please sign in to comment.