From 9d3fd66dd696c5427ee7f9490f9d7cdc7b832839 Mon Sep 17 00:00:00 2001 From: Marco Bebway Date: Wed, 31 Jan 2024 13:06:13 +0100 Subject: [PATCH] Remove module-template (#305) --- .gitignore | 1 - Makefile | 19 ------- hack/ci/Makefile | 12 ----- hack/get_module_template_from_build_job.sh | 59 ---------------------- module-config-template.yaml | 9 ---- 5 files changed, 100 deletions(-) delete mode 100755 hack/get_module_template_from_build_job.sh delete mode 100644 module-config-template.yaml diff --git a/.gitignore b/.gitignore index 79f3366d..082e7f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,6 @@ bin/* # Vendor vendor/ -module-template.yaml nats-manager.yaml module-config.yaml diff --git a/Makefile b/Makefile index 92b7a36a..6c854a7c 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,6 @@ OS_TYPE ?= $(shell uname) # Module Registry used for pushing the image MODULE_REGISTRY_PORT ?= 8888 MODULE_REGISTRY ?= op-kcp-registry.localhost:$(MODULE_REGISTRY_PORT)/unsigned -# Desired Channel of the Generated Module Template -MODULE_CHANNEL ?= fast # Image URL to use all building/pushing image targets IMG_REGISTRY_PORT ?= $(MODULE_REGISTRY_PORT) @@ -190,23 +188,6 @@ module-image: docker-build docker-push ## Build the Module Image and push it to echo "built and pushed module image $(IMG)" DEFAULT_CR ?= $(shell pwd)/config/samples/default.yaml -.PHONY: module-build -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) - @$(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: diff --git a/hack/ci/Makefile b/hack/ci/Makefile index 74da0ea2..b6448821 100644 --- a/hack/ci/Makefile +++ b/hack/ci/Makefile @@ -11,18 +11,6 @@ ifndef MODULE_SHA MODULE_SHA = ${shell git rev-parse --short HEAD} endif -.PHONY: module-build -module-build: ## Build the Module, push it to a registry and print it based on the commit hash. - @make -C ${PROJECT_ROOT} module-build \ - IMG=${IMG} \ - MODULE_REGISTRY=${MODULE_REGISTRY} \ - MODULE_VERSION=${MODULE_VERSION}-${MODULE_SHA} - 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 - @echo "\n~~~~~~~~~~~~~~~END OF MODULE TEMPLATE~~~~~~~~~~~~~~~~" - .PHONY: create-kyma-system-ns create-kyma-system-ns: ## Create kyma-system namespace. kubectl create ns kyma-system diff --git a/hack/get_module_template_from_build_job.sh b/hack/get_module_template_from_build_job.sh deleted file mode 100755 index 864e9f9d..00000000 --- a/hack/get_module_template_from_build_job.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -## This script requires the following env variables: -# PR_NUMBER (optional, int, If not set then will run for main branch. e.g. 82) -# COMMIT_STATUS_JSON (required, json) -# PROJECT_ROOT (required, string, e.g. "../") - -# Example of `COMMIT_STATUS_JSON` -# { -# "url": "https://api.github.com/repos/kyma-project/nats-manager/statuses/12345678765432345676543", -# "avatar_url": "https://avatars.githubusercontent.com/u/123456", -# "id": 123456789, -# "node_id": "SC_kwDOJBeAG123456789", -# "state": "success", -# "description": "Job succeeded.", -# "target_url": "https://status.build.kyma-project.io/view/gs/kyma-prow-logs/pr-logs/pull/kyma-project_nats-manager/81/pull-nats-module-build/123456789", -# "context": "pull-nats-module-build", -# "created_at": "2023-07-18T11:39:23Z", -# "updated_at": "2023-07-18T11:39:23Z" -# } - -## check if required ENVs are provided. -if [[ -z "${COMMIT_STATUS_JSON}" ]]; then - echo "ERROR: COMMIT_STATUS_JSON is not set!" - exit 1 -fi - -if [[ -z "${PROJECT_ROOT}" ]]; then - echo "ERROR: PROJECT_ROOT is not set!" - exit 1 -fi - -## define variables -MODULE_TEMPLATE_FILE="${PROJECT_ROOT}/module-template.yaml" - -# set links for artifacts of pull requests. -ARTIFACTS_BASE_URL="https://gcsweb.build.kyma-project.io/gcs/kyma-prow-logs/pr-logs/pull/kyma-project_nats-manager" -TEMPLATE_FILE_BASE_URL="${ARTIFACTS_BASE_URL}/${PR_NUMBER}/pull-nats-module-build" -# if PR_NUMBER is not set, then set links for artifacts of main branch. -if [[ -z "${PR_NUMBER}" ]]; then - ARTIFACTS_BASE_URL="https://gcsweb.build.kyma-project.io/gcs/kyma-prow-logs/logs/post-nats-module-build" - TEMPLATE_FILE_BASE_URL="${ARTIFACTS_BASE_URL}" -fi - -## Extract the prow job ID. -echo "Extracting prow job Id from: ${COMMIT_STATUS_JSON}" -TARGET_URL=$(echo ${COMMIT_STATUS_JSON} | jq -r '.target_url') -PROW_JOB_ID=$(echo ${TARGET_URL##*/}) -echo "Prow Job ID: ${PROW_JOB_ID}, Link: ${TARGET_URL}" - -## Download the module-template.yaml from the build job. -TEMPLATE_FILE_URL="${TEMPLATE_FILE_BASE_URL}/${PROW_JOB_ID}/artifacts/module-template.yaml" -echo "Downloading ${MODULE_TEMPLATE_FILE} from: ${TEMPLATE_FILE_URL}" -curl -s -L -o ${MODULE_TEMPLATE_FILE} ${TEMPLATE_FILE_URL} - -## print the module-template.yaml -echo "~~~~~~~~~~~~BEGINNING OF MODULE TEMPLATE~~~~~~~~~~~~~~" -cat ${MODULE_TEMPLATE_FILE} -echo "~~~~~~~~~~~~~~~END OF MODULE TEMPLATE~~~~~~~~~~~~~~~~" diff --git a/module-config-template.yaml b/module-config-template.yaml deleted file mode 100644 index 0849cd58..00000000 --- a/module-config-template.yaml +++ /dev/null @@ -1,9 +0,0 @@ -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