Skip to content

Commit 5356bd8

Browse files
authored
Merge pull request #54 from maxcao13/cloudbuild
chore(release): add cloudbuild.yaml file
2 parents 9be2dd2 + cce0efb commit 5356bd8

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ ARCH ?= $(shell go env GOARCH)
2727

2828
CONTAINER_RUNTIME ?= docker
2929
BUILDER_IMAGE ?=
30-
IMG ?= karpenter-clusterapi-controller
30+
REGISTRY ?= gcr.io/k8s-staging-karpenter-cluster-api
31+
TAG ?= latest
32+
IMG ?= $(REGISTRY)/karpenter-clusterapi-controller:$(TAG)
3133

3234
all: help
3335

@@ -52,6 +54,13 @@ karpenter-clusterapi-controller: ## build the main karpenter controller
5254
image: ## Build manager container image
5355
$(CONTAINER_RUNTIME) build --build-arg BUILDER_IMAGE=$(BUILDER_IMAGE) --build-arg ARCH=$(ARCH) . -t $(IMG)
5456

57+
.PHONY: image-push
58+
image-push: ## Push the manager container image to the container registry
59+
$(CONTAINER_RUNTIME) push $(IMG)
60+
61+
.PHONY: release-staging ## Build and push the staging image to the registry.
62+
release-staging: image image-push
63+
5564
.PHONY: manifests
5665
manifests: ## generate the controller-gen kubernetes manifests
5766
$(CONTROLLER_GEN) rbac:roleName=manager-role crd paths="./..." output:crd:artifacts:config=pkg/apis/crds

cloudbuild.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# this prevents errors if you don't use both _GIT_TAG and _PULL_BASE_REF,
2+
# or any new substitutions added in the future.
3+
options:
4+
substitution_option: ALLOW_LOOSE
5+
steps:
6+
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:latest'
7+
entrypoint: make
8+
env:
9+
- TAG=$_GIT_TAG
10+
args:
11+
- release-staging
12+
substitutions:
13+
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
14+
# can be used as a substitution
15+
_GIT_TAG: '0.0.0'
16+
# _PULL_BASE_REF will contain the ref that was pushed to to trigger this build -
17+
# a branch like 'master' or 'release-0.2', or a tag like 'v0.2'.
18+
_PULL_BASE_REF: 'main'
19+
images:
20+
- 'gcr.io/k8s-staging-karpenter-cluster-api/karpenter-clusterapi-controller:$_GIT_TAG'

0 commit comments

Comments
 (0)