Skip to content

Commit

Permalink
chore: Support docker manifests to release for arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
irvinlim committed Dec 5, 2022
1 parent 5ad6ccc commit e2d0ed7
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 24 deletions.
89 changes: 83 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ builds:
- linux
goarch:
- amd64
- arm64
- id: execution-webhook
main: ./cmd/execution-webhook
binary: execution-webhook
Expand All @@ -23,6 +24,7 @@ builds:
- linux
goarch:
- amd64
- arm64
- id: furiko-cli
main: ./cmd/furiko-cli
binary: furiko
Expand Down Expand Up @@ -61,26 +63,101 @@ changelog:

# Build Docker images for each entrypoint separately.
dockers:
- id: execution-controller
- goos: linux
goarch: amd64
use: buildx
ids:
- execution-controller
image_templates:
- "furikoio/execution-controller:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}"
- "furikoio/execution-controller:latest"
- "furikoio/execution-controller:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}-amd64"
- "furikoio/execution-controller:latest-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--target=execution-controller"
- id: execution-webhook
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/furiko-io/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/furiko-io/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0
- goos: linux
goarch: arm64
use: buildx
ids:
- execution-controller
image_templates:
- "furikoio/execution-controller:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}-arm64v8"
- "furikoio/execution-controller:latest-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--target=execution-controller"
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/furiko-io/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/furiko-io/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0
- goos: linux
goarch: amd64
use: buildx
ids:
- execution-webhook
image_templates:
- "furikoio/execution-webhook:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}"
- "furikoio/execution-webhook:latest"
- "furikoio/execution-webhook:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}-amd64"
- "furikoio/execution-webhook:latest-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--target=execution-webhook"
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/furiko-io/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/furiko-io/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0
- goos: linux
goarch: arm64
use: buildx
ids:
- execution-webhook
image_templates:
- "furikoio/execution-webhook:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}-arm64v8"
- "furikoio/execution-webhook:latest-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--target=execution-webhook"
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/furiko-io/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/furiko-io/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0

# Support Docker manifests for multi-arch images.
docker_manifests:
- name_template: "furikoio/execution-controller:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}"
image_templates:
- "furikoio/execution-controller:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}-amd64"
- "furikoio/execution-controller:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}-arm64v8"
- name_template: "furikoio/execution-controller:latest"
image_templates:
- "furikoio/execution-controller:latest-amd64"
- "furikoio/execution-controller:latest-arm64v8"
- name_template: "furikoio/execution-webhook:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}"
image_templates:
- "furikoio/execution-webhook:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}-amd64"
- "furikoio/execution-webhook:{{ if (index .Env \"IMAGE_TAG\") }}{{ index .Env \"IMAGE_TAG\" }}{{ else if .IsSnapshot }}v{{ .Version }}{{ else }}{{ .Tag }}{{ end }}-arm64v8"
- name_template: "furikoio/execution-webhook:latest"
image_templates:
- "furikoio/execution-webhook:latest-amd64"
- "furikoio/execution-webhook:latest-arm64v8"

# Prepare release assets.
release:
Expand Down
8 changes: 5 additions & 3 deletions pkg/cli/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ func NewContext(_ *cobra.Command) (controllercontext.Context, error) {

// PrerunWithKubeconfig is a pre-run function that will set up the common context when kubeconfig is needed.
// TODO(irvinlim): We currently reuse controllercontext, but most of it is unusable for CLI interfaces.
// We should create a new common context as needed.
//
// We should create a new common context as needed.
func PrerunWithKubeconfig(cmd *cobra.Command, _ []string) error {
// Already set up previously.
if ctrlContext != nil {
Expand Down Expand Up @@ -94,8 +95,9 @@ func GetNamespace(cmd *cobra.Command) (string, error) {

// GetDynamicConfig loads the dynamic config by name and unmarshals to out.
// TODO(irvinlim): If the current user does not have permissions to read the
// ConfigMap, or the ConfigMap uses a different name/namespace, we should
// gracefully handle this case.
//
// ConfigMap, or the ConfigMap uses a different name/namespace, we should
// gracefully handle this case.
func GetDynamicConfig(ctx context.Context, cmd *cobra.Command, name configv1alpha1.ConfigName, out interface{}) error {
cfgNamespace, err := cmd.Flags().GetString("dynamic-config-namespace")
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions pkg/generated/clientset/versioned/fake/register.go

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

14 changes: 7 additions & 7 deletions pkg/generated/clientset/versioned/scheme/register.go

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

3 changes: 2 additions & 1 deletion pkg/runtime/testing/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func InitFixtures(ctx context.Context, client controllercontext.Clientsets, fixt

// InitFixture initializes a single fixture against a clientset.
// TODO(irvinlim): Currently we just hardcode a list of types to be initialized,
// we could probably use reflection instead.
//
// we could probably use reflection instead.
func InitFixture(ctx context.Context, client controllercontext.Clientsets, fixture runtime.Object) error {
var err error
switch f := fixture.(type) {
Expand Down

0 comments on commit e2d0ed7

Please sign in to comment.