Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Apply build profile by default in build
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Jul 1, 2022
1 parent 1a7abe9 commit d9cb9f6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
11 changes: 11 additions & 0 deletions integration/build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ func TestSimpleTwo(t *testing.T) {
//assert.Equal(t, image.ImageData.Containers["two"].Image, image.ImageData.Images["itwo"].Image)
}

func TestBuildDefault(t *testing.T) {
image, err := build.Build(helper.GetCTX(t), "./testdata/build-default/acorn.cue", &build.Options{
Cwd: "./testdata/build-default",
Client: helper.BuilderClient(t, system.RequireUserNamespace()),
})
if err != nil {
t.Fatal(err)
}
assert.Len(t, image.ImageData.Containers, 1)
}

func TestMultiArch(t *testing.T) {
cfg := helper.StartAPI(t)
ns := helper.TempNamespace(t, helper.MustReturn(k8sclient.Default))
Expand Down
9 changes: 9 additions & 0 deletions integration/build/testdata/build-default/acorn.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
args: {
include: bool | *false
}

profiles: build: include: bool | *true

if args.include {
containers: default: image: "busybox"
}
2 changes: 1 addition & 1 deletion pkg/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func Build(ctx context.Context, file string, opts *Options) (*v1.AppImage, error
return nil, err
}

appDefinition, buildArgs, err := appDefinition.WithArgs(opts.Args, opts.Profiles)
appDefinition, buildArgs, err := appDefinition.WithArgs(opts.Args, append([]string{"build?"}, opts.Profiles...))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/dev/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func containerSync(ctx context.Context, app *apiv1.App, opts *Options) error {
syncing := map[string]bool{}
w := objwatcher.New[*apiv1.ContainerReplica](opts.Client.GetClient())
_, err := w.BySelector(ctx, app.Namespace, labels.Everything(), func(con *apiv1.ContainerReplica) (bool, error) {
if con.Spec.AppName == app.Name && con.Status.Phase == corev1.PodRunning && !syncing[con.Name] {
if con.Spec.AppName == app.Name && con.Spec.JobName == "" && con.Status.Phase == corev1.PodRunning && !syncing[con.Name] {
for remoteDir, mount := range con.Spec.Dirs {
if mount.ContextDir == "" {
continue
Expand Down

0 comments on commit d9cb9f6

Please sign in to comment.