Skip to content

Fix API workspace SCC selection for container run mode - #24039

Open
SkorikSergey wants to merge 1 commit into
eclipse-che:mainfrom
SkorikSergey:temp/cpp-api-scc-fix
Open

SkorikSergey wants to merge 1 commit into
eclipse-che:mainfrom
SkorikSergey:temp/cpp-api-scc-fix

Conversation

@SkorikSergey

@SkorikSergey SkorikSergey commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

API-created workspaces always requested the container-build security context constraint (SCC). When container run mode was enabled, workspace pods also requested CHOWN, which container-build does not allow. OpenShift therefore rejected workspace creation.

Update the shared configuration helper to select the SCC from CheCluster settings. Container run mode takes priority over build mode, custom SCC names are respected, and the SCC attribute is omitted when both modes are disabled.

The new CheCluster lookup requires authentication during configuration generation, so these tests also need setup changes:

  • EmptyWorkspaceAPI and DevfileAcceptanceTestAPI: log in before generating the configuration.
  • PredefinedNamespace: read installation settings as admin, then switch to the regular user before creating the workspace.

Screenshot/screencast of this PR

What issues does this PR fix or reference?

https://redhat.atlassian.net/browse/CRW-14539

How to test this PR?

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Summary by CodeRabbit

  • Bug Fixes
    • DevWorkspace configuration now preserves existing template attributes while applying configured workspace and storage settings.
    • Security context settings now reflect enabled container-run or container-build capabilities, and the related setting is omitted when both are disabled.
    • Configuration remains unchanged when a DevWorkspace template is unavailable.
  • Tests
    • Updated workspace setup checks to perform authentication and configuration steps in the correct order.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The E2E tests now perform OCP login at different points in setup. The DevWorkspace configuration helper preserves template attributes and selects the SCC attribute from configured container capabilities.

Changes: API test login order

Layer / File(s) Summary
Move API test login into setup
tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts, tests/e2e/specs/api/EmptyWorkspaceAPI.spec.ts
Both API suites log in during setup. The Devfile acceptance test generates its context after login; the empty-workspace suite assigns workspace details and initializes the terminal in setup.

DevWorkspace configuration

Layer / File(s) Summary
Select template attributes from capabilities
tests/e2e/utils/DevWorkspaceConfigurationHelper.ts
The helper preserves existing template attributes, adds configuration and storage attributes, and selects or removes the SCC attribute based on devEnvironments capabilities. It returns without changes when the template is absent.
Generate configuration before regular-user login
tests/e2e/specs/miscellaneous/PredefinedNamespace.spec.ts
The test generates DevWorkspace configuration under the existing admin session, then logs in as the regular user before applying the configuration.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: nallikaea, musienko-maxim

Merge Risk: Minimal · up to e1d9b

This change fixes SCC selection for API-created workspaces in container run mode and adjusts E2E login order to match. No concrete merge-blocking risk remains after review.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: API-created workspaces now select the SCC for container run mode instead of always requesting container-build. The raw summary confirms the helper change prioritizes r…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: API-created workspaces now select the SCC for container run mode instead of always requesting container-build. The raw summary confirms the helper change prioritizes run-mode SCC, and the objectives describe the same fix, so the title matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a221b100-c271-47ad-b6fa-0205bbfaaf09
Commits

Reviewing files that changed from the base of the PR and between e7f07dd and e1d9b2e.

Files selected for processing: 4

  • tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts
  • tests/e2e/specs/api/EmptyWorkspaceAPI.spec.ts
  • tests/e2e/specs/miscellaneous/PredefinedNamespace.spec.ts
  • tests/e2e/utils/DevWorkspaceConfigurationHelper.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Signed-off-by: SkorikSergey <sskoryk@redhat.com>
@SkorikSergey
SkorikSergey marked this pull request as ready for review November 28, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants