Skip to content
Merged
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
21 changes: 21 additions & 0 deletions build_capabilities_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"context"
"testing"

builderv0 "github.com/codefly-dev/core/generated/go/codefly/services/builder/v0"
)

// The CLI verifies every agent before dispatching a build to a selected Buildx
// builder (an environment that mirrors a registry builds on one of its own);
// an agent that cannot answer fails the whole render.
func TestBuildCapabilitiesHonourASelectedBuilder(t *testing.T) {
capabilities, err := NewBuilder().BuildCapabilities(context.Background(), &builderv0.BuildCapabilitiesRequest{})
if err != nil {
t.Fatal(err)
}
if !capabilities.GetBuildxSelection() {
t.Fatal("a selected Buildx builder must be honoured")
}
}
11 changes: 11 additions & 0 deletions builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ type deploymentTemplateParameters struct {
External bool
}

// BuildCapabilities answers the CLI's check before a build that names a Buildx
// builder: this agent executes no docker build of its own — its Build hands
// the CLI a recipe or no image at all — so a selected builder is always
// honoured, by the CLI, which runs every recipe on the builder it selected.
// Without this answer core refuses the whole render of any environment that
// mirrors a registry, because such an environment builds on a dedicated
// builder and core verifies every agent before dispatching to it.
func (s *Builder) BuildCapabilities(context.Context, *builderv0.BuildCapabilitiesRequest) (*builderv0.BuildCapabilitiesResponse, error) {
return &builderv0.BuildCapabilitiesResponse{BuildxSelection: true}, nil
}

func NewBuilder() *Builder {
return &Builder{
Service: NewService(),
Expand Down
Loading