Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
213daf2
feat: Add OAuth2 password grant for Event Generator log-cache access
bonzofenix Apr 13, 2026
bb62bc5
feat: Add acceptance test org/user management with OrgManager support
bonzofenix Apr 13, 2026
390b5c5
feat: Add password grant support to CF client configuration
bonzofenix Apr 13, 2026
836f1f1
fix: Remove unused nolint:gosec directives in acceptance tests
bonzofenix Apr 13, 2026
0e1cad8
fix: Address CI failures from gosec lint and config test
bonzofenix Apr 13, 2026
5347ef5
fix: Prevent thundering herd in token refresh and remove redundant co…
bonzofenix Apr 13, 2026
e073dc8
fix: Move OAuth2 client tests to package metric_test to fix dual RunS…
bonzofenix Apr 14, 2026
b6d9c72
fix: Add explicit returns and [[ for shell scripts per SonarCloud
bonzofenix Apr 15, 2026
6066048
refactor: Use admin on main, org-manager on PRs for acceptance tests
bonzofenix Apr 20, 2026
55025b2
refactor: optimize cleanup and clarify BoolOrInt comment
bonzofenix Apr 20, 2026
0040eef
docs: clarify nosec G402 comments - controlled by config for dev/test
bonzofenix Apr 20, 2026
182239f
fix: format BoolOrInt comment for gofmt
bonzofenix Apr 21, 2026
b91b00f
fix: revert to correct gofmt format for comment list
bonzofenix Apr 21, 2026
6a83205
fix: add blank lines around comment list for gofmt
bonzofenix Apr 21, 2026
b82915d
fix: reduce disk test write from 800MB to 650MB to prevent timeout flake
bonzofenix May 11, 2026
9580b9e
test: add timing assertion for 650MB disk write
bonzofenix May 11, 2026
b9139e2
fix: restore concurrentHttpGet and fix CF config test assertion
bonzofenix Jun 3, 2026
797c0dd
fix: remove trailing newline from dynamic_policy_test.go (gofmt)
bonzofenix Jun 3, 2026
27685b5
fix: run set-security-group as admin, not org-manager-user
bonzofenix Jun 3, 2026
ea1c3a4
ci: use SAP_autoscaler_tests_OSS org for PR acceptance tests
bonzofenix Jun 8, 2026
b8206ab
ci: set EXISTING_ORGANIZATION to SAP_autoscaler_tests_OSS for PRs
bonzofenix Jun 8, 2026
d837368
fix: restore POSTGRES_URI export in build-extension-file.sh
bonzofenix Jun 8, 2026
abec1f4
fix: grant org-manager-user access to EXISTING_ORGANIZATION
bonzofenix Jun 8, 2026
fab42dd
fix: don't reuse deployment space when using a shared existing org
bonzofenix Jun 8, 2026
596adf6
fix: grant OrgManager (not OrgAuditor) in EXISTING_ORGANIZATION
bonzofenix Jun 8, 2026
08520be
fix: enable service access for EXISTING_ORGANIZATION after broker reg…
bonzofenix Jun 8, 2026
6f011e2
ci: retrigger acceptance tests after stalled deploy
bonzofenix Jun 8, 2026
4442417
ci: retrigger after devbox install stall
bonzofenix Jun 8, 2026
72ad4eb
ci: retrigger after infra recovery wait
bonzofenix Jun 8, 2026
af23dda
ci: retrigger to probe infra recovery
bonzofenix Jun 8, 2026
39fd33b
ci: retrigger after devbox outage wait
bonzofenix Jun 8, 2026
b95fa8e
ci: retrigger after devbox partial recovery
bonzofenix Jun 8, 2026
67ccd37
ci: retrigger acceptance tests
bonzofenix Jun 8, 2026
8145749
ci: retrigger acceptance tests after 5h devbox stall
bonzofenix Jun 8, 2026
5893b9e
ci: retrigger acceptance tests
bonzofenix Jun 8, 2026
bcd10ce
ci: retrigger acceptance tests
bonzofenix Jun 8, 2026
fb32c4a
ci: retrigger acceptance tests
bonzofenix Jun 8, 2026
af4fef3
ci: retrigger acceptance tests
bonzofenix Jun 8, 2026
f3422b3
ci: retrigger acceptance tests
bonzofenix Jun 8, 2026
34c151e
ci: retrigger acceptance tests
bonzofenix Jun 8, 2026
ebace86
ci: retrigger acceptance tests clean
bonzofenix Jun 8, 2026
2fd5622
ci: retrigger acceptance tests
bonzofenix Jun 8, 2026
c390e07
fix: use per-node teardown in AfterSuite to prevent space deletion races
bonzofenix Jun 8, 2026
0bf740f
ci: configure metricsforwarder to use external metricsgateway URL for…
bonzofenix Jun 9, 2026
b0930cb
ci: read existing org from ACCEPTANCE_TESTS_EXISTING_ORG repo variable
bonzofenix Jun 9, 2026
1f29ba2
fix: use existing org guid for metricsgateway XFCC validation in PR d…
bonzofenix Jun 9, 2026
30bf469
ci: deploy autoscaler into shared org for PR acceptance tests
bonzofenix Jun 9, 2026
cb55143
fix: pass AUTOSCALER_ORG to acceptance_tests job in reusable workflow
bonzofenix Jun 9, 2026
ff00e47
ci: pass AUTOSCALER_ORG to deployment_cleanup job
bonzofenix Jun 9, 2026
b848769
ci: move security group setup to Concourse infrastructure pipeline
bonzofenix Jun 10, 2026
02ec481
ci: bind security groups org-wide, fix metricsgateway org to system
bonzofenix Jun 10, 2026
69b7a5d
ci: deploy main acceptance tests into system org
bonzofenix Jun 10, 2026
94a22e3
ci: remove set-security-group script and Makefile targets
bonzofenix Jun 10, 2026
6545e2c
ci: temporarily point ci resource to fixed-acceptance-test-org-v2 for…
bonzofenix Jun 10, 2026
53d75c4
ci: bind postgres security group to both system and SAP_autoscaler_te…
bonzofenix Jun 10, 2026
6a28537
fix: gofmt formatting in dynamic_policy_test.go
bonzofenix Jun 10, 2026
a56fc44
ci: rebind postgres security group to space after recreation
bonzofenix Jun 10, 2026
4ad5931
ci: extract org manager user creation to one-off workflow
bonzofenix Jun 11, 2026
f84738c
ci: exclude GH_TOKEN from devbox printenv to prevent overwrite
bonzofenix Jun 15, 2026
7932335
ci: remove org manager user setup from acceptance test workflow
bonzofenix Jun 15, 2026
1ac74bb
ci: replace credhub org manager password fetch with GitHub secret
bonzofenix Jun 15, 2026
17336e8
fix: remove other_user_password from credhub template (no longer gene…
bonzofenix Jun 15, 2026
bf5f606
fix: generate other-user password locally and create CF user at deplo…
bonzofenix Jun 15, 2026
b8d1fb9
refactor: simplify CF credential setup and fix broken cf_login reference
bonzofenix Jun 15, 2026
6379859
ci: read other-user password from GH secret instead of creating at de…
bonzofenix Jun 15, 2026
c14afbb
fix: grant SpaceDeveloper to org-manager-user after space creation
bonzofenix Jun 15, 2026
e13d0cf
Revert "fix: grant SpaceDeveloper to org-manager-user after space cre…
bonzofenix Jun 15, 2026
50073d1
fix: grant SpaceDeveloper/SpaceManager to org-manager-user after spac…
bonzofenix Jun 15, 2026
4341586
fix: don't reuse deployment space for acceptance tests + grant space …
bonzofenix Jun 15, 2026
9a3e0a9
Revert "fix: don't reuse deployment space for acceptance tests + gran…
bonzofenix Jun 15, 2026
6f33d78
fix: use deployment login instead of admin for space role grants
bonzofenix Jun 16, 2026
c3357c4
fix: use cf bind-running-security-group for global binding (#1264)
bonzofenix Jun 16, 2026
b68e107
fix: use --space-scoped service broker for PR deployments
bonzofenix Jun 16, 2026
498df9c
fix: target org/space before space-scoped service broker creation
bonzofenix Jun 16, 2026
5ec10b4
fix: use v3 API in find_or_create_{org,space} to fix OrgManager visib…
bonzofenix Jun 24, 2026
cf3ddc0
fix: use cf_admin_login in Grant space roles step
bonzofenix Jun 24, 2026
4d1994a
fix: use cf_admin_login in create-org-manager-user.sh
bonzofenix Jun 24, 2026
051deae
fix: scope v3 spaces API query by org GUID to prevent cross-org matches
bonzofenix Jun 24, 2026
1f6c451
refactor: simplify common.sh login/space functions
bonzofenix Jun 24, 2026
4ea5f2d
fix: have org-manager-user create space to retain SpaceDeveloper role
bonzofenix Jun 24, 2026
649d007
refactor: rename cf_admin_login to cf_login
bonzofenix Jun 25, 2026
dde16e4
Remove unused service instance deletion functions from common.sh
bonzofenix Jun 25, 2026
c465c34
fix: remove dead code in CleanupInExistingOrg using undefined variables
bonzofenix Jun 25, 2026
e680fe2
fix: make find_or_create_space non-fatal when space exists but not vi…
bonzofenix Jun 25, 2026
3a0cc73
fix: prevent cleanup_apps from creating space as admin
bonzofenix Jun 25, 2026
b35ad6c
fix: prevent cleanup_apps from creating space as admin
bonzofenix Jun 25, 2026
f4a64cf
fix: remove admin from space setup, rely on cleanup for fresh space
bonzofenix Jun 26, 2026
c14102e
fix: resolve shellcheck CI failure in deploy-postgres.sh
bonzofenix Jun 26, 2026
14b7c50
fix: restore create_cf_test_user function in create-org-manager-user.sh
bonzofenix Jun 26, 2026
688e221
fix: explicitly assign SpaceDeveloper role after space creation
bonzofenix Jun 26, 2026
129598f
fix: remove spurious broker password lines from load_secrets
bonzofenix Jun 26, 2026
333d331
fix: remove register-broker step deleted by upstream PR #1251
bonzofenix Jun 26, 2026
3e5b98d
refactor: remove unused delete_service_broker function
bonzofenix Jun 26, 2026
02dedef
refactor: remove unused enable-service-access.sh script
bonzofenix Jun 26, 2026
043d431
refactor: remove dead functions from common.sh
bonzofenix Jun 26, 2026
3b84829
refactor: simplify cleanup_apps and CleanupInExistingOrg
bonzofenix Jun 26, 2026
1b86840
refactor: revert CleanupInExistingOrg to main's efficient pattern
bonzofenix Jun 26, 2026
23b95ea
refactor: remove org/space creation, cleanup script, and fix security…
bonzofenix Jun 26, 2026
5979c00
fix: validate AUTOSCALER_ORG_MANAGER_PASSWORD before cf auth
bonzofenix Jun 26, 2026
02fdfdc
refactor: remove redundant logins and double CF API call in task polling
bonzofenix Jun 26, 2026
27be2b5
fix: improve error handling, validation, and template correctness
bonzofenix Jun 29, 2026
3764af3
fix: address review comments - conditional grant type and helper func…
bonzofenix Jun 29, 2026
5ffe6c7
feat: add apiserver to password grant credential loop for PR deployments
bonzofenix Jun 29, 2026
2db0956
fix: exclude shared org SAP_autoscaler_tests_OSS from cleanup workflow
bonzofenix Jun 29, 2026
d0b07a1
refactor: simplify cleanup org filter and reduce API calls in task po…
bonzofenix Jun 29, 2026
61e2075
fix: improve error handling in broker query and ensure org/space exis…
bonzofenix Jun 29, 2026
c806437
fix: validate passwords for PR deployments and fix stale comment
bonzofenix Jun 29, 2026
e157179
refactor: rename create-org-manager-user to setup-acceptance-tests
bonzofenix Jun 29, 2026
13d82cf
fix: skip UAA introspect for IsUserAdmin when using password grant
bonzofenix Jun 29, 2026
760dd18
Merge branch 'main' into fixed-acceptance-test-org-v2
bonzofenix Jun 29, 2026
584f6c0
Remove unused `autoscaler_org_manager_user` local variable assignment
bonzofenix Jun 29, 2026
f4339fc
refactor: remove existing_organization input and fix autoscaler_org f…
bonzofenix Jun 29, 2026
f734476
Pass org user credentials to acceptance tests config and scope secret…
bonzofenix Jun 29, 2026
4623343
Merge branch 'main' into fixed-acceptance-test-org-v2
bonzofenix Jun 29, 2026
746d6a1
feat: set METRICSFORWARDER_METRICS_GATEWAY_URL GitHub var in setup-ac…
bonzofenix Jun 29, 2026
5cb5aab
fix: pass user credentials to Deploy Apps step in reusable workflow
bonzofenix Jun 29, 2026
a8db6f0
feat: add SYSTEM_DOMAIN input to workflows for configurable CF API en…
bonzofenix Jun 29, 2026
679272e
fix: add --origin uaa to cf auth for org manager login
bonzofenix Jun 29, 2026
6a0723b
feat: add AUTOSCALER_ORG input to workflows, use ACCEPTANCE_TESTS_EXI…
bonzofenix Jun 29, 2026
c2c6316
fix: create space if not exists before targeting in build-extension-file
bonzofenix Jun 29, 2026
efda9f6
fix: use SYSTEM_DOMAIN from env var if set, don't override
bonzofenix Jun 29, 2026
d5b2e79
chore: use default java_buildpack in MTA template
bonzofenix Jun 29, 2026
1463aa2
feat: support non-OSS infrastructure via CF managed service for DB
bonzofenix Jun 30, 2026
3af9a44
fix: pass org manager credentials to Create Acceptance Space step
bonzofenix Jun 30, 2026
e00d119
fix: cleanup CF service on non-OSS infrastructure
bonzofenix Jun 30, 2026
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
9 changes: 9 additions & 0 deletions .github/workflows/acceptance_tests_mta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@ jobs:
with:
deployment_name: "autoscaler-mta-${{ github.event.pull_request.number || 'main' }}"
use_metricsgateway: ${{ github.event_name == 'pull_request' }}
system_domain: "${{ vars.SYSTEM_DOMAIN }}"
autoscaler_org: "${{ vars.ACCEPTANCE_TESTS_EXISTING_ORG }}"
autoscaler_org_manager_user: "${{ vars.AUTOSCALER_ORG_MANAGER_USER }}"
autoscaler_other_user: "${{ vars.AUTOSCALER_OTHER_USER }}"
infrastructure: "${{ vars.INFRASTRUCTURE }}"
postgres_service_offering: "${{ vars.POSTGRES_SERVICE_OFFERING }}"
postgres_service_plan: "${{ vars.POSTGRES_SERVICE_PLAN }}"
secrets:
bbl_ssh_key: "${{ secrets.BBL_SSH_KEY }}"
autoscaler_org_manager_password: "${{ secrets.AUTOSCALER_ORG_MANAGER_PASSWORD }}"
autoscaler_other_user_password: "${{ secrets.AUTOSCALER_OTHER_USER_PASSWORD }}"
73 changes: 73 additions & 0 deletions .github/workflows/acceptance_tests_reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,41 @@ on:
required: false
type: boolean
default: false
system_domain:
required: false
type: string
default: ""
autoscaler_org:
required: false
type: string
default: ""
autoscaler_org_manager_user:
required: false
type: string
default: ""
autoscaler_other_user:
required: false
type: string
default: ""
infrastructure:
required: false
type: string
default: "OSS"
postgres_service_offering:
required: false
type: string
default: ""
postgres_service_plan:
required: false
type: string
default: ""
secrets:
bbl_ssh_key:
required: true
autoscaler_org_manager_password:
required: false
autoscaler_other_user_password:
required: false

defaults:
run:
Expand Down Expand Up @@ -54,14 +86,44 @@ jobs:
with:
ssh-key: ${{ secrets.bbl_ssh_key}}

- name: Create Acceptance Space
shell: bash
env:
SYSTEM_DOMAIN: ${{ inputs.system_domain }}
AUTOSCALER_ORG: ${{ inputs.autoscaler_org }}
AUTOSCALER_ORG_MANAGER_USER: ${{ inputs.autoscaler_org_manager_user }}
AUTOSCALER_ORG_MANAGER_PASSWORD: ${{ secrets.autoscaler_org_manager_password }}
INFRASTRUCTURE: ${{ inputs.infrastructure }}
run: make --directory="${AUTOSCALER_DIR}" create-acceptance-space

- name: Provision DB
if: inputs.infrastructure == 'OSS'
shell: bash
run: make --directory="${AUTOSCALER_DIR}" provision-db

- name: Provision DB Service
if: inputs.infrastructure != 'OSS'
shell: bash
env:
SYSTEM_DOMAIN: ${{ inputs.system_domain }}
AUTOSCALER_ORG: ${{ inputs.autoscaler_org }}
AUTOSCALER_ORG_MANAGER_USER: ${{ inputs.autoscaler_org_manager_user }}
AUTOSCALER_ORG_MANAGER_PASSWORD: ${{ secrets.autoscaler_org_manager_password }}
POSTGRES_SERVICE_OFFERING: ${{ inputs.postgres_service_offering }}
POSTGRES_SERVICE_PLAN: ${{ inputs.postgres_service_plan }}
run: make --directory="${AUTOSCALER_DIR}" provision-db-service

- name: Deploy Apps
shell: bash
env:
USE_METRICSGATEWAY: ${{ inputs.use_metricsgateway }}
SYSTEM_DOMAIN: ${{ inputs.system_domain }}
AUTOSCALER_ORG: ${{ inputs.autoscaler_org }}
AUTOSCALER_ORG_MANAGER_USER: ${{ inputs.autoscaler_org_manager_user }}
AUTOSCALER_ORG_MANAGER_PASSWORD: ${{ secrets.autoscaler_org_manager_password }}
AUTOSCALER_OTHER_USER: ${{ inputs.autoscaler_other_user }}
AUTOSCALER_OTHER_USER_PASSWORD: ${{ secrets.autoscaler_other_user_password }}
INFRASTRUCTURE: ${{ inputs.infrastructure }}
run: |
make --directory="${AUTOSCALER_DIR}" build-extension-file
make --directory="${AUTOSCALER_DIR}" mta-build
Expand Down Expand Up @@ -98,6 +160,11 @@ jobs:
shell: bash
env:
SUITES: ${{ matrix.suite }}
SYSTEM_DOMAIN: ${{ inputs.system_domain }}
AUTOSCALER_ORG_MANAGER_USER: ${{ inputs.autoscaler_org_manager_user }}
AUTOSCALER_ORG_MANAGER_PASSWORD: ${{ secrets.autoscaler_org_manager_password }}
AUTOSCALER_OTHER_USER: ${{ inputs.autoscaler_other_user }}
AUTOSCALER_OTHER_USER_PASSWORD: ${{ secrets.autoscaler_other_user_password }}
run: make --directory="${AUTOSCALER_DIR}" mta-acceptance-tests

deployment_cleanup:
Expand Down Expand Up @@ -125,6 +192,12 @@ jobs:
with:
ssh-key: ${{ secrets.bbl_ssh_key}}
- name: Perform deployment cleanup
env:
SYSTEM_DOMAIN: ${{ inputs.system_domain }}
AUTOSCALER_ORG: ${{ inputs.autoscaler_org }}
AUTOSCALER_ORG_MANAGER_USER: ${{ inputs.autoscaler_org_manager_user }}
AUTOSCALER_ORG_MANAGER_PASSWORD: ${{ secrets.autoscaler_org_manager_password }}
INFRASTRUCTURE: ${{ inputs.infrastructure }}
run: |
make --directory="${AUTOSCALER_DIR}" deploy-cleanup

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: Create CI Test Users
name: Setup Acceptance Tests

on:
workflow_dispatch:
inputs:
org:
autoscaler_org:
required: true
type: string
description: "CF org to grant OrgManager role in"
existing_organization:
required: false
type: string
default: "SAP_autoscaler_tests_OSS"
description: "CF org to create the CI test users in"
default: ""
description: "Additional CF org to grant OrgManager role in (if different from autoscaler_org)"

defaults:
run:
Expand All @@ -16,12 +20,11 @@ defaults:
env:
AUTOSCALER_DIR: "${{ github.workspace }}/app-autoscaler"
BBL_STATE_PATH: "${{ github.workspace }}/bbl/bbl-state"
AUTOSCALER_ORG: "${{ inputs.org }}"
DEPLOYMENT_NAME: "autoscaler-mta-main"
AUTOSCALER_ORG: "${{ inputs.autoscaler_org }}"

jobs:
create_ci_test_users:
name: Create CI Test Users
setup_acceptance_tests:
name: Setup Acceptance Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -39,15 +42,16 @@ jobs:
run: |
cd "${AUTOSCALER_DIR}"
eval "$(devbox shellenv)"
printenv >> "$GITHUB_ENV"
printenv | grep -v '^GH_TOKEN=' >> "$GITHUB_ENV"

- name: Setup environment
uses: ./app-autoscaler/.github/actions/setup-environment
with:
ssh-key: ${{ secrets.BBL_SSH_KEY }}

- name: Create CI test users and store credentials
- name: Setup acceptance tests (create users, org, space)
env:
GH_TOKEN: ${{ secrets.APP_AUTOSCALER_CI_TOKEN }}
EXISTING_ORGANIZATION: ${{ inputs.existing_organization }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make --directory="${AUTOSCALER_DIR}" create-org-manager-user
make --directory="${AUTOSCALER_DIR}" setup-acceptance-tests
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,18 @@ target/init-db-${db_type}:
@mkdir -p target
@touch $@

.PHONY: create-acceptance-space
create-acceptance-space: ## Create the CF org/space for acceptance tests
@./scripts/create-acceptance-space.sh

.PHONY: provision-db
provision-db: ## Provision a database on a remote Postgres server (requires POSTGRES_IP)
@./scripts/provision_db.sh

.PHONY: provision-db-service
provision-db-service: ## Provision a CF service instance as the database (non-OSS)
@./scripts/provision-db-service.sh

.PHONY: deprovision-db
deprovision-db: ## Deprovision a database on a remote Postgres server (requires POSTGRES_IP)
@./scripts/deprovision_db.sh
Expand Down Expand Up @@ -382,6 +390,10 @@ cf-login:
'The necessary changes to the environment get lost when make exits its process.'
@${MAKEFILE_DIR}/scripts/os-infrastructure-login.sh

.PHONY: deploy-cleanup
deploy-cleanup:
DEBUG="${DEBUG}" ./scripts/cleanup-autoscaler.sh


.PHONY: start-db
start-db: check-db_type target/start-db-${db_type}_CI_${CI} waitfor_${db_type}_CI_${CI}
Expand Down Expand Up @@ -495,9 +507,6 @@ build-test-app:
acceptance.build_tests:
@make --directory=acceptance build_tests

.PHONY: acceptance.tests-cleanup
acceptance.tests-cleanup:
@make --directory=acceptance acceptance-tests-cleanup

# This target is defined here rather than directly in the component “scheduler” itself, because it depends on targets outside that component. In the future, it will be moved back to that component and reference a dependency to a Makefile on the same level – the one for the component it depends on.
.PHONY: scheduler.test
Expand Down Expand Up @@ -537,9 +546,6 @@ build-acceptance-tests:
acceptance-tests: build-test-app acceptance-tests-config ## Run acceptance tests against OSS dev environment (requrires a previous deployment of the autoscaler)
@make --directory='acceptance' run-acceptance-tests

.PHONY: acceptance-cleanup
acceptance-cleanup:
@make --directory='acceptance' acceptance-tests-cleanup

.PHONY: acceptance-tests-config
acceptance-tests-config:
Expand All @@ -556,9 +562,9 @@ mta-acceptance-tests: ## Run MTA acceptance tests in parallel via CF tasks
deploy-cleanup:
DEBUG="${DEBUG}" ./scripts/cleanup-autoscaler.sh

.PHONY: create-org-manager-user
create-org-manager-user:
DEBUG="${DEBUG}" ./scripts/create-org-manager-user.sh
.PHONY: setup-acceptance-tests
setup-acceptance-tests:
DEBUG="${DEBUG}" ./scripts/setup-acceptance-tests.sh

.PHONY: deploy-apps
deploy-apps:
Expand Down
6 changes: 1 addition & 5 deletions acceptance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export GOWORK := off

.PHONY: clean
clean:
rm --recursive --force './build' './vendor' './ginkgo_v2' './results'
@make --directory='./assets/app/go_app' clean
rm --recursive --force './vendor'


.PHONY: go-mod-tidy
Expand Down Expand Up @@ -86,6 +85,3 @@ run-acceptance-tests: acceptance-tests-config
@${MAKEFILE_DIR}/../scripts/run-acceptance-tests.sh


.PHONY: acceptance-tests-cleanup
acceptance-tests-cleanup: acceptance-tests-config
@${MAKEFILE_DIR}/../scripts/cleanup-acceptance.sh
2 changes: 1 addition & 1 deletion acceptance/assets/app/go_app/internal/app/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ var _ = Describe("Disk write timing", func() {
It("completes within 25 seconds", func() {
filePath := filepath.Join(GinkgoT().TempDir(), "disk-timing-test")
occupier := app.NewDefaultDiskOccupier(filePath)
DeferCleanup(occupier.Stop)

spaceInBytes := int64(650) * 1000 * 1000 // matches acceptance test: 650 * 1000 * 1000

Expand All @@ -263,6 +262,7 @@ var _ = Describe("Disk write timing", func() {
Expect(err).ToNot(HaveOccurred())
Expect(fStat.Size()).To(Equal(spaceInBytes))

occupier.Stop()
GinkgoWriter.Printf("650MB write completed in %v\n", elapsed)
})
})
Expand Down
18 changes: 8 additions & 10 deletions acceptance/broker/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,21 +352,19 @@ type ServicePlans []ServicePlan
type BoolOrInt bool

func (b *BoolOrInt) UnmarshalJSON(data []byte) error {
if len(data) > 0 && (data[0] == 't' || data[0] == 'f') {
var boolVal bool
if err := json.Unmarshal(data, &boolVal); err != nil {
return err
}
var boolVal bool
if err := json.Unmarshal(data, &boolVal); err == nil {
*b = BoolOrInt(boolVal)
return nil
}

var intVal int
if err := json.Unmarshal(data, &intVal); err != nil {
return fmt.Errorf("cannot unmarshal %s into BoolOrInt", string(data))
if err := json.Unmarshal(data, &intVal); err == nil {
*b = BoolOrInt(intVal != 0)
return nil
}
*b = BoolOrInt(intVal != 0)
return nil

return fmt.Errorf("cannot unmarshal %s into BoolOrInt", string(data))
}

type (
Expand Down Expand Up @@ -411,7 +409,7 @@ func GetServicePlans(cfg *config.Config) ServicePlans {
}

func (p ServicePlan) isUpdatable() bool {
return p.BrokerCatalog.Features.PlanUpdateable.Bool()
return bool(p.BrokerCatalog.Features.PlanUpdateable)
}

func (b BoolOrInt) Bool() bool { return bool(b) }
Expand Down
7 changes: 7 additions & 0 deletions cf/cfclient_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ func (w *CFClientWrapper) Login(ctx context.Context) error {
}

func (w *CFClientWrapper) IsUserAdmin(ctx context.Context, userToken string) (bool, error) {
// Password grant uses the public "cf" client (no secret). UAA /introspect requires
// confidential client credentials, so it would always fail. On password-grant deployments
// (PR environments) the caller is an OrgManager, never a CC admin, so returning false is correct.
if w.conf.IsPasswordGrant() {
return false, nil
}

resp, err := w.introspectToken(ctx, userToken)
if err != nil {
return false, err
Expand Down
16 changes: 16 additions & 0 deletions cf/cfclient_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,22 @@ var _ = Describe("CFClientWrapper", func() {
Expect(err).NotTo(HaveOccurred())
Expect(isAdmin).To(BeFalse())
})

Context("when using password grant", func() {
BeforeEach(func() {
conf.GrantType = cf.GrantTypePassword
conf.Username = "test-user"
conf.Password = "test-password"
conf.Secret = ""
})

It("returns false without calling introspect", func() {
// No mockServer.Add().Introspect() — any introspect call would fail the test
isAdmin, err := client.IsUserAdmin(ctx, "user-token")
Expect(err).NotTo(HaveOccurred())
Expect(isAdmin).To(BeFalse())
})
})
})

Describe("IsUserSpaceDeveloper", func() {
Expand Down
2 changes: 1 addition & 1 deletion ci/infrastructure/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ resources:
source:
uri: git@github.com:cloudfoundry/app-autoscaler
private_key: ((autoscaler-deploy-key-private))
branch: worktree-APPAUTOSCALER-1033-move-ci-pipelines
branch: main
fetch_tags: true
paths:
- ci/infrastructure
Expand Down
10 changes: 10 additions & 0 deletions ci/infrastructure/scripts/deploy-metricsgateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ EOF
echo "${ext_file}"
}

function setup_security_group() {
local sg_file
sg_file="$(dirname "${BASH_SOURCE[0]}")/../security-groups/metricsgateway.json"
log "Binding metricsgateway security group to org '${cf_org}'"
cf create-security-group metricsgateway "${sg_file}" || true
cf update-security-group metricsgateway "${sg_file}"
cf bind-security-group metricsgateway "${cf_org}"
}

function deploy_metricsgateway() {
local ext_file
ext_file="$(build_extension_file)"
Expand All @@ -94,6 +103,7 @@ cf_login "${system_domain}"
cf target -o "${cf_org}" -s "${cf_space}"
generate_secrets
deploy_metricsgateway
setup_security_group

log "metricsgateway deployed:"
cf app metricsgateway
Loading
Loading