Skip to content
Ona Docs

UpdateProject

client.Projects.Update(ctx, body) (*ProjectUpdateResponse, error)
POST/gitpod.v1.ProjectService/UpdateProject

Updates a project’s configuration.

Use this method to:

  • Modify project settings
  • Update environment class
  • Change project name
  • Configure initializers
  • Configure prebuild settings

Examples

  • Update project name:

    Changes the project’s display name.

    projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
    name: "New Project Name"
  • Enable prebuilds with daily schedule:

    Configures prebuilds to run daily at 2 AM UTC.

    projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
    prebuildConfiguration:
      enabled: true
      environmentClassIds:
        - "b0e12f6c-4c67-429d-a4a6-d9838b5da041"
      timeout: "3600s"
      trigger:
        dailySchedule:
          hourUtc: 2
ParametersExpand Collapse
body ProjectUpdateParams
AutomationsFilePath param.Field[string]Optional

automations_file_path is the path to the automations file relative to the repo root path must not be absolute (start with a /):

this.matches('^$|^[^/].*')
DevcontainerFilePath param.Field[string]Optional

devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /):

this.matches('^$|^[^/].*')
Initializer param.Field[EnvironmentInitializer]Optional

initializer is the content initializer

Name param.Field[string]Optional
maxLength80
minLength1
PrebuildConfiguration param.Field[ProjectPrebuildConfiguration]Optional

prebuild_configuration defines how prebuilds are created for this project. If not provided, the existing prebuild configuration is not modified. To disable prebuilds, set enabled to false.

ProjectID param.Field[string]Optional

project_id specifies the project identifier

formatuuid
RecommendedEditors param.Field[RecommendedEditors]Optional

recommended_editors specifies the editors recommended for this project. If not provided, the existing recommended editors are not modified. To clear all recommended editors, set to an empty RecommendedEditors message.

TechnicalDescription param.Field[string]Optional

technical_description is a detailed technical description of the project This field is not returned by default in GetProject or ListProjects responses 8KB max

maxLength8192
ReturnsExpand Collapse
type ProjectUpdateResponse struct{…}
Project ProjectOptional
DeprecatedEnvironmentClass ProjectEnvironmentClass

Use environment_classes instead.

EnvironmentClassID stringOptional

Use a fixed environment class on a given Runner. This cannot be a local runner’s environment class.

formatuuid
LocalRunner boolOptional

Use a local runner for the user

Order int64Optional

order is the priority of this entry

formatint32
ID stringOptional

id is the unique identifier for the project

formatuuid
AutomationsFilePath stringOptional

automations_file_path is the path to the automations file relative to the repo root

DesiredPhase ProjectPhaseOptional

desired_phase is the desired phase of the project When set to DELETED, the project is pending deletion

One of the following:
const ProjectPhaseUnspecified ProjectPhase = "PROJECT_PHASE_UNSPECIFIED"
const ProjectPhaseActive ProjectPhase = "PROJECT_PHASE_ACTIVE"
const ProjectPhaseDeleted ProjectPhase = "PROJECT_PHASE_DELETED"
DevcontainerFilePath stringOptional

devcontainer_file_path is the path to the devcontainer file relative to the repo root

EnvironmentClasses []ProjectEnvironmentClassOptional

environment_classes is the list of environment classes for the project

EnvironmentClassID stringOptional

Use a fixed environment class on a given Runner. This cannot be a local runner’s environment class.

formatuuid
LocalRunner boolOptional

Use a local runner for the user

Order int64Optional

order is the priority of this entry

formatint32
Initializer EnvironmentInitializerOptional

initializer is the content initializer

Specs []EnvironmentInitializerSpecOptional
ContextURL EnvironmentInitializerSpecsContextURLOptional
URL stringOptional

url is the URL from which the environment is created

formaturi
Git EnvironmentInitializerSpecsGitOptional
CheckoutLocation stringOptional

a path relative to the environment root in which the code will be checked out to

CloneTarget stringOptional

the value for the clone target mode - use depends on the target mode

RemoteUri stringOptional

remote_uri is the Git remote origin

TargetMode EnvironmentInitializerSpecsGitTargetModeOptional

the target mode determines what gets checked out

One of the following:
const EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED"
const EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteHead EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD"
const EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteCommit EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT"
const EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteBranch EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH"
const EnvironmentInitializerSpecsGitTargetModeCloneTargetModeLocalBranch EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH"
const EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteTag EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_TAG"
UpstreamRemoteUri stringOptional

upstream_Remote_uri is the fork upstream of a repository

Metadata ProjectMetadataOptional
CreatedAt TimeOptional

A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution. The count is relative to an epoch at UTC midnight on January 1, 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar backwards to year one.

All minutes are 60 seconds long. Leap seconds are “smeared” so that no leap second table is needed for interpretation, using a 24-hour linear smear.

The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from RFC 3339 date strings.

Examples

Example 1: Compute Timestamp from POSIX time().

 Timestamp timestamp;
 timestamp.set_seconds(time(NULL));
 timestamp.set_nanos(0);

Example 2: Compute Timestamp from POSIX gettimeofday().

 struct timeval tv;
 gettimeofday(&tv, NULL);

 Timestamp timestamp;
 timestamp.set_seconds(tv.tv_sec);
 timestamp.set_nanos(tv.tv_usec * 1000);

Example 3: Compute Timestamp from Win32 GetSystemTimeAsFileTime().

 FILETIME ft;
 GetSystemTimeAsFileTime(&ft);
 UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;

 // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
 // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
 Timestamp timestamp;
 timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
 timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));

Example 4: Compute Timestamp from Java System.currentTimeMillis().

 long millis = System.currentTimeMillis();

 Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
     .setNanos((int) ((millis % 1000) * 1000000)).build();

Example 5: Compute Timestamp from Java Instant.now().

 Instant now = Instant.now();

 Timestamp timestamp =
     Timestamp.newBuilder().setSeconds(now.getEpochSecond())
         .setNanos(now.getNano()).build();

Example 6: Compute Timestamp from current time in Python.

 timestamp = Timestamp()
 timestamp.GetCurrentTime()

JSON Mapping

In JSON format, the Timestamp type is encoded as a string in the RFC 3339 format. That is, the format is “{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z” where {year} is always expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), are optional. The “Z” suffix indicates the timezone (“UTC”); the timezone is required. A proto3 JSON serializer should always use UTC (as indicated by “Z”) when printing the Timestamp type and a proto3 JSON parser should be able to accept both UTC and other timezones (as indicated by an offset).

For example, “2017-01-15T01:30:15.01Z” encodes 15.01 seconds past 01:30 UTC on January 15, 2017.

In JavaScript, one can convert a Date object to this format using the standard toISOString() method. In Python, a standard datetime.datetime object can be converted to this format using strftime with the time format spec ‘%Y-%m-%dT%H:%M:%S.%fZ’. Likewise, in Java, one can use the Joda Time’s ISODateTimeFormat.dateTime() to obtain a formatter capable of generating timestamps in this format.

formatdate-time
Creator SubjectOptional

creator is the identity of the project creator

ID stringOptional

id is the UUID of the subject

formatuuid
Principal PrincipalOptional

Principal is the principal of the subject

One of the following:
const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"
const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"
const PrincipalUser Principal = "PRINCIPAL_USER"
const PrincipalRunner Principal = "PRINCIPAL_RUNNER"
const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"
const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"
const PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"
Name stringOptional

name is the human readable name of the project

maxLength80
minLength1
OrganizationID stringOptional

organization_id is the ID of the organization that contains the environment

formatuuid
UpdatedAt TimeOptional

A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution. The count is relative to an epoch at UTC midnight on January 1, 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar backwards to year one.

All minutes are 60 seconds long. Leap seconds are “smeared” so that no leap second table is needed for interpretation, using a 24-hour linear smear.

The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from RFC 3339 date strings.

Examples

Example 1: Compute Timestamp from POSIX time().

 Timestamp timestamp;
 timestamp.set_seconds(time(NULL));
 timestamp.set_nanos(0);

Example 2: Compute Timestamp from POSIX gettimeofday().

 struct timeval tv;
 gettimeofday(&tv, NULL);

 Timestamp timestamp;
 timestamp.set_seconds(tv.tv_sec);
 timestamp.set_nanos(tv.tv_usec * 1000);

Example 3: Compute Timestamp from Win32 GetSystemTimeAsFileTime().

 FILETIME ft;
 GetSystemTimeAsFileTime(&ft);
 UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;

 // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
 // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
 Timestamp timestamp;
 timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
 timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));

Example 4: Compute Timestamp from Java System.currentTimeMillis().

 long millis = System.currentTimeMillis();

 Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
     .setNanos((int) ((millis % 1000) * 1000000)).build();

Example 5: Compute Timestamp from Java Instant.now().

 Instant now = Instant.now();

 Timestamp timestamp =
     Timestamp.newBuilder().setSeconds(now.getEpochSecond())
         .setNanos(now.getNano()).build();

Example 6: Compute Timestamp from current time in Python.

 timestamp = Timestamp()
 timestamp.GetCurrentTime()

JSON Mapping

In JSON format, the Timestamp type is encoded as a string in the RFC 3339 format. That is, the format is “{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z” where {year} is always expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), are optional. The “Z” suffix indicates the timezone (“UTC”); the timezone is required. A proto3 JSON serializer should always use UTC (as indicated by “Z”) when printing the Timestamp type and a proto3 JSON parser should be able to accept both UTC and other timezones (as indicated by an offset).

For example, “2017-01-15T01:30:15.01Z” encodes 15.01 seconds past 01:30 UTC on January 15, 2017.

In JavaScript, one can convert a Date object to this format using the standard toISOString() method. In Python, a standard datetime.datetime object can be converted to this format using strftime with the time format spec ‘%Y-%m-%dT%H:%M:%S.%fZ’. Likewise, in Java, one can use the Joda Time’s ISODateTimeFormat.dateTime() to obtain a formatter capable of generating timestamps in this format.

formatdate-time
PrebuildConfiguration ProjectPrebuildConfigurationOptional

prebuild_configuration defines how prebuilds are created for this project.

Enabled boolOptional

enabled controls whether prebuilds are created for this project. When disabled, no automatic prebuilds will be triggered.

EnableJetbrainsWarmup boolOptional

enable_jetbrains_warmup controls whether JetBrains IDE warmup runs during prebuilds.

EnvironmentClassIDs []stringOptional

environment_class_ids specifies which environment classes should have prebuilds created. If empty, no prebuilds are created.

Executor SubjectOptional

executor specifies who runs prebuilds for this project. The executor’s SCM credentials are used to clone the repository. If not set, defaults to the project creator.

ID stringOptional

id is the UUID of the subject

formatuuid
Principal PrincipalOptional

Principal is the principal of the subject

One of the following:
const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"
const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"
const PrincipalUser Principal = "PRINCIPAL_USER"
const PrincipalRunner Principal = "PRINCIPAL_RUNNER"
const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"
const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"
const PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"
Timeout stringOptional

timeout is the maximum duration allowed for a prebuild to complete. If not specified, defaults to 1 hour. Must be between 5 minutes and 2 hours.

formatregex
Trigger ProjectPrebuildConfigurationTriggerOptional

trigger defines when prebuilds should be created.

DailySchedule ProjectPrebuildConfigurationTriggerDailySchedule

daily_schedule triggers a prebuild once per day at the specified hour (UTC). The actual start time may vary slightly to distribute system load.

HourUtc int64Optional

hour_utc is the hour of day (0-23) in UTC when the prebuild should start. The actual start time may be adjusted by a few minutes to balance system load.

formatint32
maximum23
RecommendedEditors RecommendedEditorsOptional

recommended_editors specifies the editors recommended for this project.

TechnicalDescription stringOptional

technical_description is a detailed technical description of the project This field is not returned by default in GetProject or ListProjects responses

UsedBy ProjectUsedByOptional
Subjects []SubjectOptional

Subjects are the 10 most recent subjects who have used the project to create an environment

ID stringOptional

id is the UUID of the subject

formatuuid
Principal PrincipalOptional

Principal is the principal of the subject

One of the following:
const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"
const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"
const PrincipalUser Principal = "PRINCIPAL_USER"
const PrincipalRunner Principal = "PRINCIPAL_RUNNER"
const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"
const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"
const PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"
TotalSubjects int64Optional

Total number of unique subjects who have used the project

formatint32

UpdateProject

package main

import (
  "context"
  "fmt"

  "github.com/gitpod-io/gitpod-sdk-go"
  "github.com/gitpod-io/gitpod-sdk-go/option"
)

func main() {
  client := gitpod.NewClient(
    option.WithBearerToken("My Bearer Token"),
  )
  project, err := client.Projects.Update(context.TODO(), gitpod.ProjectUpdateParams{
    PrebuildConfiguration: gitpod.F(gitpod.ProjectPrebuildConfigurationParam{
      Enabled: gitpod.F(true),
      EnvironmentClassIDs: gitpod.F([]string{"b0e12f6c-4c67-429d-a4a6-d9838b5da041"}),
      Timeout: gitpod.F("3600s"),
      Trigger: gitpod.F(gitpod.ProjectPrebuildConfigurationTriggerParam{
        DailySchedule: gitpod.F(gitpod.ProjectPrebuildConfigurationTriggerDailyScheduleParam{
          HourUtc: gitpod.F(int64(2)),
        }),
      }),
    }),
    ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", project.Project)
}
{
  "project": {
    "environmentClass": {
      "environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "localRunner": true,
      "order": 0
    },
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "automationsFilePath": "automationsFilePath",
    "desiredPhase": "PROJECT_PHASE_UNSPECIFIED",
    "devcontainerFilePath": "devcontainerFilePath",
    "environmentClasses": [
      {
        "environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "localRunner": true,
        "order": 0
      }
    ],
    "initializer": {
      "specs": [
        {
          "contextUrl": {
            "url": "https://example.com"
          },
          "git": {
            "checkoutLocation": "checkoutLocation",
            "cloneTarget": "cloneTarget",
            "remoteUri": "remoteUri",
            "targetMode": "CLONE_TARGET_MODE_UNSPECIFIED",
            "upstreamRemoteUri": "upstreamRemoteUri"
          }
        }
      ]
    },
    "metadata": {
      "createdAt": "2019-12-27T18:11:19.117Z",
      "creator": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "principal": "PRINCIPAL_UNSPECIFIED"
      },
      "name": "x",
      "organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "updatedAt": "2019-12-27T18:11:19.117Z"
    },
    "prebuildConfiguration": {
      "enabled": true,
      "enableJetbrainsWarmup": true,
      "environmentClassIds": [
        "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
      ],
      "executor": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "principal": "PRINCIPAL_UNSPECIFIED"
      },
      "timeout": "+9125115.360s",
      "trigger": {
        "dailySchedule": {
          "hourUtc": 23
        }
      }
    },
    "recommendedEditors": {
      "editors": {
        "foo": {
          "versions": [
            "string"
          ]
        }
      }
    },
    "technicalDescription": "technicalDescription",
    "usedBy": {
      "subjects": [
        {
          "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
          "principal": "PRINCIPAL_UNSPECIFIED"
        }
      ],
      "totalSubjects": 0
    }
  }
}
Returns Examples
{
  "project": {
    "environmentClass": {
      "environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "localRunner": true,
      "order": 0
    },
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "automationsFilePath": "automationsFilePath",
    "desiredPhase": "PROJECT_PHASE_UNSPECIFIED",
    "devcontainerFilePath": "devcontainerFilePath",
    "environmentClasses": [
      {
        "environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "localRunner": true,
        "order": 0
      }
    ],
    "initializer": {
      "specs": [
        {
          "contextUrl": {
            "url": "https://example.com"
          },
          "git": {
            "checkoutLocation": "checkoutLocation",
            "cloneTarget": "cloneTarget",
            "remoteUri": "remoteUri",
            "targetMode": "CLONE_TARGET_MODE_UNSPECIFIED",
            "upstreamRemoteUri": "upstreamRemoteUri"
          }
        }
      ]
    },
    "metadata": {
      "createdAt": "2019-12-27T18:11:19.117Z",
      "creator": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "principal": "PRINCIPAL_UNSPECIFIED"
      },
      "name": "x",
      "organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "updatedAt": "2019-12-27T18:11:19.117Z"
    },
    "prebuildConfiguration": {
      "enabled": true,
      "enableJetbrainsWarmup": true,
      "environmentClassIds": [
        "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
      ],
      "executor": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "principal": "PRINCIPAL_UNSPECIFIED"
      },
      "timeout": "+9125115.360s",
      "trigger": {
        "dailySchedule": {
          "hourUtc": 23
        }
      }
    },
    "recommendedEditors": {
      "editors": {
        "foo": {
          "versions": [
            "string"
          ]
        }
      }
    },
    "technicalDescription": "technicalDescription",
    "usedBy": {
      "subjects": [
        {
          "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
          "principal": "PRINCIPAL_UNSPECIFIED"
        }
      ],
      "totalSubjects": 0
    }
  }
}