Skip to content

Commit 60bc5d7

Browse files
committed
ci: merge main - replace credhub generate with openssl rand
Resolve conflicts: - build-extension-file.sh: take main's load_secrets (passwords now generated locally, not fetched from credhub) - acceptance_tests_reusable.yaml: drop register-broker step (merged into mta-deploy) - register-broker.sh: accept deletion (merged into mta-deploy.sh)
2 parents b8aebc2 + 3bd67ce commit 60bc5d7

5 files changed

Lines changed: 38 additions & 93 deletions

File tree

.github/workflows/acceptance_tests_reusable.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ jobs:
101101
make --directory="${AUTOSCALER_DIR}" mta-build
102102
make --directory="${AUTOSCALER_DIR}" mta-deploy
103103
104-
- name: Register autoscaler
105-
shell: bash
106-
env:
107-
EXISTING_ORGANIZATION: ${{ inputs.existing_organization }}
108-
run: make --directory="${AUTOSCALER_DIR}" register-broker
109-
110104
acceptance_tests:
111105
name: Acceptance Tests - ${{ matrix.suite }}
112106
needs: [ deploy_autoscaler ]

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,6 @@ mta-acceptance-tests: ## Run MTA acceptance tests in parallel via CF tasks
560560
# 🚧 To-do: These targets don't exist here!
561561
.PHONY: deploy-autoscaler deploy-autoscaler-bosh
562562

563-
.PHONY: deploy-register-cf
564-
deploy-register-cf:
565-
DEBUG="${DEBUG}" ./scripts/register-broker.sh
566-
567563
.PHONY: deploy-cleanup
568564
deploy-cleanup:
569565
DEBUG="${DEBUG}" ./scripts/cleanup-autoscaler.sh

scripts/build-extension-file.sh

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,25 @@ export SYSTEM_DOMAIN="autoscaler.app-runtime-interfaces.ci.cloudfoundry.org"
3333
export CPU_LOWER_THRESHOLD="${CPU_LOWER_THRESHOLD:-"100"}"
3434

3535
generate_deployment_secrets() {
36-
local prefix="/bosh-autoscaler/${DEPLOYMENT_NAME}"
37-
credhub generate --no-overwrite -n "${prefix}/autoscaler_metricsforwarder_health_password" --length 16 -t password
38-
credhub generate --no-overwrite -n "${prefix}/autoscaler_metricsgateway_health_password" --length 16 -t password
39-
credhub generate --no-overwrite -n "${prefix}/autoscaler_operator_health_password" --length 16 -t password
40-
credhub generate --no-overwrite -n "${prefix}/autoscaler_eventgenerator_health_password" --length 16 -t password
41-
credhub generate --no-overwrite -n "${prefix}/autoscaler_scalingengine_health_password" --length 16 -t password
42-
credhub generate --no-overwrite -n "${prefix}/service_broker_password_blue" --length 16 -t password
43-
credhub generate --no-overwrite -n "${prefix}/service_broker_password" --length 16 -t password
44-
return
36+
METRICSFORWARDER_HEALTH_PASSWORD="$(openssl rand -base64 12)"
37+
METRICSGATEWAY_HEALTH_PASSWORD="$(openssl rand -base64 12)"
38+
OPERATOR_HEALTH_PASSWORD="$(openssl rand -base64 12)"
39+
EVENTGENERATOR_HEALTH_PASSWORD="$(openssl rand -base64 12)"
40+
SCALINGENGINE_HEALTH_PASSWORD="$(openssl rand -base64 12)"
41+
SERVICE_BROKER_PASSWORD_BLUE="$(openssl rand -base64 12)"
42+
SERVICE_BROKER_PASSWORD="$(openssl rand -base64 12)"
43+
export METRICSFORWARDER_HEALTH_PASSWORD METRICSGATEWAY_HEALTH_PASSWORD
44+
export OPERATOR_HEALTH_PASSWORD EVENTGENERATOR_HEALTH_PASSWORD
45+
export SCALINGENGINE_HEALTH_PASSWORD SERVICE_BROKER_PASSWORD_BLUE SERVICE_BROKER_PASSWORD
4546
}
4647

4748
load_secrets() {
4849
local secrets_file="$1"
4950
# Map YAML keys → shell variable names, emitting `export VAR=value` lines
5051
local exports
5152
exports="$(yq '
52-
"export EVENTGENERATOR_HEALTH_PASSWORD=" + (.eventgenerator_health_password | @sh),
5353
"export EVENTGENERATOR_LOG_CACHE_UAA_CLIENT_ID=" + (.eventgenerator_log_cache_uaa_client_id | @sh),
5454
"export EVENTGENERATOR_LOG_CACHE_UAA_CLIENT_SECRET=" + (.eventgenerator_log_cache_uaa_client_secret | @sh),
55-
"export METRICSFORWARDER_HEALTH_PASSWORD=" + (.metricsforwarder_health_password | @sh),
56-
"export METRICSGATEWAY_HEALTH_PASSWORD=" + (.metricsgateway_health_password | @sh),
57-
"export SCALINGENGINE_HEALTH_PASSWORD=" + (.scalingengine_health_password | @sh),
58-
"export OPERATOR_HEALTH_PASSWORD=" + (.operator_health_password | @sh),
5955
"export CF_ADMIN_PASSWORD=" + (.cf_admin_password | @sh),
6056
"export POSTGRES_IP=" + (.postgres_ip | @sh),
6157
"export DATABASE_DB_USERNAME=" + (.database_username | @sh),
@@ -65,10 +61,7 @@ load_secrets() {
6561
"export DATABASE_DB_CLIENT_KEY=" + (.database_client_key | @sh),
6662
"export SYSLOG_CLIENT_CA=" + (.syslog_client_ca | @sh),
6763
"export SYSLOG_CLIENT_CERT=" + (.syslog_client_cert | @sh),
68-
"export SYSLOG_CLIENT_KEY=" + (.syslog_client_key | @sh),
69-
"export SERVICE_BROKER_PASSWORD_BLUE=" + (.service_broker_password_blue | @sh),
70-
"export SERVICE_BROKER_PASSWORD=" + (.service_broker_password | @sh),
71-
"export AUTOSCALER_OTHER_USER_PASSWORD=" + (.other_user_password | @sh)
64+
"export SYSLOG_CLIENT_KEY=" + (.syslog_client_key | @sh)
7265
' "${secrets_file}")"
7366
eval "${exports}"
7467
return
@@ -95,14 +88,6 @@ database_server_ca: ((/bosh-autoscaler/postgres/postgres_server.ca))
9588
database_client_cert: ((/bosh-autoscaler/postgres/postgres_server.certificate))
9689
database_client_key: ((/bosh-autoscaler/postgres/postgres_server.private_key))
9790
98-
metricsforwarder_health_password: ((/bosh-autoscaler/${DEPLOYMENT_NAME}/autoscaler_metricsforwarder_health_password))
99-
metricsgateway_health_password: ((/bosh-autoscaler/${DEPLOYMENT_NAME}/autoscaler_metricsgateway_health_password))
100-
operator_health_password: ((/bosh-autoscaler/${DEPLOYMENT_NAME}/autoscaler_operator_health_password))
101-
eventgenerator_health_password: ((/bosh-autoscaler/${DEPLOYMENT_NAME}/autoscaler_eventgenerator_health_password))
102-
scalingengine_health_password: ((/bosh-autoscaler/${DEPLOYMENT_NAME}/autoscaler_scalingengine_health_password))
103-
service_broker_password_blue: ((/bosh-autoscaler/${DEPLOYMENT_NAME}/service_broker_password_blue))
104-
service_broker_password: ((/bosh-autoscaler/${DEPLOYMENT_NAME}/service_broker_password))
105-
10691
cf_admin_password: ((/bosh-autoscaler/cf/cf_admin_password))
10792
other_user_password: ((/bosh-autoscaler/${DEPLOYMENT_NAME}/other_user_password))
10893
EOF

scripts/mta-deploy.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,30 @@ pushd "${autoscaler_dir}" > /dev/null
4242
cf deploy "${DEST}/${MTAR_FILENAME}" --version-rule ALL -f --delete-services -e "${EXTENSION_FILE}" -m "${MODULES}"
4343

4444
popd > /dev/null
45+
46+
# --- Register service broker ---
47+
# Extract broker password from the generated extension file (baked in by build-extension-file.sh)
48+
SERVICE_BROKER_PASSWORD="$(yq '.resources[] | select(.name == "apiserver-config") | .parameters.config."apiserver-config".broker_credentials[0].broker_password' "${EXTENSION_FILE}")"
49+
50+
cf_login
51+
52+
set +e
53+
existing_service_broker="$(cf curl v3/service_brokers | jq --raw-output \
54+
--arg service_broker_name "${deployment_name:-}" \
55+
'.resources[] | select(.name == $service_broker_name) | .name')"
56+
set -e
57+
58+
if [[ -n "${existing_service_broker}" ]]; then
59+
echo "Service Broker ${existing_service_broker} already exists"
60+
echo " - cleaning up pr"
61+
pushd "${autoscaler_dir}/acceptance" > /dev/null
62+
./cleanup.sh
63+
popd > /dev/null
64+
echo ' - deleting broker'
65+
cf delete-service-broker -f "${existing_service_broker}"
66+
fi
67+
68+
echo "Creating service broker ${deployment_name:-} at 'https://${service_broker_name:-}.${system_domain:-}'"
69+
cf create-service-broker "${deployment_name:-}" autoscaler-broker-user "${SERVICE_BROKER_PASSWORD}" "https://${service_broker_name:-}.${system_domain:-}"
70+
71+
cf logout

scripts/register-broker.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)