Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated make module-build to use config file #162

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ bin/*
vendor/

module-template.yaml
nats-manager.yaml
module-config.yaml

.env.dev
21 changes: 17 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,29 @@ module-image: docker-build docker-push ## Build the Module Image and push it to

DEFAULT_CR ?= $(shell pwd)/config/samples/default.yaml
.PHONY: module-build
module-build: kyma kustomize ## Build the Module and push it to a registry defined in MODULE_REGISTRY
module-build: kyma render-manifest module-config-template configure-git-origin ## Build the Module and push it to a registry defined in MODULE_REGISTRY
#################################################################
## Building module with:
# - image: ${IMG}
# - channel: ${MODULE_CHANNEL}
# - name: kyma-project.io/module/$(MODULE_NAME)
# - version: $(MODULE_VERSION)
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
@$(KYMA) alpha create module --kubebuilder-project --channel=${MODULE_CHANNEL} --name kyma-project.io/module/$(MODULE_NAME) --version $(MODULE_VERSION) --path . $(MODULE_CREATION_FLAGS) --output=template.yaml --default-cr=$(DEFAULT_CR)

@$(KYMA) alpha create module --path . --output=module-template.yaml --module-config-file=module-config.yaml $(MODULE_CREATION_FLAGS)

.PHONY: module-config-template
module-config-template:
@cat module-config-template.yaml \
| sed -e 's/{{.Channel}}/${MODULE_CHANNEL}/g' \
-e 's/{{.Version}}/$(MODULE_VERSION)/g' \
-e 's/{{.Name}}/kyma-project.io\/module\/$(MODULE_NAME)/g' \
> module-config.yaml

.PHONY: configure-git-origin
configure-git-origin:
# test-infra does not include origin remote in the .git directory.
# the CLI is looking for the origin url in the .git dir so first we need to be sure it's not empty
@git remote | grep '^origin$$' -q || \
git remote add origin https://github.com/kyma-project/nats-manager

## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize
Expand Down
2 changes: 1 addition & 1 deletion hack/ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module-build: ## Build the Module, push it to a registry and print it based on t
IMG=${IMG} \
MODULE_REGISTRY=${MODULE_REGISTRY} \
MODULE_VERSION=${MODULE_VERSION}-${MODULE_SHA}
cp -f ${PROJECT_ROOT}/template.yaml ${ARTIFACTS}/module-template.yaml
cp -f ${PROJECT_ROOT}/module-template.yaml ${ARTIFACTS}/module-template.yaml
@echo "Added template to job artifacts: ${ARTIFACTS}/module-template.yaml"
@echo "\n~~~~~~~~~~~~BEGINNING OF MODULE TEMPLATE~~~~~~~~~~~~~~"
@cat ${ARTIFACTS}/module-template.yaml
Expand Down
9 changes: 9 additions & 0 deletions module-config-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: {{.Name}}
channel: {{.Channel}}
version: {{.Version}}
defaultCR: config/samples/default.yaml
manifest: nats-manager.yaml
security: sec-scanners-config.yaml
annotations:
"operator.kyma-project.io/doc-url": "https://kyma-project.io/#/nats-manager/user/README"
moduleRepo: https://github.com/kyma-project/nats-manager.git
1 change: 0 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ echo "Generated nats-manager.yaml:"
cat nats-manager.yaml

MODULE_VERSION=${PULL_BASE_REF} make module-build
mv template.yaml module-template.yaml

echo "Generated moduletemplate.yaml:"
cat module-template.yaml
Expand Down