| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| VERSIONFILE := pkg/util/defaults/defaults.go |
| VERSION := 1.0.0-M3 |
| LAST_RELEASED_VERSION := 1.0.0-M2 |
| RUNTIME_VERSION := 1.0.5 |
| RUNTIME_VERSION_CONSTRAINT := >=1.0.5 |
| CAMEL_VERSION := 3.0.0-RC1 |
| CAMEL_VERSION_CONSTRAINT := >=3.0.0-RC1 |
| KANIKO_VERSION := 0.9.0 |
| BASE_IMAGE := fabric8/s2i-java:3.0-java8 |
| LOCAL_REPOSITORY := /tmp/artifacts/m2 |
| IMAGE_NAME := docker.io/apache/camel-k |
| RELEASE_GIT_REMOTE := upstream |
| GIT_COMMIT := $(shell git rev-list -1 HEAD) |
| GO_PATH := $(shell go env GOPATH) |
| LINT_GOGC := 10 |
| LINT_DEADLINE := 5m |
| |
| # Used to push pre-relase artifacts |
| STAGING_IMAGE_NAME := docker.io/camelk/camel-k |
| |
| # When packaging artifacts into the docker image, you can "copy" them from local maven |
| # or "download" them from Apache Snapshots and Maven Central |
| PACKAGE_ARTIFACTS_STRATEGY := copy |
| |
| GOLDFLAGS += -X github.com/apache/camel-k/pkg/cmd/operator.GitCommit=$(GIT_COMMIT) |
| GOFLAGS = -ldflags "$(GOLDFLAGS)" -gcflags=-trimpath=$(GO_PATH) -asmflags=-trimpath=$(GO_PATH) |
| |
| define LICENSE_HEADER |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| endef |
| |
| export LICENSE_HEADER |
| default: test |
| |
| # |
| # Generates the version file |
| # |
| codegen: |
| @echo "/*" > $(VERSIONFILE) |
| @echo "$$LICENSE_HEADER" >> $(VERSIONFILE) |
| @echo "*/" >> $(VERSIONFILE) |
| @echo "package defaults" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo "// ***********************" >> $(VERSIONFILE) |
| @echo "// DO NOT EDIT THIS FILE" >> $(VERSIONFILE) |
| @echo "// ***********************" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo "const (" >> $(VERSIONFILE) |
| @echo " // Version -- " >> $(VERSIONFILE) |
| @echo " Version = \"$(VERSION)\"" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo " // DefaultCamelVersion -- " >> $(VERSIONFILE) |
| @echo " DefaultCamelVersion = \"$(CAMEL_VERSION)\"" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo " // CamelVersionConstraint -- " >> $(VERSIONFILE) |
| @echo " CamelVersionConstraint = \"$(CAMEL_VERSION_CONSTRAINT)\"" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo " // DefaultRuntimeVersion -- " >> $(VERSIONFILE) |
| @echo " DefaultRuntimeVersion = \"$(RUNTIME_VERSION)\"" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo " // RuntimeVersionConstraint -- " >> $(VERSIONFILE) |
| @echo " RuntimeVersionConstraint = \"$(RUNTIME_VERSION_CONSTRAINT)\"" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo " // KanikoVersion -- " >> $(VERSIONFILE) |
| @echo " KanikoVersion = \"$(KANIKO_VERSION)\"" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo " // BaseImage -- " >> $(VERSIONFILE) |
| @echo " BaseImage = \"$(BASE_IMAGE)\"" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo " // LocalRepository -- " >> $(VERSIONFILE) |
| @echo " LocalRepository = \"$(LOCAL_REPOSITORY)\"" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| @echo " // ImageName -- " >> $(VERSIONFILE) |
| @echo " ImageName = \"$(IMAGE_NAME)\"" >> $(VERSIONFILE) |
| @echo ")" >> $(VERSIONFILE) |
| @echo "" >> $(VERSIONFILE) |
| gofmt -w pkg/util/defaults/defaults.go |
| |
| generate: |
| operator-sdk generate k8s |
| |
| build: build-kamel build-compile-integration-tests |
| |
| test: build |
| go test ./... |
| |
| test-integration: build |
| go test -timeout 30m -v ./e2e/... -tags=integration |
| |
| test-knative: build |
| go test -timeout 30m -v ./e2e/... -tags=knative |
| |
| build-kamel: |
| go build $(GOFLAGS) -o kamel ./cmd/kamel/*.go |
| |
| build-resources: |
| ./script/build_catalog.sh $(CAMEL_VERSION) $(RUNTIME_VERSION) |
| ./script/embed_resources.sh deploy |
| go run cmd/util/json-schema-gen/jsonschemagen.go --out=./assets/json-schema |
| |
| build-olm: |
| ./script/build_olm.sh $(VERSION) |
| |
| build-compile-integration-tests: |
| go test -c -tags="integration knative" ./e2e/*.go |
| |
| clean: |
| # go clean fails if modules support are turned on as it tries to |
| # resolve modules, if module support is turned off, it does not |
| # care about modules and simply deletes bits. |
| # |
| # For more info: |
| # |
| # https://github.com/golang/go/commit/9238a8ffe12b6eb44aab12de1b861c0f045da8b7 |
| # |
| GO111MODULE=off go clean |
| rm -f camel-k |
| rm -f kamel |
| rm -f *.test |
| rm -rf build/_maven_output |
| rm -rf build/_output |
| rm -rf camel-k-client-*.tar.gz |
| rm -rf camel-k-examples-*.tar.gz |
| |
| version: |
| @echo $(VERSION) |
| |
| dep: |
| go mod tidy |
| |
| lint: |
| GOGC=$(LINT_GOGC) golangci-lint run --verbose --deadline $(LINT_DEADLINE) |
| |
| check-licenses: |
| ./script/check_licenses.sh |
| |
| images: test |
| mkdir -p build/_maven_output |
| mkdir -p build/_output/bin |
| ifneq ($(shell uname -s 2>/dev/null || echo Unknown),Linux) |
| GOOS=linux go build $(GOFLAGS) -o build/_output/bin/kamel ./cmd/kamel/*.go |
| else |
| cp kamel build/_output/bin |
| endif |
| operator-sdk build --image-builder docker $(IMAGE_NAME):$(VERSION) |
| |
| images-dev: test package-artifacts |
| mkdir -p build/_maven_output |
| mkdir -p build/_output/bin |
| ifneq ($(shell uname -s 2>/dev/null || echo Unknown),Linux) |
| GOOS=linux go build $(GOFLAGS) -o build/_output/bin/kamel ./cmd/kamel/*.go |
| else |
| cp kamel build/_output/bin |
| endif |
| operator-sdk build --image-builder docker $(IMAGE_NAME):$(VERSION) |
| |
| images-push: |
| docker push $(IMAGE_NAME):$(VERSION) |
| |
| images-push-staging: |
| docker tag $(IMAGE_NAME):$(VERSION) $(STAGING_IMAGE_NAME):$(VERSION) |
| docker push $(STAGING_IMAGE_NAME):$(VERSION) |
| |
| set-version: |
| ./script/set_version.sh $(VERSION) $(IMAGE_NAME) |
| |
| git-tag: |
| ./script/git_tag.sh $(VERSION) $(RELEASE_GIT_REMOTE) |
| |
| cross-compile: |
| ./script/cross_compile.sh $(VERSION) '$(GOFLAGS)' |
| |
| package-examples: |
| ./script/package_examples.sh $(VERSION) |
| |
| package-artifacts: |
| ./script/package_maven_artifacts.sh $(RUNTIME_VERSION) $(PACKAGE_ARTIFACTS_STRATEGY) |
| |
| unsnapshot-olm: |
| ./script/unsnapshot_olm.sh |
| |
| release: clean codegen set-version build-resources check-licenses unsnapshot-olm build images images-push cross-compile package-examples git-tag |
| |
| release-staging: clean codegen set-version build-resources check-licenses unsnapshot-olm build images images-push-staging cross-compile package-examples git-tag |
| |
| install-minishift: |
| ./script/install_minishift.sh |
| install-minikube: |
| ./script/install_minikube.sh |
| |
| release-notes: |
| ./script/gen_release_notes.sh $(LAST_RELEASED_VERSION) $(VERSION) |
| |
| .PHONY: build build-kamel build-resources build-olm unsnapshot-olm dep codegen images images-dec images-push images-push-staging test check test-integration clean release cross-compile package-examples set-version git-tag release-notes check-licenses |