forked from konflux-ci/konflux-build-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_image_index.go
More file actions
55 lines (47 loc) · 1.98 KB
/
build_image_index.go
File metadata and controls
55 lines (47 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package image
import (
"github.com/spf13/cobra"
"github.com/konflux-ci/konflux-build-cli/pkg/commands"
"github.com/konflux-ci/konflux-build-cli/pkg/common"
l "github.com/konflux-ci/konflux-build-cli/pkg/logger"
)
var BuildImageIndexCmd = &cobra.Command{
Use: "build-image-index",
Short: "Build a multi-architecture image index",
Long: `Build a multi-architecture image index (manifest list) from multiple platform-specific images.
This command combines multiple container images into a single image index, enabling
multi-platform container image support.
Examples:
# Build an image index from multiple platform images
konflux-build-cli image build-image-index \
--image quay.io/myorg/myapp:latest \
--images quay.io/myorg/myapp@sha256:amd64digest... quay.io/myorg/myapp@sha256:arm64digest...
# Build and push to additional tags (e.g., TaskRun name, commit SHA)
konflux-build-cli image build-image-index \
--image quay.io/myorg/myapp:latest \
--images quay.io/myorg/myapp@sha256:amd64digest... quay.io/myorg/myapp@sha256:arm64digest... \
--additional-tags taskrun-xyz-12345 commit-abc123
# Write results to files (useful for Tekton tasks)
konflux-build-cli image build-image-index \
--image quay.io/myorg/myapp:latest \
--images quay.io/myorg/myapp@sha256:amd64digest... quay.io/myorg/myapp@sha256:arm64digest... \
--result-path-image-digest /tekton/results/IMAGE_DIGEST \
--result-path-image-url /tekton/results/IMAGE_URL \
--result-path-image-ref /tekton/results/IMAGE_REF \
--result-path-images /tekton/results/IMAGES
`,
Run: func(cmd *cobra.Command, args []string) {
l.Logger.Debug("Starting build-image-index")
buildImageIndex, err := commands.NewBuildImageIndex(cmd)
if err != nil {
l.Logger.Fatal(err)
}
if err := buildImageIndex.Run(); err != nil {
l.Logger.Fatal(err)
}
l.Logger.Debug("Finished build-image-index")
},
}
func init() {
common.RegisterParameters(BuildImageIndexCmd, commands.BuildImageIndexParamsConfig)
}