Skip to content

Commit

Permalink
feat! Remove buildin mode (#2916)
Browse files Browse the repository at this point in the history
# Issue

The `buildin_mode` is no longer used (see #1619) but still wastes CI
resources due to the the tests.

# Fix

BREAKING CHANGE: Remove `buildin` mode
  • Loading branch information
silvestre authored and bonzofenix committed May 21, 2024
1 parent f0e298f commit 1f682a9
Show file tree
Hide file tree
Showing 38 changed files with 93 additions and 747 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/acceptance_tests_buildin.yaml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/acceptance_tests_buildin_close.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/acceptance_tests_reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
self_hosted_image:
type: string
default: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main
buildin_mode:
required: false
type: boolean
default: false
service_offering_enabled:
required: false
type: boolean
Expand All @@ -29,7 +25,6 @@ defaults:
shell: bash

env:
BUILDIN_MODE: "${{ inputs.buildin_mode }}"
SERVICE_OFFERING_ENABLED: "${{ inputs.service_offering_enabled }}"
PR_NUMBER: "${{ github.event.pull_request.number }}"
DEPLOYMENT_NAME: "${{ inputs.deployment_name }}"
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ DEST ?= build
GOLANGCI_LINT_VERSION = v$(shell cat .tool-versions | grep golangci-lint \
| cut --delimiter=' ' --fields='2')

export BUILDIN_MODE ?= false
export DEBUG ?= false
export ACCEPTANCE_TESTS_FILE ?= ${DEST}/app-autoscaler-acceptance-tests-v${VERSION}.tgz
export GOWORK = off
Expand Down Expand Up @@ -337,7 +336,7 @@ markdownlint-cli:
deploy-autoscaler: go-mod-vendor uaac db scheduler deploy-autoscaler-bosh deploy-register-cf
deploy-register-cf:
echo " - registering broker with cf"
[ "$${BUILDIN_MODE}" == "false" ] && { ${CI_DIR}/autoscaler/scripts/register-broker.sh; } || echo " - Not registering broker due to buildin mode enabled"
${CI_DIR}/autoscaler/scripts/register-broker.sh
deploy-autoscaler-bosh:
echo " - deploying autoscaler"
DEBUG="${DEBUG}" ${CI_DIR}/autoscaler/scripts/deploy-autoscaler.sh
Expand Down
63 changes: 0 additions & 63 deletions ci/autoscaler/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,10 @@ anchors:
operations/add-extra-plan.yml
operations/set-release-version.yml
app-autoscaler-ops-files-buildin: &app-autoscaler-ops-files-buildin
OPS_FILES: |
operations/add-releases.yml
operations/instance-identity-cert-from-cf.yml
operations/add-postgres-variables.yml
operations/enable-nats-tls.yml
operations/loggregator-certs-from-cf.yml
operations/add-extra-plan.yml
operations/set-release-version.yml
operations/configure-log-cache-and-forward-metrics-via-mtls.yml
operations/use_buildin_mode.yml
operations/remove-metricsserver.yml
operations/remove-metricsgateway.yml
operations/enable-scheduler-logging.yml
groups:
- name: all
jobs:
- acceptance
- acceptance-buildin
- acceptance-log-cache
- cleanup-autoscaler-deployments
- fetch-latest-stemcell
Expand All @@ -71,7 +55,6 @@ groups:
- name: autoscaler-release
jobs:
- acceptance
- acceptance-buildin
- acceptance-log-cache
- draft
- integration-tests
Expand Down Expand Up @@ -193,7 +176,6 @@ jobs:
branch_name: ((branch_name))
acceptance_deployment_name: ((acceptance_deployment_name))
logcache_acceptance_deployment_name: ((logcache_acceptance_deployment_name))
builtin_acceptance_deployment_name: ((builtin_acceptance_deployment_name))

- name: unit-tests
public: true
Expand Down Expand Up @@ -329,50 +311,6 @@ jobs:
SUITES: broker
timeout: 15m

- name: acceptance-buildin
public: true
build_logs_to_retain: 100
serial: true
on_success:
task: cleanup
file: ci/ci/autoscaler/tasks/cleanup-autoscaler.yml
params: &acceptance-buildin-params
DEPLOYMENT_NAME: ((builtin_acceptance_deployment_name))
BUILDIN_MODE: true
SERVICE_OFFERING_ENABLED: false
plan:
- in_parallel:
- get: bbl-state
- get: app-autoscaler-release
passed: [unit-tests, integration-tests]
trigger: true
- get: ci
- task: make-prerelease
file: ci/ci/autoscaler/tasks/make/make.yaml
params:
# ⚠️ Here it is used that make officially guarantees to reach the goals in the provided order.
TARGETS: generate-fakes generate-openapi-generated-clients-and-servers go-mod-tidy go-mod-vendor db scheduler
timeout: 15m
- task: deploy-autoscaler
file: ci/ci/autoscaler/tasks/deploy-autoscaler.yml
params:
<<: *acceptance-buildin-params
<<: *app-autoscaler-ops-files-buildin
timeout: 30m
- in_parallel:
- task: autoscaler-acceptance-api
file: ci/ci/autoscaler/tasks/run-acceptance-tests.yml
params:
<<: *acceptance-buildin-params
SUITES: api
timeout: 15m
- task: autoscaler-acceptance-app
file: ci/ci/autoscaler/tasks/run-acceptance-tests.yml
params:
<<: *acceptance-buildin-params
SUITES: app
timeout: 45m

- name: performance
public: true
build_logs_to_retain: 100
Expand Down Expand Up @@ -435,7 +373,6 @@ jobs:
passed:
- acceptance
- acceptance-log-cache
- acceptance-buildin
trigger: true
- get: previous-stable-release
- task: deploy-previous-stable-release
Expand Down
1 change: 0 additions & 1 deletion ci/autoscaler/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ function unset_vars() {
unset BBL_STATE_PATH
unset AUTOSCALER_DIR
unset CI_DIR
unset BUILDIN_MODE
unset SERVICE_NAME
unset SERVICE_BROKER_NAME
unset NAME_PREFIX
Expand Down
1 change: 0 additions & 1 deletion ci/autoscaler/scripts/deploy-autoscaler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ ops_files=${OPS_FILES:-"${autoscaler_dir}/operations/add-releases.yml\
${autoscaler_dir}/operations/enable-scheduler-logging.yml"}


if [[ "${buildin_mode}" == "true" ]]; then ops_files+=" ${autoscaler_dir}/operations/use_buildin_mode.yml"; fi;

case "${cpu_upper_threshold}" in
"100")
Expand Down
5 changes: 0 additions & 5 deletions ci/autoscaler/scripts/vars.source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ debug "CI_DIR: ${CI_DIR}"
# shellcheck disable=SC2034
ci_dir="${CI_DIR}"

export BUILDIN_MODE=${BUILDIN_MODE:-"false"}
debug "BUILDIN_MODE: ${BUILDIN_MODE}"
# shellcheck disable=SC2034
buildin_mode="${BUILDIN_MODE}"

export SERVICE_NAME="${DEPLOYMENT_NAME}"
debug "SERVICE_NAME: ${SERVICE_NAME}"
# shellcheck disable=SC2034
Expand Down
2 changes: 0 additions & 2 deletions ci/autoscaler/set-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ function set_pipeline(){
if [[ -z $PR_NUMBER ]]; then
add_var acceptance_deployment_name "acceptance"
add_var logcache_acceptance_deployment_name "acceptance-lc"
add_var builtin_acceptance_deployment_name "acceptance-bld"
else
add_var acceptance_deployment_name "${PR_NUMBER}-acceptance"
add_var logcache_acceptance_deployment_name "${PR_NUMBER}-acceptance-lc"
add_var builtin_acceptance_deployment_name "${PR_NUMBER}-acceptance-bld"
fi

# shellcheck disable=SC2086
Expand Down
7 changes: 0 additions & 7 deletions example/operation/use_buildin_mode.yml

This file was deleted.

3 changes: 0 additions & 3 deletions jobs/golangapiserver/spec
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ properties:
description: "PEM-encoded server certificate for the health endpoint"
autoscaler.apiserver.health.server_key:
description: "PEM-encoded server key for the health endpoint"
autoscaler.apiserver.use_buildin_mode:
default: true
description: ""
autoscaler.apiserver.info.name:
description: "Name of the autoscaler application to be shown in /info path"
default: "Autoscaler"
Expand Down
9 changes: 1 addition & 8 deletions jobs/golangapiserver/templates/apiserver.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ require 'yaml'
# Template Main #
###########################################
job_name = 'golangapiserver'
if p("autoscaler.apiserver.use_buildin_mode") == false
binding_db_url = build_db_url('binding_db', job_name)
end
binding_db_url = build_db_url('binding_db', job_name)
policy_db_url = build_db_url('policy_db', job_name)
if p("autoscaler.storedprocedure_db.address") != ''
storedprocedure_db_url = build_db_url('storedprocedure_db', job_name)
Expand Down Expand Up @@ -68,7 +66,6 @@ public_api_server:
key_file: /var/vcap/jobs/golangapiserver/config/certs/apiserver/server.key
<% end %>

<% if p("autoscaler.apiserver.use_buildin_mode") == false %>
broker_server:
port: <%= p("autoscaler.apiserver.broker.server.port") %>
<% if_p("autoscaler.apiserver.broker.server.ca_cert", "autoscaler.apiserver.broker.server.server_cert", "autoscaler.apiserver.broker.server.server_key") do %>
Expand All @@ -88,11 +85,9 @@ broker_credentials:

catalog_path: /var/vcap/jobs/golangapiserver/config/catalog.json
catalog_schema_path: /var/vcap/packages/golangapiserver/catalog.schema.json
<% end %>
info_file_path: /var/vcap/jobs/golangapiserver/config/info.json
policy_schema_path: /var/vcap/packages/golangapiserver/policy_json.schema.json
dashboard_redirect_uri: <%= p("autoscaler.apiserver.broker.server.dashboard_redirect_uri") %>
use_buildin_mode: <%= p("autoscaler.apiserver.use_buildin_mode") %>

health:
port: <%= p("autoscaler.apiserver.health.port") %>
Expand All @@ -109,13 +104,11 @@ db:
max_open_connections: <%= p("autoscaler.policy_db_connection_config.max_open_connections") %>
max_idle_connections: <%= p("autoscaler.policy_db_connection_config.max_idle_connections") %>
connection_max_lifetime: <%= p("autoscaler.policy_db_connection_config.connection_max_lifetime") %>
<% if p("autoscaler.apiserver.use_buildin_mode") == false %>
binding_db:
url: <%= binding_db_url %>
max_open_connections: <%= p("autoscaler.binding_db_connection_config.max_open_connections") %>
max_idle_connections: <%= p("autoscaler.binding_db_connection_config.max_idle_connections") %>
connection_max_lifetime: <%= p("autoscaler.binding_db_connection_config.connection_max_lifetime") %>
<% end %>
<% if p("autoscaler.storedprocedure_db.address") != '' %>
storedprocedure_db:
url: <%= storedprocedure_db_url %>
Expand Down
6 changes: 0 additions & 6 deletions operations/use_buildin_mode.yml

This file was deleted.

5 changes: 4 additions & 1 deletion spec/fixtures/apiserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ autoscaler:
apiserver:
broker:
server:
dashboard_redirect_uri: https://application-autoscaler-dashboard.cf.domain
dashboard_redirect_uri: https://application-autoscaler-dashboard.cf.domain
broker_credentials:
- broker_username: fake_b_user_1
broker_password: fake_b_password_1
8 changes: 2 additions & 6 deletions spec/jobs/golangapiserver/apiserver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
let(:properties) { YAML.safe_load(fixture("apiserver.yml").read) }
let(:rendered_template) { YAML.safe_load(template.render(properties)) }

context "apiserver does not use buildin mode" do
before(:each) do
properties["autoscaler"]["apiserver"].merge!(
"use_buildin_mode" => false
)
end
context "handles broker credentials" do

it "writes service_broker_usernames" do
properties["autoscaler"]["apiserver"]["broker"]["broker_credentials"] = [
Expand All @@ -38,6 +33,7 @@
end

it "writes deprecated service_broker_usernames" do
properties["autoscaler"]["apiserver"]["broker"]["broker_credentials"] = nil
properties["autoscaler"]["apiserver"]["broker"].merge!(
"username" => "deprecated_username",
"password" => "deprecated_password"
Expand Down
2 changes: 0 additions & 2 deletions src/autoscaler/api/cmd/api/api_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ var _ = SynchronizedBeforeSuite(func() []byte {
MetricsForwarderUrl: "http://localhost:8088",
}

cfg.UseBuildInMode = false

cfg.CF.API = ccServer.URL()
cfg.CF.ClientID = "client-id"
cfg.CF.Secret = "client-secret"
Expand Down
Loading

0 comments on commit 1f682a9

Please sign in to comment.