Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions cmd/api/api/builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (s *ApiService) CreateBuild(ctx context.Context, request oapi.CreateBuildRe
var timeoutSeconds int
var isAdminBuild bool
var secrets []builds.SecretRef
var buildArgs map[string]string

for {
part, err := request.Body.NextPart()
Expand Down Expand Up @@ -137,6 +138,20 @@ func (s *ApiService) CreateBuild(ctx context.Context, request oapi.CreateBuildRe
}, nil
}
globalCacheKey = string(data)
case "build_args":
data, err := io.ReadAll(part)
if err != nil {
return oapi.CreateBuild400JSONResponse{
Code: "invalid_request",
Message: "failed to read build_args field",
}, nil
}
if err := json.Unmarshal(data, &buildArgs); err != nil {
return oapi.CreateBuild400JSONResponse{
Code: "invalid_request",
Message: "build_args must be a JSON object of key-value pairs",
}, nil
}
}
part.Close()
}
Expand All @@ -153,12 +168,13 @@ func (s *ApiService) CreateBuild(ctx context.Context, request oapi.CreateBuildRe

// Build domain request
domainReq := builds.CreateBuildRequest{
BaseImageDigest: baseImageDigest,
CacheScope: cacheScope,
Dockerfile: dockerfile,
Secrets: secrets,
IsAdminBuild: isAdminBuild,
GlobalCacheKey: globalCacheKey,
BaseImageDigest: baseImageDigest,
CacheScope: cacheScope,
Dockerfile: dockerfile,
Secrets: secrets,
IsAdminBuild: isAdminBuild,
GlobalCacheKey: globalCacheKey,
BuildArgs: buildArgs,
}

// Apply timeout if provided
Expand Down
110 changes: 58 additions & 52 deletions lib/oapi/oapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2387,6 +2387,12 @@ paths:
Global cache identifier (e.g., "node", "python", "ubuntu", "browser").
When specified, the build will import from cache/global/{key}.
Admin builds will also export to this location.
build_args:
type: string
description: |
JSON object of build arguments to pass to the Dockerfile.
These correspond to ARG instructions in the Dockerfile.
Example: {"NODE_ENV": "production", "APP_VERSION": "1.0.0"}
responses:
202:
description: Build created and queued
Expand Down