Skip to content

Delete prefix and its supporting resources in OCI


Users can delete an existing prefix if they are not using it anymore to ensure no prefix-specific residual resources or components remain and also to avoid naming conflicts in future executions.
🔁 This is also beneficial for users who want to re-run createTenancyConfig.py with the same prefix after an unsuccessful execution.


Resources created with createTenancyConfig.py execution:

When executing createTenancyConfig.py during Connect Container to OCI, the following components are created:

  • Config files under /cd3user/tenancies/<prefix> folder


Additional Resources created with Jenkins:

When using Jenkins, the following additional components are created:

📁 On the VM

  • Jenkins files under /cd3user/tenancies/jenkins_home folder.
  • Updated config files:
    • jenkins.properties
    • git_config (includes prefix configs)

☁️ On OCI:

  • DevOps Project and Code Repository <prefix>-automation-toolkit-project

  • OCI Topic for DevOps notifications <prefix>-automation-toolkit-topic

  • OCI Object Storage Bucket for Terraform state <prefix>-automation-toolkit-bucket

  • Customer Secret Key Used as S3 credential for the bucket storing remote state, tied to the user in tenancyconfig.properties.


Steps to Delete the above prefix-specific Resources


Step 1 - Login (Exec) into the Container:


Step 2 - Navigate to user-scripts folder:

cd /cd3user/oci_tools/cd3_automation_toolkit/user-scripts/


Step 3 - Run the Deletion Script:

python deleteTenancyConfig.py tenancyconfig_<prefix>.properties

This script will remove :

  • OCI Devops Project and Repository
  • OCI Topic
  • OCI Bucket
  • Customer Secret Key for the user
  • Prefix configuration from jenkins.properties and git_config files under /cd3user/tenancies/jenkins_home folder
  • /cd3user/tenancies/jenkins_home/jobs/<prefix> folder
  • /cd3user/tenancies/<prefix> folder


Step 4 - Restart Jenkins:

This will remove the prefix from Jenkins Dashboard.

  • Command to get Jenkins process id:
ps -ef | grep jenkins
  • Command to kill process:
kill -9 <process_id>
  • Start Jenkins using:
/usr/share/jenkins/jenkins.sh &