Skip to content

Commit

Permalink
WIP: Publish main branch images
Browse files Browse the repository at this point in the history
Signed-off-by: timflannagan <[email protected]>
  • Loading branch information
timflannagan committed Jan 28, 2025
1 parent eaf5af1 commit 9bbe7b0
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- 'v*'
branches:
- main
pull_request:
branches:
- main
Expand Down Expand Up @@ -41,6 +43,9 @@ jobs:
elif [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
echo "goreleaser_args=--clean" >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/main ]]; then
VERSION="${GIT_TAG}-${GIT_SHA}"
echo "goreleaser_args=--clean --skip=validate -f .goreleaser-main.yaml" >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/pull/* ]]; then
PR_NUM=$(echo "${GITHUB_REF}" | sed -E 's|refs/pull/([^/]+)/?.*|\1|')
VERSION="${GIT_TAG}-pr.${PR_NUM}-${GIT_SHA}"
Expand Down
142 changes: 142 additions & 0 deletions .goreleaser-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
version: 2
before:
hooks:
- go mod tidy
- go mod download
builds:
- id: controller
main: ./projects/gateway2/cmd/
binary: kgateway-linux-{{ .Arch }}
gcflags: "{{ .Env.GCFLAGS }}"
ldflags: "{{ .Env.LDFLAGS }}"
env:
- CGO_ENABLED=0
- GO111MODULE=on
- GOARCH={{ .Arch }}
- GOOS={{ .Os }}
mod_timestamp: "{{ .CommitTimestamp }}"
goos:
- linux
goarch:
- amd64
- arm64
- id: sds
main: ./projects/sds/cmd/
binary: sds-linux-{{ .Arch }}
gcflags: "{{ .Env.GCFLAGS }}"
ldflags: "{{ .Env.LDFLAGS }}"
env:
- CGO_ENABLED=0
- GO111MODULE=on
- GOARCH={{ .Arch }}
- GOOS={{ .Os }}
goos:
- linux
goarch:
- amd64
- arm64
- id: envoyinit
main: ./projects/envoyinit/cmd/
binary: envoyinit-linux-{{ .Arch }}
gcflags: "{{ .Env.GCFLAGS }}"
ldflags: "{{ .Env.LDFLAGS }}"
env:
- CGO_ENABLED=0
- GO111MODULE=on
- GOARCH={{ .Arch }}
- GOOS={{ .Os }}
goos:
- linux
goarch:
- amd64
- arm64
dockers:
- image_templates:
- &controller_arm_image "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.CONTROLLER_IMAGE_REPO }}:{{ .Env.VERSION }}-arm64"
use: buildx
dockerfile: &controller_dockerfile projects/gateway2/cmd/Dockerfile
goos: linux
goarch: arm64
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- "--build-arg=GOARCH=arm64"
- "--build-arg=ENVOY_IMAGE={{ .Env.ENVOY_IMAGE }}"
- image_templates:
- &controller_amd_image "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.CONTROLLER_IMAGE_REPO }}:{{ .Env.VERSION }}-amd64"
use: buildx
dockerfile: *controller_dockerfile
goos: linux
goarch: amd64
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--build-arg=GOARCH=amd64"
- "--build-arg=ENVOY_IMAGE={{ .Env.ENVOY_IMAGE }}"
- image_templates:
- &sds_arm_image "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.SDS_IMAGE_REPO }}:{{ .Env.VERSION }}-arm64"
use: buildx
dockerfile: &sds_dockerfile projects/sds/cmd/Dockerfile
goos: linux
goarch: arm64
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- "--build-arg=GOARCH=arm64"
- "--build-arg=BASE_IMAGE={{ .Env.ALPINE_BASE_IMAGE }}"
- image_templates:
- &sds_amd_image "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.SDS_IMAGE_REPO }}:{{ .Env.VERSION }}-amd64"
use: buildx
dockerfile: *sds_dockerfile
goos: linux
goarch: amd64
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--build-arg=GOARCH=amd64"
- "--build-arg=BASE_IMAGE={{ .Env.ALPINE_BASE_IMAGE }}"
- image_templates:
- &envoyinit_arm_image "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.ENVOYINIT_IMAGE_REPO }}:{{ .Env.VERSION }}-arm64"
use: buildx
dockerfile: &envoyinit_dockerfile projects/envoyinit/cmd/Dockerfile.envoyinit
goos: linux
goarch: arm64
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- "--build-arg=GOARCH=arm64"
- "--build-arg=ENTRYPOINT_SCRIPT=/projects/envoyinit/cmd/docker-entrypoint.sh"
- "--build-arg=ENVOY_IMAGE={{ .Env.ENVOY_IMAGE }}"
extra_files:
- projects/envoyinit/cmd/docker-entrypoint.sh
- image_templates:
- &envoyinit_amd_image "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.ENVOYINIT_IMAGE_REPO }}:{{ .Env.VERSION }}-amd64"
use: buildx
dockerfile: *envoyinit_dockerfile
goos: linux
goarch: amd64
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--build-arg=GOARCH=amd64"
- "--build-arg=ENTRYPOINT_SCRIPT=/projects/envoyinit/cmd/docker-entrypoint.sh"
- "--build-arg=ENVOY_IMAGE={{ .Env.ENVOY_IMAGE }}"
extra_files:
- projects/envoyinit/cmd/docker-entrypoint.sh
docker_manifests:
- name_template: "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.CONTROLLER_IMAGE_REPO }}:{{ .Env.VERSION }}"
image_templates:
- *controller_arm_image
- *controller_amd_image
- name_template: "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.SDS_IMAGE_REPO }}:{{ .Env.VERSION }}"
image_templates:
- *sds_arm_image
- *sds_amd_image
- name_template: "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.ENVOYINIT_IMAGE_REPO }}:{{ .Env.VERSION }}"
image_templates:
- *envoyinit_arm_image
- *envoyinit_amd_image
changelog:
disable: false
release:
disable: true
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,11 @@ view-test-coverage:
go tool cover -html $(OUTPUT_DIR)/cover.out

.PHONY: package-kgateway-chart
HELM_PACKAGE_ARGS ?= --version $(VERSION)
package-kgateway-chart: ## Package the new kgateway helm chart for testing
mkdir -p $(TEST_ASSET_DIR)
helm package --version $(VERSION) --destination $(TEST_ASSET_DIR) install/helm/kgateway
helm repo index $(TEST_ASSET_DIR)
mkdir -p $(TEST_ASSET_DIR); \
helm package $(HELM_PACKAGE_ARGS) --destination $(TEST_ASSET_DIR) install/helm/kgateway; \
helm repo index $(TEST_ASSET_DIR);

#----------------------------------------------------------------------------------
# Clean
Expand Down

0 comments on commit 9bbe7b0

Please sign in to comment.