Issue
-
How to customize the AWS S3 backups for your controller to use your own endpoints?
-
I would like to create a Cluster Operation for backup my controllers to custom endpoints
Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
-
CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
-
CloudBees Jenkins Enterprise - Operations center
Resolution
1.- Get the endpoints.json compatible with your AWS plugin( looking into the tag for the version) to get the version tag of the aws-java-sdk plguin run the following script in the Jenkins Script Console:
def plugin = Jenkins.instance.pluginManager.plugins.find{it.getShortName() == 'aws-java-sdk'} if (plugin){ println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}") } else { println ("aws-java-sdk is not installed in this instance") }
2.- Customize as explained here. A valid example would be:
{ "partitions" : [ { "defaults" : { "hostname" : "{service}.{region}.{dnsSuffix}", "protocols" : [ "http" ], "signatureVersions" : [ "v4" ] }, "dnsSuffix" : "cloudstorage.corp", "partition" : "CCC", "partitionName" : "Example storage", "regionRegex" : "*", "regions" : { "example-region" : { "description" : "example scality endpoint" } }, "services" : { "s3" : { "defaults": { "protocols": [ "http", "https" ], "signatureVersions": [ "s3", "s3v4" ] }, "endpoints" : { "example-region" : { "hostname": "s3.example.cloudstorage.corp" } } } } } ], "version" : 3 }
3.- Create the CLASSPATH_HOME
folder to override endpoints.json
and place your custom file there, com/amazonaws/partitions/override/endpoints.json
for your Operation Ceneter as well as the controllers to backup.
$> mkdir -p $JENKINS_HOME/classpath/com/amazonaws/partitions/override/ $> CLASSPATH_HOME="$JENKINS_HOME/classpath" $> mv endpoints.json $JENKINS_HOME/classpath/com/amazonaws/partitions/override/
4.- Add to the JAVA Properties -Xbootclasspath/a:$CLASSPATH_HOME
to the Operations Center as well as every controller.
5.- Create a Cluster Operation job, go to the Build section and add a Take Backup step, specifying Amazon S3
for Where to back up? and finally example-region
must be shown as option.
References
-
[Backup and restore on AWS
CloudBees Docs](https://docs.cloudbees.com/docs/cloudbees-ci/latest/backup-restore/aws#_backup_to_s3_with_amazon_s3_compatible_storage_systems)
-
[Using the CloudBees Backup plugin
CloudBees Docs](https://docs.cloudbees.com/docs/cloudbees-ci/latest/backup-restore/cloudbees-backup-plugin)