Skip to content

Commit

Permalink
Support Post sart up script on runtime templates (#12929)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcreddy-gcp authored Feb 1, 2025
1 parent c0cff93 commit 0500297
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
37 changes: 37 additions & 0 deletions mmv1/products/colab/RuntimeTemplate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,40 @@ properties:
- name: 'kmsKeyName'
type: String
description: 'The Cloud KMS encryption key (customer-managed encryption key) used to protect the runtime.'
- name: softwareConfig
type: NestedObject
description: 'The notebook software configuration of the notebook runtime.'
properties:
- name: 'env'
type: Array
description: 'Environment variables to be passed to the container.'
item_type:
type: NestedObject
properties:
- name: 'name'
type: String
description: 'Name of the environment variable. Must be a valid C identifier.'
- name: 'value'
type: String
description: 'Variables that reference a $(VAR_NAME) are expanded using the previous defined
environment variables in the container and any service environment variables.
If a variable cannot be resolved, the reference in the input string will be unchanged.
The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped
references will never be expanded, regardless of whether the variable exists or not.'
- name: 'postStartupScriptConfig'
type: NestedObject
description: 'Post startup script config.'
properties:
- name: 'postStartupScript'
type: String
description: 'Post startup script to run after runtime is started.'
- name: 'postStartupScriptUrl'
type: String
description: 'Post startup script url to download. Example: https://bucket/script.sh.'
- name: 'postStartupScriptBehavior'
type: Enum
description: 'Post startup script behavior that defines download and execution behavior.'
enum_values:
- 'RUN_ONCE'
- 'RUN_EVERY_START'
- 'DOWNLOAD_AND_RUN_EVERY_START'
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,17 @@ resource "google_colab_runtime_template" "{{$.PrimaryResourceId}}" {
encryption_spec {
kms_key_name = "{{index $.Vars "key_name"}}"
}

software_config {
env {
name = "TEST"
value = 1
}

post_startup_script_config {
post_startup_script = "echo 'hello world'"
post_startup_script_url = "gs://colab-enterprise-pss-secure/secure_pss.sh"
post_startup_script_behavior = "RUN_ONCE"
}
}
}

0 comments on commit 0500297

Please sign in to comment.