Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[{*.bash,*.sh}]
indent_style = tab
indent_size = 2
softtabstop = 2

[Dockerfile]
indent_size = 4
indent_style = tab

[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
indent_style = tab
indent_size = 4

[*.md]
indent_size = 4
trim_trailing_whitespace = false

eclint_indent_style = unset

[Dockerfile]
[*.py]
indent_size = 4
indent_style = tab

[{*.bash,*.sh}]
indent_style = tab
indent_size = 2
softtabstop = 2


indent_style = space
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ aes_terminal_font_yellow := \033[38;2;255;255;0m
aes_terminal_reset := \033[0m
VERSION ?= 0.0.0-rc.1
DEST ?= /tmp/build
TARGET_DIR ?= ./build
MTAR_FILENAME ?= app-autoscaler-release-v$(VERSION).mtar
ACCEPTANCE_TESTS_FILE ?= ${DEST}/app-autoscaler-acceptance-tests-v$(VERSION).tgz
CI ?= false
Expand Down Expand Up @@ -199,7 +200,7 @@ ${gorouter-proxy.program}: ./go.mod ./go.sum ${gorouter-proxy.source}
.PHONY: integration
integration: generate-fakes init-db test-certs build_all build-gorouterproxy
@echo "# Running integration tests"
APP_AUTOSCALER_TEST_RUN='true' DBURL='${DBURL}' go run github.com/onsi/ginkgo/v2/ginkgo ${GINKGO_OPTS} integration DBURL="${DBURL}"
APP_AUTOSCALER_TEST_RUN='true' DBURL='${DBURL}' ginkgo ${GINKGO_OPTS} integration DBURL="${DBURL}"

.PHONY: init-db
init-db: check-db_type start-db db.java-libs target/init-db-${db_type}
Expand Down Expand Up @@ -249,6 +250,7 @@ clean: dbtasks.clean scheduler.clean
@rm --force --recursive "${openapi-generated-clients-and-servers-api-dir}"
@rm --force --recursive "${openapi-generated-clients-and-servers-scalingengine-dir}"
@go clean -cache -testcache
@rm --force --recursive 'build'
@rm --force --recursive 'fakes'
@rm --force --recursive 'test-certs'
@rm --force --recursive 'target'
Expand All @@ -260,6 +262,16 @@ dbtasks.clean:
scheduler.clean:
pushd scheduler; mvn clean; popd

schema-files := $(shell find ./api/policyvalidator -type f -name '*.json')
flattened-schema-file := ${TARGET_DIR}/bind-request.schema.json
BIND_REQ_SCHEMA_VERSION ?= v0.1
bind-request-schema: ${flattened-schema-file}
${flattened-schema-file}: ${schema-files}
mkdir -p "$$(dirname ${flattened-schema-file})"
flatten_json-schema './api/policyvalidator/json-schema/${BIND_REQ_SCHEMA_VERSION}/meta.schema.json' \
> '${flattened-schema-file}'
echo '🔨 File created: ${flattened-schema-file}'

mta-deploy: mta-build build-extension-file
$(MAKE) -f metricsforwarder/Makefile set-security-group
@echo "Deploying with extension file: $(EXTENSION_FILE)"
Expand Down Expand Up @@ -301,7 +313,7 @@ release-draft: ## Create a draft GitHub release without artifacts
./scripts/release.sh

.PHONY: create-assets
create-assets: ## Create release assets (mtar and acceptance tests)
create-assets: ## Create release assets (mtar and acceptance tests), please provide `VERSION` as environment-variable.
./scripts/create-assets.sh

.PHONY: release-promote
Expand Down
14 changes: 6 additions & 8 deletions acceptance/broker/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,12 @@ var _ = Describe("AutoScaler Service Broker", func() {

It("fails", func() {
// Preparation
paramsTemplate := `
{
"schema-version": "0.1",
"configuration": {
"app_guid": "%s"
}
}
`
paramsTemplate := `{
"schema-version": "0.1",
"configuration": {
"app_guid": "%s"
}
}`
params := fmt.Sprintf(paramsTemplate, appGuid)

// Execution
Expand Down
2 changes: 1 addition & 1 deletion api/broker/broker_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var _ = BeforeSuite(func() {
conf = &config.Config{
CatalogPath: "../exampleconfig/catalog-example.json",
DashboardRedirectURI: dashBoardURL,
PolicySchemaPath: "../policyvalidator/meta.schema.json",
PolicySchemaPath: "../policyvalidator/json-schema/meta.schema.json",
DefaultCustomMetricsCredentialType: "binding-secret",
}

Expand Down
5 changes: 4 additions & 1 deletion api/brokerserver/broker_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,10 @@ var _ = Describe("BrokerHandler", func() {
It("fails with 400", func() {
Expect(resp.Code).To(Equal(http.StatusBadRequest))
Expect(resp.Body.String()).To(MatchJSON(
`{"error": "InvalidPolicy", "description": "invalid policy provided: [{\"context\":\"(root)\",\"description\":\"Must validate one and only one schema (oneOf)\"},{\"context\":\"(root).credential-type\",\"description\":\"credential-type must be one of the following: \\\"x509\\\", \\\"binding-secret\\\"\"}]"}`,
`{
"error": "InvalidPolicy",
"description": "invalid policy provided: [{\"context\":\"(root)\",\"description\":\"Must validate one and only one schema (oneOf)\"},{\"context\":\"(root)\",\"description\":\"Must validate one and only one schema (oneOf)\"},{\"context\":\"(root)\",\"description\":\"schema-version is required\"},{\"context\":\"(root).credential-type\",\"description\":\"credential-type must be one of the following: \\\"x509\\\", \\\"binding-secret\\\"\"}]"
}`,
))
})

Expand Down
2 changes: 1 addition & 1 deletion api/brokerserver/broker_server_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var _ = BeforeSuite(func() {
},
CatalogPath: "../exampleconfig/catalog-example.json",
CatalogSchemaPath: "../schemas/catalog.schema.json",
PolicySchemaPath: "../policyvalidator/meta.schema.json",
PolicySchemaPath: "../policyvalidator/json-schema/meta.schema.json",
Scheduler: config.SchedulerConfig{
SchedulerURL: schedulerServer.URL(),
},
Expand Down
2 changes: 1 addition & 1 deletion api/cmd/api/api_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {

conf.CatalogPath = "../../exampleconfig/catalog-example.json"
conf.CatalogSchemaPath = "../../schemas/catalog.schema.json"
conf.PolicySchemaPath = "../policyvalidator/meta.schema.json"
conf.PolicySchemaPath = "../policyvalidator/json-schema/meta.schema.json"

schedulerServer = ghttp.NewServer()
conf.Scheduler.SchedulerURL = schedulerServer.URL()
Expand Down
2 changes: 1 addition & 1 deletion api/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"catalog_schema_path": "/home/vcap/app/api/schemas/catalog.schema.json",
"info_file_path": "/home/vcap/app/api/default_info.json",
"policy_schema_path": "/home/vcap/app/api/policyvalidator/meta.schema.json",
"policy_schema_path": "/home/vcap/app/api/policyvalidator/json-schema/meta.schema.json",
"dashboard_redirect_uri": null,
"default_credential_type": "binding-secret",
"health": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "Unification of different schemas for scaling-policies for Autoscaler",

"oneOf": [
{"$ref": "./scaling-policy.v0_1.schema.json"},
{"$ref": "./legacy.schema.json"},
{"$ref": "./service-key_only.v0_1.schema.json"}
{"$ref": "./v0.1/meta.schema.json"},
{"$ref": "./legacy.schema.json"}
]
}
10 changes: 10 additions & 0 deletions api/policyvalidator/json-schema/v0.1/meta.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "http://json-schema.org/draft-05/schema#",
"title": "Autoscaler Policy JSON Schema",
"description": "Unification of different schemas for scaling-policies for Autoscaler",

"oneOf": [
{"$ref": "./scaling-policy.schema.json"},
{"$ref": "./service-key_only.schema.json"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"additionalProperties": false
},
"app_guid": {
"$ref": "./shared_definitions.json#/schemas/guid"
"$ref": "../shared_definitions.json#/schemas/guid"
}
},
"anyOf": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"properties": {
"schema-version": {
"$ref": "./shared_definitions.json#/schemas/app-scaling-config-schema"
"$ref": "../shared_definitions.json#/schemas/app-scaling-config-schema"
},
"credential-type": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

"properties": {
"schema-version": {
"$ref": "./shared_definitions.json#/schemas/app-scaling-config-schema"
"$ref": "../shared_definitions.json#/schemas/app-scaling-config-schema"
},
"configuration": {
"type": "object",
"properties": {
"app_guid": {
"$ref": "./shared_definitions.json#/schemas/guid"
"$ref": "../shared_definitions.json#/schemas/guid"
}
},
"required": ["app_guid"],
Expand Down
2 changes: 1 addition & 1 deletion api/policyvalidator/policy_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("PolicyValidator", func() {
upperDiskThreshold = 2 * 1024

policyValidator = NewPolicyValidator(
"./meta.schema.json",
"./json-schema/meta.schema.json",
lowerCPUThreshold,
upperCPUThreshold,
lowerCPUUtilThreshold,
Expand Down
2 changes: 1 addition & 1 deletion api/publicapiserver/publicapiserver_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var _ = BeforeSuite(func() {
CFServer: helpers.ServerConfig{
Port: 14000 + GinkgoParallelProcess(),
},
PolicySchemaPath: "../policyvalidator/meta.schema.json",
PolicySchemaPath: "../policyvalidator/json-schema/meta.schema.json",
Scheduler: config.SchedulerConfig{
SchedulerURL: schedulerServer.URL(),
},
Expand Down
18 changes: 10 additions & 8 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"packages": {
"path:./nix#bosh-bootloader": "",
"path:./nix#app-autoscaler-cli-plugin": "",
"path:./nix#log-cache-cli-plugin": "",
"path:./nix#cf-deploy-plugin": "",
"path:./nix#cloud-mta-build-tool": "",
"path:./nix#uaac": "",
"path:.#bosh-bootloader": "",
"path:.#app-autoscaler-cli-plugin": "",
"path:.#log-cache-cli-plugin": "",
"path:.#cf-deploy-plugin": "",
"path:.#cloud-mta-build-tool": "",
"path:.#uaac": "",
"path:.#flatten_json-schema": "",
"act": "0.2.80",
"bosh-cli": "7.3.1",
"bundix": "2.5.2",
Expand All @@ -26,6 +27,7 @@
"google-java-format": "1.27.0",
"gopls": "0.18.1",
"gum": "0.16.2",
"jdt-language-server": "",
"jq": "latest",
"markdownlint-cli2": "0.17.1",
"maven": "3.9.11",
Expand All @@ -42,8 +44,8 @@
"which": "latest",
"xq-xml": "1.3.0",
"yq-go": "4.45.4",
"apple-sdk":{
"version": "latest",
"apple-sdk": {
"version": "latest",
"platforms": ["aarch64-darwin"]
}
},
Expand Down
4 changes: 4 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,10 @@
}
}
},
"jdt-language-server": {
"resolved": "github:NixOS/nixpkgs/e99366c665bdd53b7b500ccdc5226675cfc51f45?narHash=sha256-EiED5k6gXTWoAIS8yQqi5mAX6ojnzpHwAQTS3ykeYMg%3D#jdt-language-server",
"source": "nixpkg"
},
"jq@latest": {
"last_modified": "2025-10-12T08:13:11Z",
"resolved": "github:NixOS/nixpkgs/832e3b6db48508ae436c2c7bfc0cf914eac6938e#jq",
Expand Down
6 changes: 3 additions & 3 deletions nix/flake.lock → flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/flake.nix → flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let
nixpkgs = nixpkgsFor.${system};
callPackages = nixpkgs.lib.customisation.callPackagesWith nixpkgs;
in callPackages ./packages.nix {}
in callPackages ./nix/packages.nix {}
);

# 🚸 Having flake.nix on top-level makes this definition easily consumable with Nix, e.g. for
Expand All @@ -32,5 +32,5 @@
(path: type: builtins.match ".*\.ya?ml" (baseNameOf path) != null && type == "regular")
apiPath;
};
};
};
}
2 changes: 1 addition & 1 deletion integration/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func DefaultGolangAPITestConfig() apiConfig.Config {
},
CatalogPath: "../servicebroker/config/catalog.json",
CatalogSchemaPath: "../api/schemas/catalog.schema.json",
PolicySchemaPath: "../api/policyvalidator/meta.schema.json",
PolicySchemaPath: "../api/policyvalidator/json-schema/meta.schema.json",
InfoFilePath: "../api/exampleconfig/catalog-example.json",
DashboardRedirectURI: "",
CF: cf.Config{
Expand Down
Loading
Loading