UpdateEnvironment
environments.update(EnvironmentUpdateParams**kwargs) -> object
POST/gitpod.v1.EnvironmentService/UpdateEnvironment
Updates an environment’s configuration while it is running.
Updates are limited to:
- Git credentials (username, email)
- SSH public keys
- Content initialization
- Port configurations
- Automation files
- Environment timeouts
Examples
-
Update Git credentials:
Updates the Git configuration for the environment.
environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" spec: content: gitUsername: "example-user" gitEmail: "user@example.com" -
Add SSH public key:
Adds a new SSH public key for authentication.
environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" spec: sshPublicKeys: - id: "0194b7c1-c954-718d-91a4-9a742aa5fc11" value: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..." -
Update content session:
Updates the content session identifier for the environment.
environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" spec: content: session: "0194b7c1-c954-718d-91a4-9a742aa5fc11"
Note: Machine class changes require stopping the environment and creating a new one.
UpdateEnvironment
import os
from gitpod import Gitpod
client = Gitpod(
bearer_token=os.environ.get("GITPOD_API_KEY"), # This is the default and can be omitted
)
environment = client.environments.update(
environment_id="07e03a28-65a5-4d98-b532-8ea67b188048",
spec={
"ssh_public_keys": [{
"id": "0194b7c1-c954-718d-91a4-9a742aa5fc11",
"value": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI...",
}]
},
)
print(environment){}Returns Examples
{}