File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ kind : pipeline
2+ type : kubernetes
3+ name : default
4+
5+ steps :
6+ - name : test
7+ image : golang:1.19
8+ commands :
9+ - make test
10+
11+ - name : publish-ecr
12+ image : plugins/ecr
13+ when :
14+ event : tag
15+ settings :
16+ repo : cleaner-controller
17+ registry : 558830342743.dkr.ecr.us-east-1.amazonaws.com
18+ region : us-east-1
19+ dockerfile : Dockerfile
20+ create_repository : true
21+ access_key :
22+ from_secret : 558830342743_AWS_ACCESS_KEY_ID
23+ secret_key :
24+ from_secret : 558830342743_AWS_SECRET_ACCESS_KEY
25+ tags :
26+ - ${DRONE_TAG##v}
27+ build_args :
28+ - " TARGETARCH=amd64"
29+
30+ - name : helmify
31+ image : golang:1.19
32+ environment :
33+ GIT_TOKEN :
34+ from_secret : GIT_TOKEN
35+ when :
36+ event : tag
37+ commands :
38+ -
export ORIGIN=$(printf "https://%[email protected] /vtex/cleaner-controller.git" $${GIT_TOKEN}) 39+ - git config --global user.name ${DRONE_COMMIT_AUTHOR}
40+ - git config --global user.email ${DRONE_COMMIT_AUTHOR_EMAIL}
41+ - git remote set-url origin $ORIGIN
42+ - git pull --rebase origin main
43+
44+ - make helm VERSION=${DRONE_TAG##v}
45+ - curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
46+ - helm package ./cleaner --app-version ${DRONE_TAG##v} --version ${DRONE_TAG##v}
47+ - mkdir -p repo
48+ - mv ./cleaner-${DRONE_TAG##v}.tgz ./repo
49+ - helm repo index repo --url https://vtex.github.io/cleaner-controller
50+
51+ - git add repo
52+ - git commit -m '[automated] update helm repository'
53+ - git checkout .
54+ - git push origin HEAD:main
Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ vet: ## Run go vet against code.
105105test : manifests generate fmt vet envtest # # Run tests.
106106 KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " go test ./... -coverprofile cover.out
107107
108+ helm : manifests kustomize helmify # # Generate Helm chart.
109+ cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
110+ $(KUSTOMIZE ) build config/default | $(HELMIFY ) cleaner
111+
108112# #@ Build
109113
110114.PHONY : build
@@ -177,6 +181,7 @@ $(LOCALBIN):
177181KUSTOMIZE ?= $(LOCALBIN ) /kustomize
178182CONTROLLER_GEN ?= $(LOCALBIN ) /controller-gen
179183ENVTEST ?= $(LOCALBIN ) /setup-envtest
184+ HELMIFY ?= $(LOCALBIN ) /helmify
180185
181186# # Tool Versions
182187KUSTOMIZE_VERSION ?= v3.8.7
@@ -253,3 +258,10 @@ catalog-build: opm ## Build a catalog image.
253258.PHONY : catalog-push
254259catalog-push : # # Push a catalog image.
255260 $(MAKE ) docker-push IMG=$(CATALOG_IMG )
261+
262+ .PHONY : helmify
263+ helmify : $(HELMIFY ) # # Download helmify locally if necessary.
264+ $(HELMIFY ) : $(LOCALBIN )
265+ test -s $(LOCALBIN ) /helmify || GOBIN=$(LOCALBIN ) go install github.com/arttor/helmify/cmd/helmify@latest
266+
267+
You can’t perform that action at this time.
0 commit comments