Migrate Jenkins-3 migtate
Migrate all configuration files
- Login jerry’s machine, cd /var/lib/Jenkins/
- Pack all the configuration files
- scp these files into EECloud OS
I don’t remember that if I have written SSH setting in preparation doc or other,
If here report the issue, you should go into EECloud first, set the SSH service accept password login, or you can add the public key into EECloud(this way you don’t need to enter the password every time)
- switch to EECloud server
- sudo mv no-space-jobs-plugins.tar.gz /var/lib/Jenkins
- decompress this tar file in the /var/lib/Jenkins
- change owner and group
chown -R jenkins:jenkins /var/lib/Jenkins
- restart Jenkins server
systemctl restart jenkins.service
Migrate all the plugins
To check the status of Jenkins, if all thing works well, then migrate all the plugins refer to the guide of part of Migration all the configuration.
The plugins are under /var/lib/Jenkins/plugins/
Migrate some dependency package and Selenium script
Selenium scripts are under
- pack all the file under /usr/share/SalesForceDataCompareWithSelenium on 50 sever(135.251.46.50:)
tar -zcvf selenium-scripts.tar.gz ./*
- sudo scp selenium-scripts.tar.gz [email protected]<EECloudIP>:selenium-scirpts.tar.gz
- switch to EECloud
mkdir -p /usr/share/SalesForceDataCompareWithSelenium
mv selenium-scripts.tar.gz /usr/share/SalesForceDataCompareWithSelenium
tar -xvf selenium-scripts.tar.gz
originally, the firefox starting is too slow, I changed timeout to 60s(default), it’s 30s, but now, the start become quickly, it’s maybe the issue of EECloud.
Migrate all post-refresh jobs
vim /var/lib/Jenkins/config.xml
copy all post-refresh jobs to one file(string), then remove <string> lable.
sed -i ‘s/<string>//g’;sed -i ‘s/<\/string>//g’ string
then
sed -i ‘s/^[ \t]*//g’ string
cat string | tr ‘\n’ ‘ ’
you will get like this:
Then pack all these post-refresh jobs to tar.gz file, scp it to EECloud
decompress; so on
Now, these post-refresh job connect to 50 to run the selenium script, before restarting Jenkins,
we need to delete all the 50 lable
sed -i ’/test-50/d’ ./jobs/*/config.xml
then restart jenkins
Some other dependency are under /var/lib/scripts/
We need to move these files to EE Cloud, of course, the same directory.
Migrate rest of jobs
If the post-refresh jobs work well, we can continue to migrate rest of jobs.
Here the most of the steps are the same as the post-refresh jobs migration.
Notice: this part, there is some job will run automatically, so before migrating, we should disable all the jobs. then after verifying, enable them.
How to disable the jobs in one shot, just run below command.
for name in names; do sed -i ‘/canRoam/{n; s/false/true/;}’ $name/config.xml; done