github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/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  SHELL := sh
    17  
    18  include ./Makefile.variables
    19  MAKEFLAGS += --no-builtin-rules
    20  
    21  SCRIPTS_BASE:=infrastructure/scripts/make
    22  
    23  
    24  MAKEDIRS := services/cd-service services/rollout-service services/frontend-service charts/kuberpult pkg
    25  ARTIFACT_REGISTRY_URI := europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult
    26  
    27  export USER_UID := $(shell id -u)
    28  .install:
    29  	touch .install
    30  
    31  $(addsuffix /release,$(MAKEDIRS)):
    32  	make -C $(dir $@) release
    33  
    34  release: $(addsuffix /release,$(MAKEDIRS))
    35  	git tag $(VERSION)
    36  
    37  $(addsuffix /clean,$(MAKEDIRS)):
    38  	make -C $(dir $@) clean
    39  
    40  clean: $(addsuffix /clean,$(MAKEDIRS))
    41  
    42  $(addsuffix /test,$(MAKEDIRS)):
    43  	make -C $(dir $@) test
    44  
    45  test: $(addsuffix /test,$(MAKEDIRS))
    46  
    47  $(addsuffix /all,$(MAKEDIRS)):
    48  	make -C $(dir $@) all
    49  
    50  plan:
    51  	@infrastructure/scripts/execution-plan/plan-pr.sh
    52  
    53  all: $(addsuffix /all,$(MAKEDIRS))
    54  
    55  init:
    56  
    57  .PHONY: release  $(addsuffix /release,$(MAKEDIRS)) all $(addsuffix /all,$(MAKEDIRS)) clean $(addsuffix /clean,$(MAKEDIRS))
    58  
    59  .PHONY: version
    60  version:
    61  	@echo $(VERSION)
    62  
    63  .PHONY: cleanup-pr
    64  cleanup-pr:
    65  	@echo "Nothing to do"
    66  
    67  .PHONY: cleanup-main
    68  cleanup-main:
    69  	@echo "Nothing to do"
    70  
    71  .PHONY: builder
    72  builder:
    73  	IMAGE_TAG=latest make -C infrastructure/docker/builder build
    74  
    75  kuberpult: builder
    76  	make -C services/frontend-service src/api/api.ts
    77  	make -C pkg/ all
    78  	docker compose up --build
    79  
    80  kuberpult-earthly:
    81  	earthly +all-services --UID=$(USER_UID) --target docker
    82  	docker compose -f docker-compose-earthly.yml up 
    83  
    84  cache:
    85  	earthly --remote-cache=ghcr.io/freiheit-com/kuberpult/kuberpult-frontend-service:cache --push +frontend-service --target release --UID=$(USER_UID)
    86  	earthly --remote-cache=ghcr.io/freiheit-com/kuberpult/kuberpult-cd-service:cache --push +cd-service --UID=$(USER_UID) --target release
    87  	earthly --remote-cache=ghcr.io/freiheit-com/kuberpult/kuberpult-rollout-service:cache --push +rollout-service --UID=$(USER_UID) --target release
    88  
    89  integration-test:
    90  	earthly -P +integration-test --kuberpult_version=$(IMAGE_TAG_KUBERPULT)
    91  
    92  pull-service-image/%:
    93  	docker pull $(DOCKER_REGISTRY_URI)/$*:$(VERSION)
    94  	docker pull $(ARTIFACT_REGISTRY_URI)/$*:$(VERSION)-datadog
    95  
    96  tag-service-image/%: pull-service-image/%
    97  	docker tag $(DOCKER_REGISTRY_URI)/$*:$(VERSION) $(DOCKER_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)
    98  	docker tag $(ARTIFACT_REGISTRY_URI)/$*:$(VERSION)-datadog $(ARTIFACT_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)-datadog
    99  	docker tag $(ARTIFACT_REGISTRY_URI)/$*:$(VERSION)-datadog $(DOCKER_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)-datadog
   100  
   101  push-service-image/%: tag-service-image/%
   102  	docker push $(DOCKER_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)
   103  	docker push $(ARTIFACT_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)-datadog
   104  	docker push $(DOCKER_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)-datadog
   105  
   106  .PHONY: tag-release-images
   107  tag-release-images: $(foreach i,$(SERVICE_IMAGES),push-service-image/$i)
   108  	true
   109  
   110  .PHONY: commitlint
   111  commitlint:
   112  	gh pr view $${GITHUB_HEAD_REF} --json title,body --template '{{.title}}{{ "\n\n" }}{{.body}}' > commitlint.msg
   113  	@echo "commit message that will be linted:"
   114  	@cat commitlint.msg
   115  	@echo
   116  	earthly +commitlint
   117  	rm commitlint.msg