diff --git a/ci/autoscaler/pipeline.yml b/ci/autoscaler/pipeline.yml index afb7141a8b..e71b03ba48 100644 --- a/ci/autoscaler/pipeline.yml +++ b/ci/autoscaler/pipeline.yml @@ -338,7 +338,7 @@ jobs: - in_parallel: - get: bbl-state - get: app-autoscaler-release - passed: [unit-tests, integration-tests] + # passed: [unit-tests, integration-tests] trigger: true - get: ci - task: make-prerelease diff --git a/src/autoscaler/.cfignore b/src/autoscaler/.cfignore new file mode 100644 index 0000000000..378eac25d3 --- /dev/null +++ b/src/autoscaler/.cfignore @@ -0,0 +1 @@ +build diff --git a/src/autoscaler/Makefile b/src/autoscaler/Makefile index 4e01642ea2..79c59bb7ff 100644 --- a/src/autoscaler/Makefile +++ b/src/autoscaler/Makefile @@ -89,12 +89,6 @@ go-mod-vendor: ${go-vendoring-folder} ${go-vendored-files} ${go-vendoring-folder} ${go-vendored-files} &: ${app-fakes-dir} ${app-fakes-files} go mod vendor -cf-build-%: generate-fakes - @echo "# building for cf $*" - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/$* $*/cmd/$*/main.go - -cf-build: $(addprefix cf-build-,$(binaries)) - # CGO_ENABLED := 1 is required to enforce dynamic linking which is a requirement of dynatrace. build-%: ${openapi-generated-clients-and-servers-dir} ${openapi-generated-clients-and-servers-files} @echo "# building $*" @@ -167,7 +161,7 @@ mta-logs: vim mta-* .PHONY: mta-build -mta-build: mta-build-clean cf-build +mta-build: mta-build-clean mbt build mta-build-clean: diff --git a/src/autoscaler/Makefile_20240829141453.mta b/src/autoscaler/Makefile_20240829141453.mta new file mode 100644 index 0000000000..ac7ada0ddb --- /dev/null +++ b/src/autoscaler/Makefile_20240829141453.mta @@ -0,0 +1,54 @@ +# Generated with Cloud MTA Build Tool version 1.2.26 +version=0.0.1 +MBT=/Users/C5331208/workspace/app-autoscaler-release/.devbox/nix/profile/default/bin/mbt +ifndef p +$(error platform flag is expected. e.g. use make -f makefile.mta p=cf) +endif +target_provided=true +ifndef t +t="$(CURDIR)" +target_provided=false +endif +ifndef strict +strict=true +endif +ifndef mtar +mtar="*" +endif +modules := $(shell $(MBT) provide modules -d=dev) +modules := $(subst ],,$(subst [,,$(modules))) +# List of all the recipes to be executed during the build process +.PHONY: all pre_validate pre_build validate $(modules) post_build meta mtar cleanup +# Default target compile all +all: pre_validate pre_build validate $(modules) post_build meta mtar cleanup +# Validate mta.yaml +pre_validate: + @$(MBT) validate -r=${strict} -x="paths" +pre_build: pre_validate + @$(MBT) project build -p=pre + + +# Execute module build +define build_rule +$(1): validate + @$(MBT) module build -m=$(1) -p=${p} -t=${t} +endef + +$(foreach mod,$(modules),$(eval $(call build_rule,$(mod))))# Create META-INF folder with MANIFEST.MF & mtad.yaml +meta: $(modules) post_build + @$(MBT) gen meta -p=${p} -t=${t} + +post_build: $(modules) + @$(MBT) project build -p=post -t=${t} + +# Validate mta.yaml +validate: pre_build + @$(MBT) validate -r=${strict} + +# Pack as MTAR artifact +mtar: $(modules) meta + @$(MBT) gen mtar --mtar=${mtar} --target_provided=${target_provided} -t=${t} + +cleanup: mtar +# Remove tmp folder + @$(MBT) clean -t=${t} \ No newline at end of file diff --git a/src/autoscaler/mta.yaml b/src/autoscaler/mta.yaml index 3b14d94d3f..4f9b597ea2 100644 --- a/src/autoscaler/mta.yaml +++ b/src/autoscaler/mta.yaml @@ -7,8 +7,10 @@ version: 0.0.1 modules: - name: metricsforwarder - type: binary - path: build + type: go + path: . + properties: + GO_INSTALL_PACKAGE_SPEC: code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/cmd/metricsforwarder requires: - name: config - name: policydb @@ -18,8 +20,11 @@ modules: disk-quota: 1G instances: 2 stack: cflinuxfs4 - command: ./metricsforwarder routes: + build-parameters: + builder: custom + commands: + - make vendor resources: - name: config