Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 4, 2025

This PR adds an additional confirmation step to hibernation and unhibernation operations to prevent accidental actions on applications and environments. Users are now required to type the application name or environment name to confirm the hibernation operation.

Changes Made

API Model Updates

  • Added optional confirmationName field to HibernateRequest model for single application operations
  • Added optional confirmationName field to BulkApplicationForEnvironmentPayload model for bulk operations
  • Both fields include proper JSON marshaling/unmarshaling support

Single Application Validation

Enhanced hibernation handlers to validate confirmation names against actual application names:

  • Helm Applications: Validates against the release name (appIdentifier.ReleaseName)
  • Argo Applications: Validates against the application name (appIdentifier.AppName)
  • Flux Applications: Validates against the application name (appIdentifier.AppName)

Bulk Operation Validation

Added environment name validation for bulk hibernation operations:

  • Validates confirmationName against the environment name
  • Resolves environment name from envName field or fetches it using envId
  • Applied to both BulkHibernate and BulkUnHibernate operations

API Behavior

// Single app hibernation with confirmation
POST /orchestrator/api/v1/applications/hibernate?appType=1
{
  "appId": "1|default|nginx-app",
  "confirmationName": "nginx-app"
}

// Bulk hibernation with confirmation  
POST /orchestrator/bulk/v1beta1/hibernate
{
  "envId": 1,
  "envName": "production", 
  "confirmationName": "production"
}

Response Codes:

  • 200 OK: Operation successful (with or without confirmation)
  • 400 Bad Request: Confirmation name mismatch with clear error message

Backward Compatibility

The confirmationName field is optional, ensuring existing clients continue to work without any changes. This allows for gradual migration where frontend teams can implement confirmation dialogs at their own pace.

Error Handling

When confirmation validation fails, the API returns descriptive error messages:

  • Single apps: "confirmation name does not match application name"
  • Bulk operations: "confirmation name does not match environment name"

This feature addresses user confusion between environments and provides an additional safety layer for critical hibernation operations while maintaining full backward compatibility.

Fixes #6632.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link

Bito Automatic Review Skipped - Draft PR

Bito didn't auto-review because this pull request is in draft status.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change draft PR review settings here, or contact your Bito workspace admin at [email protected].

@Copilot Copilot AI changed the title [WIP] Feature: Need an additional confirmation by asking the application name while hibernating the application Add confirmation name validation for application hibernation operations Sep 4, 2025
@Copilot Copilot AI requested a review from prakarsh-dt September 4, 2025 11:08
Copilot finished work on behalf of prakarsh-dt September 4, 2025 11:08
Copy link

sonarqubecloud bot commented Sep 4, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
42.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link

Bito Automatic Review Skipped - Draft PR

Bito didn't auto-review because this pull request is in draft status.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change draft PR review settings here, or contact your Bito workspace admin at [email protected].

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.

Feature: Need an additional confirmation by asking the application name while hibernating the application
2 participants