github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/services/rollout-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  GO_FILES := $(shell find . -type f -name '*.go')
    27  PKG_GO_FILES := $(shell find ../../pkg/ -type f -name '*.go')
    28  ALL_GO_FILES := $(GO_FILES) $(PKG_GO_FILES)
    29  SERVICE_NAME := $(shell basename $$PWD)
    30  IMAGENAME?=$(IMAGE_REGISTRY)/kuberpult-rollout-service:${VERSION}
    31  ARTIFACT_REGISTRY_IMAGE_NAME=europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult/kuberpult-rollout-service:${VERSION}
    32  EARTHLY := earthly
    33  GARBAGE := *.sentinel
    34  proto:
    35  	$(MAKE) -C../../pkg/api all
    36  
    37  bin/main: $(ALL_GO_FILES) | proto
    38  	mkdir -p bin
    39  	$(GO) build -o bin/main ./cmd/server/
    40  GARBAGE += bin/main
    41  
    42  export KUBERPULT_CDSERVER?=localhost:8443
    43  run: bin/main
    44  	./bin/main
    45  
    46  build: bin/main
    47  
    48  build-pr:
    49  	echo "build on pull request"
    50  	$(EARTHLY) --push +build-pr --registry=$(IMAGE_REGISTRY) --tag=$(VERSION) --mirror=$(ARTIFACT_REGISTRY_MIRROR)
    51  
    52  build-main:
    53  	echo "build on main"
    54  	$(EARTHLY) --push +build-main --registry=$(IMAGE_REGISTRY) --tag=$(VERSION) --mirror=$(ARTIFACT_REGISTRY_MIRROR)
    55  
    56  .PHONY: cleanup-pr
    57  cleanup-pr:
    58  	echo "Nothing to clean"
    59  
    60  .PHONY: cleanup-main
    61  cleanup-main:
    62  	echo "Nothing to clean"
    63  
    64  .PHONY: publish
    65  publish: release
    66  
    67  clean:
    68  	git clean -Xfd
    69  
    70  test:
    71  	$(EARTHLY) +unit-test "--GO_TEST_ARGS=$(GO_TEST_ARGS)"
    72  
    73  test-go: $(GO_FILES) proto
    74  	$(GO) test $(GO_TEST_ARGS) ./...
    75  
    76  docker:
    77  	$(EARTHLY) +docker --registry=$(IMAGE_REGISTRY) --tag=$(VERSION)
    78  
    79  all: test docker
    80  
    81  .PHONY: all release test docker clean
    82  
    83  .DEFAULT_GOAL := all
    84  
    85  .PHONY: deps
    86  
    87  .PHONY: get-builder-image
    88  get-builder-image:
    89  	@echo "$(KUBERPULT_BUILDER)"
    90  
    91  kind-load: docker
    92  	kind load docker-image "$(IMAGENAME)"
    93  
    94  patch-kind: kind-load
    95  	kubectl set image deployment/kuberpult-rollout-service service=$(IMAGENAME)