-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
124 additions
and
32 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
centaur/src/main/resources/standardTestCases/gcpbatch_papi_v2beta_gcsa.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: gcpbatch_papi_v2beta_gcsa | ||
testFormat: WorkflowSuccess | ||
backends: [GCPBATCH-gcsa] | ||
|
||
files { | ||
workflow: papi_v2_gcsa/gcpbatch_papi_v2_gcsa.wdl | ||
options-dir: "Error: BA-6546 The environment variable CROMWELL_BUILD_RESOURCES_DIRECTORY must be set/export pointing to a valid path such as '${YOUR_CROMWELL_DIR}/target/ci/resources'" | ||
options-dir: ${?CROMWELL_BUILD_RESOURCES_DIRECTORY} | ||
options: ${files.options-dir}/papi_v2_gcsa.options.json | ||
} | ||
|
||
metadata { | ||
workflowName: papi_v2_gcsa | ||
status: Succeeded | ||
"outputs.papi_v2_gcsa.email": "cromwell@broad-dsde-cromwell-dev.iam.gserviceaccount.com" | ||
"outputs.papi_v2_gcsa.scopes": "https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudkms https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/monitoring.write https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile" | ||
} |
37 changes: 37 additions & 0 deletions
37
centaur/src/main/resources/standardTestCases/papi_v2_gcsa/gcpbatch_papi_v2_gcsa.wdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
version 1.0 | ||
|
||
workflow papi_v2_gcsa { | ||
call get_token_info | ||
output { | ||
String email = get_token_info.json.email | ||
String scopes = get_token_info.json.scopes | ||
File service_account = get_token_info.service_account | ||
} | ||
} | ||
|
||
# Confirm that even though the service account (SA) specified by the backend configuration creates the pipeline job, | ||
# instead the google compute service account (GCSA) workflow option is the actual account used to run the container. | ||
# https://cloud.google.com/genomics/reference/rest/Shared.Types/Metadata#VirtualMachine.FIELDS.service_account | ||
# https://cromwell.readthedocs.io/en/stable/wf_options/Google/#google-pipelines-api-workflow-options | ||
task get_token_info { | ||
command <<< | ||
apt-get install --assume-yes jq > /dev/null | ||
|
||
curl --fail --silent \ | ||
'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/?recursive=true' \ | ||
-H 'Metadata-Flavor: Google' > service_accounts.json | ||
|
||
cat service_accounts.json | jq --monochrome-output \ | ||
'.default | {email, scopes: .scopes | sort | join(" ")}' | ||
>>> | ||
|
||
runtime { | ||
docker: "gcr.io/google.com/cloudsdktool/cloud-sdk:slim" | ||
backend: "GCPBATCH-gcsa" | ||
} | ||
|
||
output { | ||
Object json = read_json(stdout()) | ||
File service_account = "service_accounts.json" | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
centaur/src/main/resources/standardTestCases/papi_v2alpha1_gcsa.test
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
centaur/src/main/resources/standardTestCases/papi_v2beta_gcsa.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...nds/google/batch/src/main/scala/cromwell/backend/google/batch/api/GoogleCloudScopes.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cromwell.backend.google.batch.api | ||
|
||
/** | ||
* Google cloud scopes that don't have constants defined elsewhere in Google Cloud Java API. | ||
*/ | ||
object GoogleCloudScopes { | ||
|
||
/** | ||
* More restricted version of com.google.api.services.cloudkms.v1.CloudKMSScopes.CLOUD_PLATFORM | ||
* Could use that scope to keep things simple, but docs say to use a more restricted scope: | ||
* | ||
* https://cloud.google.com/kms/docs/accessing-the-api#google_compute_engine | ||
* | ||
* For some reason this scope isn't listed as a constant under CloudKMSScopes. | ||
*/ | ||
val KmsScope = "https://www.googleapis.com/auth/cloudkms" | ||
|
||
/** | ||
* Scope to write metrics to Stackdriver Monitoring API. | ||
* Used by the monitoring action. | ||
* | ||
* For some reason we couldn't find this scope within Google libraries | ||
*/ | ||
val MonitoringWrite = "https://www.googleapis.com/auth/monitoring.write" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters