From 7e7cf1a99f71182210093a150747af84dee0eb5c Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Sun, 21 Jun 2026 11:40:46 +0000 Subject: [PATCH] Fix buildkit tag app image overrides --- cmd/image.go | 2 +- pkg/plugin/compose_image_overrides.go | 14 ++++++---- pkg/plugin/compose_image_overrides_test.go | 32 ++++++++++++++++++++++ pkg/plugin/creates.go | 2 +- 4 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 pkg/plugin/compose_image_overrides_test.go diff --git a/cmd/image.go b/cmd/image.go index a26ef54..ffc69b9 100644 --- a/cmd/image.go +++ b/cmd/image.go @@ -60,7 +60,7 @@ var imageSetCmd = &cobra.Command{ } func init() { - imageSetCmd.Flags().String("buildkit-tag", "", "Buildkit runtime tag to use as the template base image, such as php83 or php84.") + imageSetCmd.Flags().String("buildkit-tag", "", "Buildkit runtime tag to use as the template base image, such as nginx-1.30.2-php84.") imageSetCmd.Flags().String("buildkit-repository", "libops", "Container repository for --buildkit-tag image refs.") imageSetCmd.Flags().StringArray("image-ref", []string{}, "Override a Compose service image as SERVICE=IMAGE; may be passed more than once.") imageSetCmd.Flags().StringArray("build-arg", []string{}, "Override a Compose service build arg as SERVICE.ARG=VALUE; may be passed more than once.") diff --git a/pkg/plugin/compose_image_overrides.go b/pkg/plugin/compose_image_overrides.go index a109b48..2fa5136 100644 --- a/pkg/plugin/compose_image_overrides.go +++ b/pkg/plugin/compose_image_overrides.go @@ -148,16 +148,18 @@ func buildkitBaseImageTarget(pluginName string) (service, image string, ok bool) switch strings.ToLower(strings.TrimSpace(pluginName)) { case "archivesspace": return "archivesspace", "archivesspace", true - case "drupal", "isle", "islandora": - return "drupal", "nginx", true + case "drupal": + return "drupal", "drupal", true + case "isle", "islandora": + return "drupal", "islandora", true case "ojs": - return "ojs", "nginx", true + return "ojs", "ojs", true case "omeka-classic": - return "omeka-classic", "nginx", true + return "omeka-classic", "omeka-classic", true case "omeka-s": - return "omeka-s", "nginx", true + return "omeka-s", "omeka-s", true case "wp", "wordpress": - return "wp", "nginx", true + return "wp", "wp", true default: return "", "", false } diff --git a/pkg/plugin/compose_image_overrides_test.go b/pkg/plugin/compose_image_overrides_test.go new file mode 100644 index 0000000..7473941 --- /dev/null +++ b/pkg/plugin/compose_image_overrides_test.go @@ -0,0 +1,32 @@ +package plugin + +import "testing" + +func TestResolveComposeImageOverridesBuildkitTagUsesApplicationBaseImages(t *testing.T) { + cases := []struct { + plugin string + service string + image string + }{ + {plugin: "drupal", service: "drupal", image: "libops/drupal:nginx-1.30.2-php84"}, + {plugin: "isle", service: "drupal", image: "libops/islandora:nginx-1.30.2-php84"}, + {plugin: "islandora", service: "drupal", image: "libops/islandora:nginx-1.30.2-php84"}, + {plugin: "ojs", service: "ojs", image: "libops/ojs:nginx-1.30.2-php84"}, + {plugin: "omeka-classic", service: "omeka-classic", image: "libops/omeka-classic:nginx-1.30.2-php84"}, + {plugin: "omeka-s", service: "omeka-s", image: "libops/omeka-s:nginx-1.30.2-php84"}, + {plugin: "wp", service: "wp", image: "libops/wp:nginx-1.30.2-php84"}, + } + + for _, tt := range cases { + t.Run(tt.plugin, func(t *testing.T) { + overrides, err := ResolveComposeImageOverrides(tt.plugin, "libops", "nginx-1.30.2-php84", nil, nil) + if err != nil { + t.Fatalf("ResolveComposeImageOverrides() error = %v", err) + } + args := overrides.BuildArgs[tt.service] + if args["BASE_IMAGE"] != tt.image { + t.Fatalf("BASE_IMAGE for %s = %q, want %q", tt.service, args["BASE_IMAGE"], tt.image) + } + }) + } +} diff --git a/pkg/plugin/creates.go b/pkg/plugin/creates.go index d018fdf..885e230 100644 --- a/pkg/plugin/creates.go +++ b/pkg/plugin/creates.go @@ -223,7 +223,7 @@ func (s *SDK) BindComposeCreateFlags(cmd *cobra.Command, spec CreateSpec, drupal cmd.Flags().String("template-branch", normalizeCreateSpec(spec).DockerComposeBranch, "Branch or ref to clone from the template repository.") cmd.Flags().Bool("default-context", false, "Set the new context as the default sitectl context.") cmd.Flags().Bool("setup-only", false, "Clone and configure the checkout but do not start the stack.") - cmd.Flags().String("buildkit-tag", "", "Buildkit runtime tag to use as the template base image, such as php83 or php84.") + cmd.Flags().String("buildkit-tag", "", "Buildkit runtime tag to use as the template base image, such as nginx-1.30.2-php84.") cmd.Flags().String("buildkit-repository", "libops", "Container repository for --buildkit-tag image refs.") cmd.Flags().StringArray("image-ref", []string{}, "Override a Compose service image as SERVICE=IMAGE; may be passed more than once.") cmd.Flags().StringArray("build-arg", []string{}, "Override a Compose service build arg as SERVICE.ARG=VALUE; may be passed more than once.")