[FOLIO-2249] Tenant clean up script Created: 10/Sep/19  Updated: 03/Jun/20  Resolved: 22/Sep/19

Status: Closed
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: Task Priority: P2
Reporter: John Malconian Assignee: Ian Hardy
Resolution: Done Votes: 0
Labels: platform-backlog
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Blocks
blocks FOLIO-2056 create a pipeline for a front-end mod... Closed
Relates
relates to FOLIO-2194 Develop script to clean up expired K8... Closed
Sprint: CP: sprint 72
Story Points: 3
Development Team: Core: Platform

 Description   

A script is required to clean up FOLIO CI tenants and S3 buckets created by pull requests. If a PR is in a closed state the tenant and all tenant data should be removed and the S3 bucket should be deleted.



 Comments   
Comment by Ian Hardy [ 10/Sep/19 ]
  • get a list of tenants
  • derive pr name from tenant name
  • check if associated pr is active
  • if closed: delete tenant, remove s3 bucket w/stripes bundle
Comment by John Malconian [ 10/Sep/19 ]

Each S3 bucket has a tag with the a key of 'Pr' and a value of <PLATFORM>-PR-NUMBER that can be used to associate the bucket with the PR. So, for example, the value of the tag on the S3 bucket used for platform-core PR-383 would be 'platform-core-383'

Comment by Ian Hardy [ 13/Sep/19 ]

John Malconian Any reason to search across regions for these buckets, or can I assume they'll all be in the same one?

Comment by John Malconian [ 16/Sep/19 ]

Ian Hardy All buckets will be created in the us-east-1 region.

Comment by Ian Hardy [ 22/Sep/19 ]

Deployed tenant cleanup script in container, tested by closing:

https://github.com/folio-org/platform-core/pull/382

Cleans up aws bucket + all tenants associated w/PR (several tenants are possible if pr was updated). output from cleanup job:

Checking pr for tenant: platform_core_382_10

delete tenant function

sucessfully deleted platform_core_382_10

platform-core-382

could not find bucket platform-core-382

Checking pr for tenant: platform_core_382_11

delete tenant function

sucessfully deleted platform_core_382_11

platform-core-382

could not find bucket platform-core-382

Checking pr for tenant: platform_core_382_12

delete tenant function

sucessfully deleted platform_core_382_12

platform-core-382

could not find bucket platform-core-382

Checking pr for tenant: platform_core_382_13

delete tenant function

sucessfully deleted platform_core_382_13

platform-core-382

could not find bucket platform-core-382

Checking pr for tenant: platform_core_382_14

delete tenant function

sucessfully deleted platform_core_382_14

platform-core-382

could not find bucket platform-core-382

Checking pr for tenant: platform_core_382_15

delete tenant function

sucessfully deleted platform_core_382_15

platform-core-382

could not find bucket platform-core-382

Checking pr for tenant: platform_core_382_16

delete tenant function

sucessfully deleted platform_core_382_16

platform-core-382

could not find bucket platform-core-382

Checking pr for tenant: platform_core_382_6

delete tenant function

sucessfully deleted platform_core_382_6

platform-core-382

could not find bucket platform-core-382
Generated at Thu Feb 08 23:19:17 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.