1

Jenkins Backup

 2 years ago
source link: https://linuxsuren.github.io/blog/devops/jenkins/basic/jenkins-backup/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Jenkins Backup

Jenkins Backup

本文是把 Jenkins 2.164.2 的数据备份到了 2.175 上。

首先,我们需要进入到 Jenkins 配置的根目录中(默认为:~/.jenkins):

tar czvf jenkins.plugins.tar.gz plugins/*.jpi
cp jenkins.plugins.tar.gz ~

我需要备份的环境运行在 Kubernetes 集群上,因此,下面是通过命令行 kubectl 把凭据相关的文件拷贝出来的, 读者可以结合自己的情况酌情调整:

kubectl cp jenkins-599d58c694-sh46d:var/jenkins_home/secret.key ~/.jenkins -n default
kubectl cp jenkins-599d58c694-sh46d:var/jenkins_home/credentials.xml ~/.jenkins -n default
kubectl cp jenkins-599d58c694-sh46d:var/jenkins_home/secrets ~/.jenkins/secrets -n default

Jenkins 默认会把所有的凭据信息保存到 credentials.xml 这个文件中。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK