Skip to content

Instantly share code, notes, and snippets.

@VAdamec
Created February 5, 2018 15:23
Show Gist options
  • Save VAdamec/5d47046ae60f86f30667df7cc27e723e to your computer and use it in GitHub Desktop.
Save VAdamec/5d47046ae60f86f30667df7cc27e723e to your computer and use it in GitHub Desktop.
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description>
Recover PROD full dump
</description>
<keepDependencies>false</keepDependencies>
<properties>
<jenkins.model.BuildDiscarderProperty>
<strategy class="hudson.tasks.LogRotator">
<daysToKeep>-1</daysToKeep>
<numToKeep>300</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</strategy>
</jenkins.model.BuildDiscarderProperty>
<com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin="build-failure-analyzer@1.19.2">
<doNotScan>false</doNotScan>
</com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty>
<com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.2">
<gitLabConnection></gitLabConnection>
</com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
<com.sonyericsson.rebuild.RebuildSettings plugin="rebuild@1.27">
<autoRebuild>false</autoRebuild>
<rebuildDisabled>false</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.ChoiceParameterDefinition>
<name>DatabaseServer</name>
<description>Choose which DEV server you want to use</description>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>timber-mysql-dev001.example.com:192.168.1.2</string>
<string>timber-mysql-dev002.example.com:192.168.1.3</string>
</a>
</choices>
</hudson.model.ChoiceParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>DEBUG</name>
<description>&lt;H1&gt;BE CARFEULL WITH DEBUG AS IT EXPOSE SENSITIVE DATA&lt;/H1&gt;
&lt;p&gt;
Always remove job with enabled debug
&lt;/p&gt;</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>FULLDUMP</name>
<description>&lt;p&gt;
Use full file name (like &lt;i&gt;full-20170821030741-backup.xbstream&lt;/i&gt;), to find out version you can do select in version table on PROD master. Latest full version will be located on NFS if no value provided.
&lt;/p&gt;
&lt;code&gt;
[timber-mysql-prod001] $ mysql -u root -p changelog -e &quot;SELECT * FROM versions;&quot;
&lt;/code&gt;
&lt;p&gt;
or look to NFS storage (on master or recovery host):
&lt;/p&gt;
&lt;code&gt;
[timber-mysql-prod001] $ ls -al /nfs/backup/full-*
&lt;/code&gt;
</description>
<defaultValue></defaultValue>
<trim>false</trim>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@2.0.1">
<maxConcurrentPerNode>0</maxConcurrentPerNode>
<maxConcurrentTotal>0</maxConcurrentTotal>
<categories class="java.util.concurrent.CopyOnWriteArrayList"/>
<throttleEnabled>false</throttleEnabled>
<throttleOption>project</throttleOption>
<limitOneJobWithMatchingParams>false</limitOneJobWithMatchingParams>
<paramsToUseForLimit></paramsToUseForLimit>
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
</properties>
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.7.0">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>git@gitlab.example.com:rancher/mysql-backup.git</url>
<credentialsId>DevOpsJenkins-to-Gitlab</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>timber-prod</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<browser class="hudson.plugins.git.browser.GitLab">
<url>https://gitlab.example.com</url>
<version>9.0</version>
</browser>
<submoduleCfg class="list"/>
<extensions>
<hudson.plugins.git.extensions.impl.WipeWorkspace/>
</extensions>
</scm>
<assignedNode>ansible-server-dev-01</assignedNode>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>true</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>#!/bin/bash
REPORT=&quot;${WORKSPACE}/test-reports&quot;
mkdir -p ${REPORT}
if [[ ${DEBUG} == &quot;true&quot; ]];then
DEBUGPAR=&quot;-vvvv&quot;
ANSIBLE_DEBUG=&quot;ANSIBLE_DEBUG=1&quot;
fi
if [[ ${FULLDUMP} ]];then
SETFULL=&quot;last_full=${FULLDUMP}&quot;
fi
sudo ${ANSIBLE_DEBUG} JUNIT_OUTPUT_DIR=${REPORT} ansible-playbook -i hosts-dev xtrabackup-recovery.yml -b ${DEBUGPAR} --extra-vars=&quot;DATASOURCE_PASSWORD_DEV=${DATASOURCE_PASSWORD_DEV} DATASOURCE_USERNAME_DEV=${DATASOURCE_USERNAME_DEV} ${SETFULL}&quot;
</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.ArtifactArchiver>
<artifacts>test-reports/*.xml</artifacts>
<allowEmptyArchive>true</allowEmptyArchive>
<onlyIfSuccessful>true</onlyIfSuccessful>
<fingerprint>true</fingerprint>
<defaultExcludes>true</defaultExcludes>
<caseSensitive>true</caseSensitive>
</hudson.tasks.ArtifactArchiver>
<hudson.tasks.junit.JUnitResultArchiver plugin="junit@1.23">
<testResults>test-reports/*.xml</testResults>
<keepLongStdio>false</keepLongStdio>
<healthScaleFactor>1.0</healthScaleFactor>
<allowEmptyResults>true</allowEmptyResults>
</hudson.tasks.junit.JUnitResultArchiver>
<org.jenkinsci.plugins.graphiteIntegrator.GraphitePublisher plugin="graphiteIntegrator@1.2">
<selectedIp>172.24.249.77</selectedIp>
<metrics>
<org.jenkinsci.plugins.graphiteIntegrator.Metric>
<queueName>jenkins.durations.timberbetadb-recovery</queueName>
<name>BUILD_DURATION</name>
</org.jenkinsci.plugins.graphiteIntegrator.Metric>
</metrics>
</org.jenkinsci.plugins.graphiteIntegrator.GraphitePublisher>
<jenkins.plugins.slack.SlackNotifier plugin="slack@2.3">
<baseUrl></baseUrl>
<teamDomain></teamDomain>
<authToken></authToken>
<authTokenCredentialId></authTokenCredentialId>
<botUser>false</botUser>
<room></room>
<startNotification>false</startNotification>
<notifySuccess>false</notifySuccess>
<notifyAborted>true</notifyAborted>
<notifyNotBuilt>false</notifyNotBuilt>
<notifyUnstable>false</notifyUnstable>
<notifyRegression>true</notifyRegression>
<notifyFailure>true</notifyFailure>
<notifyBackToNormal>false</notifyBackToNormal>
<notifyRepeatedFailure>false</notifyRepeatedFailure>
<includeTestSummary>false</includeTestSummary>
<includeFailedTests>false</includeFailedTests>
<commitInfoChoice>NONE</commitInfoChoice>
<includeCustomMessage>false</includeCustomMessage>
<customMessage></customMessage>
</jenkins.plugins.slack.SlackNotifier>
</publishers>
<buildWrappers>
<hudson.plugins.ws__cleanup.PreBuildCleanup plugin="ws-cleanup@0.34">
<deleteDirs>false</deleteDirs>
<cleanupParameter></cleanupParameter>
<externalDelete></externalDelete>
</hudson.plugins.ws__cleanup.PreBuildCleanup>
<hudson.plugins.build__timeout.BuildTimeoutWrapper plugin="build-timeout@1.19">
<strategy class="hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy">
<timeoutMinutes>60</timeoutMinutes>
</strategy>
<operationList/>
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
<hudson.plugins.timestamper.TimestamperBuildWrapper plugin="timestamper@1.8.9"/>
<hudson.plugins.ansicolor.AnsiColorBuildWrapper plugin="ansicolor@0.5.2">
<colorMapName>xterm</colorMapName>
</hudson.plugins.ansicolor.AnsiColorBuildWrapper>
<org.jenkinsci.plugins.buildnamesetter.BuildNameSetter plugin="build-name-setter@1.6.8">
<template>#${BUILD_NUMBER}-${ENV,var=&quot;FULLDUMP&quot;}</template>
<runAtStart>true</runAtStart>
<runAtEnd>true</runAtEnd>
</org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
<com.datapipe.jenkins.vault.VaultBuildWrapper plugin="hashicorp-vault-plugin@2.1.0">
<configuration>
<vaultUrl>https://vault.example.com</vaultUrl>
<vaultCredentialId>app-vault</vaultCredentialId>
</configuration>
<vaultSecrets>
<com.datapipe.jenkins.vault.model.VaultSecret>
<path>secret/timber/dev</path>
<secretValues>
<com.datapipe.jenkins.vault.model.VaultSecretValue>
<envVar>DATASOURCE_PASSWORD_DEV</envVar>
<vaultKey>DATASOURCE_PASSWORD</vaultKey>
</com.datapipe.jenkins.vault.model.VaultSecretValue>
<com.datapipe.jenkins.vault.model.VaultSecretValue>
<envVar>DATASOURCE_USERNAME_DEV</envVar>
<vaultKey>DATASOURCE_USERNAME</vaultKey>
</com.datapipe.jenkins.vault.model.VaultSecretValue>
</secretValues>
</com.datapipe.jenkins.vault.model.VaultSecret>
</vaultSecrets>
<valuesToMask/>
<vaultAccessor/>
</com.datapipe.jenkins.vault.VaultBuildWrapper>
</buildWrappers>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment