github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/services/frontend-service/Makefile (about) 1 # This file is part of kuberpult. 2 3 # Kuberpult is free software: you can redistribute it and/or modify 4 # it under the terms of the Expat(MIT) License as published by 5 # the Free Software Foundation. 6 7 # Kuberpult is distributed in the hope that it will be useful, 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MIT License for more details. 11 12 # You should have received a copy of the MIT License 13 # along with kuberpult. If not, see <https://directory.fsf.org/wiki/License:Expat>. 14 15 # Copyright 2023 freiheit.com 16 17 18 include ../../Makefile.variables 19 20 MAKEFLAGS += --no-builtin-rules 21 22 export CGO_ENABLED=0 23 24 IMAGE_REGISTRY?=ghcr.io/freiheit-com/kuberpult 25 GO := go 26 27 GO_FILES := $(shell find . -type f -name '*.go') 28 PKG_GO_FILES := $(shell find ../../pkg/ -type f -name '*.go') 29 ALL_GO_FILES := $(GO_FILES) $(PKG_GO_FILES) 30 31 32 IMAGENAME?=$(IMAGE_REGISTRY)/kuberpult-frontend-service:${VERSION} 33 ARTIFACT_REGISTRY_IMAGE_NAME=europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult/kuberpult-frontend-service:${VERSION} 34 GARBAGE := *.sentinel 35 36 SERVICE_NAME := $(shell basename $$PWD) 37 EARTHLY := earthly 38 image-name: 39 @echo "$(IMAGENAME)" 40 41 proto: 42 $(MAKE) -C../../pkg/api all 43 44 bin/main: $(ALL_GO_FILES) | proto 45 mkdir -p bin 46 $(GO) build -o bin/main ./cmd/server/ 47 GARBAGE += bin/main 48 49 export KUBERPULT_CDSERVER?=localhost:8443 50 export KUBERPULT_ALLOWED_ORIGINS?=localhost:* 51 export KUBERPULT_ARGOCD_BASE_URL=https://cd.dev.freiheit.systems/ 52 export KUBERPULT_SOURCE_REPO_URL=https://github.com/freiheit-com/kuberpult/commit/{commit} 53 export KUBERPULT_MANIFEST_REPO_URL=https://github.com/freiheit-com/fdc-standard-setup-dev-env-manifest/tree/{branch}/{dir} 54 export KUBERPULT_GIT_BRANCH=main 55 run: bin/main 56 ./bin/main 57 58 build: bin/main 59 60 build-pr: 61 echo "build on pull request" 62 $(EARTHLY) --push +build-pr --registry=$(IMAGE_REGISTRY) --tag=$(VERSION) --mirror=$(ARTIFACT_REGISTRY_MIRROR) 63 64 build-main: 65 echo "build on main" 66 $(EARTHLY) --push +build-main --registry=$(IMAGE_REGISTRY) --tag=$(VERSION) --mirror=$(ARTIFACT_REGISTRY_MIRROR) 67 68 .PHONY: cleanup-pr 69 cleanup-pr: 70 echo "Nothing to clean" 71 72 .PHONY: cleanup-main 73 cleanup-main: 74 echo "Nothing to clean" 75 76 .PHONY: publish 77 publish: release 78 79 start: buf-generate 80 pnpm i && pnpm start 81 82 clean: 83 git clean -Xfd 84 85 .PHONY: test-dependencies 86 test-dependencies: 87 make -C ../../pkg test 88 make -C ../../pkg/api test 89 90 test: 91 $(EARTHLY) +unit-test "--GO_TEST_ARGS=$(GO_TEST_ARGS)" 92 $(EARTHLY) +unit-test-ui 93 94 test-go: $(ALL_GO_FILES) | proto 95 $(GO) test $(GO_TEST_ARGS) ./... 96 97 test-ts: src/api/api.ts 98 pnpm eslint 99 # The extra '--' was added because of pnpm, Usage: pnpm test [-- <args>...] 100 pnpm test -- --watchAll=false 101 102 lint-scss: deps 103 pnpm lint-scss 104 105 docker: 106 $(EARTHLY) +docker --registry=$(IMAGE_REGISTRY) --tag=$(VERSION) 107 108 all: test docker 109 110 .PHONY: all release test docker clean 111 112 ## Node part 113 NODE_BIN_DIR=$(shell pnpm bin) 114 115 deps: .deps.sentinel 116 117 .deps.sentinel: package.json 118 pnpm i && touch .deps.sentinel 119 120 src/api/api.ts: ../../pkg/api/v1/api.proto | deps 121 buf-generate: src/api/api.ts 122 mkdir -p src/api 123 buf generate --path api --timeout 5m 124 125 dist: .dist.sentinel 126 127 .dist.sentinel: buf-generate $(shell find public src -type f) 128 rm -rf build/* 129 pnpm build && touch .dist.sentinel 130 131 132 .DEFAULT_GOAL := all 133 134 .PHONY: deps 135 136 .PHONY: get-builder-image 137 get-builder-image: 138 @echo "$(KUBERPULT_BUILDER)"