Skip to content

ResourceGroupTest fails in CI: HTTP 403 Forbidden on AICore.resourceGroups CREATE #24

@Schmarvinius

Description

@Schmarvinius

Summary

ResourceGroupTest (in integration-tests/spring) consistently errors out in CI with HTTP/1.1 403 Forbidden when creating resource groups against the AICore service. 4 of 5 tests in the class fail this way; the 5th (list_resourceGroups) passes because it only reads. This is a separate, pre-existing failure from the recommendation issue tracked in #22 — it has been red since the integration-tests pipeline was first wired up, and it survives the fix in #23.

Failing tests

  • ResourceGroupTest.create_andRead_resourceGroup (line 47)
  • ResourceGroupTest.create_withTenantLabel_andFilterByTenant (line 68)
  • ResourceGroupTest.create_withLabels (line 93)
  • ResourceGroupTest.delete_resourceGroup (line 122) — the underlying CREATE setup also 403s, then DELETE 404s on the missing group

Failure (CI run 26304484099, Java 17)

[ERROR] ResourceGroupTest.create_andRead_resourceGroup:47 » ContextualizedService java.io.IOException: Failed to process response: HTTP/1.1 403 Forbidden (service 'AICore', event 'CREATE', entity 'AICore.resourceGroups')

Caused by: com.sap.cloud.sdk.services.openapi.apache.core.OpenApiRequestException: java.io.IOException: Failed to process response: HTTP/1.1 403 Forbidden
    at com.sap.ai.sdk.core.client.ResourceGroupApi.create(ResourceGroupApi.java:118)
    at com.sap.cds.feature.aicore.core.handler.ResourceGroupHandler.onCreate(ResourceGroupHandler.java:114)

The same call also produces follow-up HTTP/1.1 404 Not Found errors for the matching DELETE because the resource group was never created.

Likely cause

The CI job binds an ai-core CF service via the cf-bind action. The resulting service key apparently does not carry the scopes required to CREATE/DELETE resource groups — only to LIST/READ. Either:

  1. The service plan / role collection used in the workflow secret is read-only (e.g. the sap-internal plan instance bound in CI exposes a key without aicore.resourceGroup.create permissions), or
  2. The bound key targets a tenant where the calling identity does not have admin rights on /v2/admin/resourceGroups.

This is an environment / CF-service-key configuration issue, not a code bug.

Repro

CI: every PR run touching Integration Tests (Java 17|21) against the cap-java/cds-ai cap-java-ai CF space exhibits this — see runs 26303582733 (main) and 26304484099 (PR #23).

Local: cds bind --to ai-core --on cf -k AICore-btp ... followed by cds bind --exec -- mvn -pl integration-tests/spring test -Dtest=ResourceGroupTest. Whether this 403s locally depends on which user / CF role you bind under — workflow secret vs developer login may differ.

Suggested fix path

  1. Check the role collection / scopes attached to the service key created by the CI workflow. The action is .github/actions/cf-bind; it logs in with ${{ secrets.CF_USERNAME }} (cap.calesi.munich@sap.com per the local CF target) and creates / reads a service key on ${{ secrets.CF_ORG_AWS }}/${{ secrets.CF_SPACE_AWS }}.
  2. Either grant the technical user the AICore_Admin (or equivalent) role collection in the bound subaccount, or re-create the bound ai-core instance with a plan that exposes admin scopes.
  3. If admin scopes cannot be granted to CI for policy reasons, mark the four failing methods with @DisabledIfEnvironmentVariable / a CI-skip tag, and document that resource-group CRUD is verified manually.

Workaround

Until this is sorted, the Integration Tests and SonarQube Scan jobs will remain red even with everything else passing. Reviewers should look at the surefire output rather than the job's exit code, and confirm only ResourceGroupTest.* is failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions