diff --git a/Makefile b/Makefile index 9ef065ae77..df5e23eca7 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ go-test-app-dir := ./src/acceptance/assets/app/go_app go_modules := $(shell find . -maxdepth 6 -name "*.mod" -exec dirname {} \; | sed 's|\./src/||' | sort) all_modules := $(go_modules) db scheduler -MVN_OPTS = "-Dmaven.test.skip=true" +MVN_OPTS = "-Dmaven.test.skip=true"make OS := $(shell . /etc/lsb-release &>/dev/null && echo $${DISTRIB_ID} || uname) db_type := postgres DB_HOST := localhost @@ -34,6 +34,7 @@ GOLANGCI_LINT_VERSION = v$(shell cat .tool-versions | grep golangci-lint \ export DEBUG ?= false export ACCEPTANCE_TESTS_FILE ?= ${DEST}/app-autoscaler-acceptance-tests-v${VERSION}.tgz +export MTAR_FILE ?= ${DEST}/app-autoscaler-release-v${VERSION}.mtar export GOWORK = off $(shell mkdir -p target) @@ -94,7 +95,7 @@ clean-acceptance: build: $(all_modules) build-tests: build-test build-test: $(addprefix test_,$(go_modules)) -build-all: build build-test build-test-app ## Build all modules and tests +build-all: build build-test build-test-app mta-build ## Build all modules and tests db: target/db target/db: @echo "# building $@" @@ -260,13 +261,6 @@ build/autoscaler-test.tgz: @mkdir -p build @bosh create-release --force --timestamp-version --tarball=build/autoscaler-test.tgz -.PHONY: acceptance-release -acceptance-release: clean-acceptance go-mod-tidy go-mod-vendor build-test-app - @echo " - building acceptance test release '${VERSION}' to dir: '${DEST}' " - @mkdir -p ${DEST} - ${AUTOSCALER_DIR}/scripts/compile-acceptance-tests.sh - @tar --create --auto-compress --directory="src" --file="${ACCEPTANCE_TESTS_FILE}" 'acceptance' - .PHONY: generate-fakes autoscaler.generate-fakes test-app.generate-fakes generate-fakes: autoscaler.generate-fakes test-app.generate-fakes autoscaler.generate-fakes: @@ -360,7 +354,21 @@ deploy-prometheus: ${prometheus-bosh-release-path}/manifests ${CI_DIR}/infrastructure/scripts/deploy-prometheus.sh; +.PHONY: mta-release +mta-release: mta-build + @echo " - building mtar release '${VERSION}' to dir: '${DEST}' " + +.PHONY: acceptance-release +acceptance-release: clean-acceptance go-mod-tidy go-mod-vendor build-test-app + @echo " - building acceptance test release '${VERSION}' to dir: '${DEST}' " + @mkdir -p ${DEST} + ${AUTOSCALER_DIR}/scripts/compile-acceptance-tests.sh + @tar --create --auto-compress --directory="src" --file="${ACCEPTANCE_TESTS_FILE}" 'acceptance' +.PHONY: mta-build +mta-build: + @echo " - building mta" + @make --directory='./src/autoscaler' mta-build .PHONY: build-test-app build-test-app: diff --git a/src/autoscaler/.gitignore b/src/autoscaler/.gitignore index 9f56ece60a..37f4a3c002 100644 --- a/src/autoscaler/.gitignore +++ b/src/autoscaler/.gitignore @@ -1,3 +1,4 @@ build/ +mta.yaml fakes/ mta_archives/ diff --git a/src/autoscaler/Makefile b/src/autoscaler/Makefile index 79c59bb7ff..568dd550f5 100644 --- a/src/autoscaler/Makefile +++ b/src/autoscaler/Makefile @@ -3,6 +3,8 @@ SHELL := /bin/bash MAKEFLAGS := -s aes_terminal_font_yellow := \e[38;2;255;255;0m aes_terminal_reset := \e[0m +VERSION ?= 0.0.0-rc.1 +DEST ?= build GO_VERSION = $(shell go version | sed -e 's/^[^0-9.]*\([0-9.]*\).*/\1/') GO_DEPENDENCIES = $(shell find . -type f -name '*.go') @@ -29,6 +31,7 @@ GINKGO_OPTS = -r --race --require-suite --randomize-all --cover ${OPTS} GINKGO_VERSION = v$(shell cat ../../.tool-versions | grep ginkgo | cut --delimiter=' ' --fields='2') + # ogen generated OpenAPI clients and servers openapi-generated-clients-and-servers-dir := ./helpers/apis/scalinghistory openapi-spec-path := ../../api @@ -162,7 +165,11 @@ mta-logs: .PHONY: mta-build mta-build: mta-build-clean + cp mta.tpl.yaml mta.yaml + sed -i 's/VERSION/$(VERSION)/g' mta.yaml + mkdir -p $(DEST) mbt build + mv mta_archives/com.github.cloudfoundry.app-autoscaler-release_$(VERSION).mtar $(DEST)/app-autoscaler-release-v$(VERSION).mtar mta-build-clean: rm -rf mta_archives diff --git a/src/autoscaler/mta.tpl.yaml b/src/autoscaler/mta.tpl.yaml new file mode 100644 index 0000000000..5e0cd1b48f --- /dev/null +++ b/src/autoscaler/mta.tpl.yaml @@ -0,0 +1,47 @@ +ID: com.github.cloudfoundry.app-autoscaler-release +description: Application Autoscaler Release for Cloud Foundry +_schema-version: "3.3.0" +provider: Cloud Foundry Foundation +copyright: Apache License 2.0 +version: VERSION + +modules: + - name: metricsforwarder + type: go + path: . + properties: + GO_INSTALL_PACKAGE_SPEC: code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/cmd/metricsforwarder + requires: + - name: config + - name: policydb + - name: syslog-client + parameters: + memory: 1G + disk-quota: 1G + instances: 2 + stack: cflinuxfs4 + routes: + build-parameters: + builder: custom + commands: + - make vendor + +resources: +- name: config + type: org.cloudfoundry.user-provided-service + parameters: + service-tags: + - config + path: metricsforwarder/default_config.json +- name: policydb + type: org.cloudfoundry.user-provided-service + parameters: + service-tags: + - policy_db + - relational +- name: syslog-client + type: org.cloudfoundry.user-provided-service + parameters: + service-tags: + - syslog-client + diff --git a/src/autoscaler/mta.yaml b/src/autoscaler/mta.yaml index 4f9b597ea2..a7c82483d6 100644 --- a/src/autoscaler/mta.yaml +++ b/src/autoscaler/mta.yaml @@ -3,7 +3,7 @@ description: Application Autoscaler Release for Cloud Foundry _schema-version: "3.3.0" provider: Cloud Foundry Foundation copyright: Apache License 2.0 -version: 0.0.1 +version: 0.0.0-rc.1 modules: - name: metricsforwarder