Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CLI's for cleanup - useful, uncertain what to do #145

@justin808

Description

@justin808

See code here: https://github.com/shakacode/hichee/blob/master/lib/tasks/cpl.rake (private repo for ShakaCode).

We should abstract out this code and ever to the controlplane.yml file for values.

In the below code, cpl:cleanup_review_apps could potentially be configured by the controlplane.yml file and be a new CLI:

cpl cleanup_apps -a <app prefix>

This is what we have in CI.

Database cleanups would be app specific.

  nightly-cleanup-review-apps-and-staging-org:
    <<: *cpln-defaults
    steps:
      - checkout
      - run: *install-control-plane-tools
      - run:
          name: Setup Control Plane tools
          command: |
            cpln profile create default --token $CPLN_TOKEN_STAGING --org $CPLN_ORG_STAGING
      - run:
          name: Cleanup stale review apps based on open PRs
          command: |
            cpl run:detached -a $APP_NAME_STAGING --image latest --use-local-token -- LOG_LEVEL=warn GH_TOKEN=$GH_TOKEN rails \
              cpl:setup_cpln \
              cpl:cleanup_review_apps \
              cpl:cleanup_review_app_databases

We need some hook, like the release script to:

  1. create resources for a review app
  2. cleanup resources for a review app

and we could configure those hooks in controlplane.yml.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions