Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/image-builder-api/imgbuilder.proto
2492 views
syntax = "proto3";

package builder;
option go_package = "github.com/gitpod-io/gitpod/image-builder/api";

import "content-service-api/initializer.proto";

service ImageBuilder {
    // ResolveBaseImage returns the "digest" form of a Docker image tag thereby making it absolute.
    rpc ResolveBaseImage(ResolveBaseImageRequest) returns (ResolveBaseImageResponse) {};

    // ResolveWorkspaceImage returns information about a build configuration without actually attempting to build anything.
    rpc ResolveWorkspaceImage(ResolveWorkspaceImageRequest) returns (ResolveWorkspaceImageResponse) {};

    // Build initiates the build of a Docker image using a build configuration. If a build of this
    // configuration is already ongoing no new build will be started.
    rpc Build(BuildRequest) returns (stream BuildResponse) {};

    // Logs listens to the build output of an ongoing Docker build identified build the build ID
    rpc Logs(LogsRequest) returns (stream LogsResponse) {};

    // ListBuilds returns a list of currently running builds
    rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) {};
}

message BuildSource {
    oneof from {
        BuildSourceReference ref = 1;
        BuildSourceDockerfile file = 2;
    };
}

message BuildSourceReference {
    string ref = 1;
}

message BuildSourceDockerfile {
    contentservice.WorkspaceInitializer source = 1;
    string dockerfile_version = 2;
    string dockerfile_path = 3;
    string context_path = 4;
}

message ResolveBaseImageRequest {
    string ref = 1;
    BuildRegistryAuth auth = 2;
    bool use_retry_client = 3;
}

message ResolveBaseImageResponse {
    string ref = 1;
}

message ResolveWorkspaceImageRequest {
    BuildSource source = 1;
    BuildRegistryAuth auth = 2;
    bool use_retry_client = 3;
}

message ResolveWorkspaceImageResponse {
    string ref = 1;
    string base_ref = 3;
    BuildStatus status = 2;
}

message BuildRequest {
    BuildSource source = 1;
    BuildRegistryAuth auth = 2;
    bool force_rebuild = 3;
    string triggered_by = 4;
    string supervisor_ref = 5;
    string base_image_name_resolved = 6;
    bool use_retry_client = 7;
}

message BuildRegistryAuth {
    oneof mode {
        BuildRegistryAuthTotal total = 1;
        BuildRegistryAuthSelective selective = 2;
    }
    map<string, string> additional = 3;
}

message BuildRegistryAuthTotal {
    bool allow_all = 1;
}

message BuildRegistryAuthSelective {
    bool allow_baserep = 1;
    bool allow_workspacerep = 2;
    repeated string any_of = 3;
}

message BuildResponse {
    // deprecated(cw): expect this field to go away in a future version.
    //                 it's redundant with the build info.
    string ref = 1;

    string base_ref = 4;

    // deprecated(cw): expect this field to go away in a future version.
    //                 it's redundant with the build info.
    BuildStatus status = 2;

    string message = 3;
    BuildInfo info = 5;
}

enum BuildStatus {
    unknown = 0;
    running = 1;
    done_success = 2;
    done_failure = 3;
}

message LogsRequest {
    string build_ref = 1;
    bool censored = 2;
    string build_id = 3;
}

message LogsResponse {
    bytes content = 1;
}

message ListBuildsRequest {}

message ListBuildsResponse {
    repeated BuildInfo builds = 1;
}

message BuildInfo {
    string ref = 1;
    string base_ref = 4;
    BuildStatus status = 2;
    int64 started_at = 3;
    string build_id = 5;
    LogInfo log_info = 6;
}

message LogInfo {
    string url = 1;
    map<string, string> headers = 2;
}