前面已经完成“从Git仓库拉取最新代码,打包到Jenkins工作空间,但想彻底了解Jenkins还是得去服务器看看相关配置文件。那么本篇文章主要针对“查看Jenkins服务器有哪些JOB以及查看指定JOB的配置文件”进行讲解,希望感兴趣的小伙伴可以坚持看下去同时欢迎提出宝贵的意见让我们一起进步!
前提条件
(1)正确登录Jenkins服务器
01:查看Jenkins的所有文件
进入
cd /root/.jenkins
目录
[root@iZ2zebjpjfqq58nc6ul6hnZ ~]# cd /root/.jenkins
[root@iZ2zebjpjfqq58nc6ul6hnZ .jenkins]# ls
com.cloudbees.hudson.plugins.folder.config.AbstractFolderConfiguration.xml
config.xml
credentials.xml
fingerprints
github-plugin-configuration.xml
hudson.maven.MavenModuleSet.xml
hudson.model.UpdateCenter.xml
hudson.plugins.build_timeout.operations.BuildStepOperation.xml
hudson.plugins.emailext.ExtendedEmailPublisher.xml
hudson.plugins.git.GitSCM.xml
hudson.plugins.git.GitTool.xml
hudson.plugins.timestamper.TimestamperConfig.xml
hudson.scm.SubversionSCM.xml
hudson.tasks.Mailer.xml
hudson.tasks.Shell.xml
hudson.triggers.SCMTrigger.xml
identity.key.enc
jenkins.install.InstallUtil.installingPlugins
jenkins.install.InstallUtil.lastExecVersion
jenkins.install.UpgradeWizard.state
jenkins.model.ArtifactManagerConfiguration.xml
jenkins.model.GlobalBuildDiscarderConfiguration.xml
jenkins.model.JenkinsLocationConfiguration.xml
jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin.xml
jenkins.security.apitoken.ApiTokenPropertyConfiguration.xml
jenkins.security.QueueItemAuthenticatorConfiguration.xml
jenkins.security.ResourceDomainConfiguration.xml
jenkins.security.UpdateSiteWarningsConfiguration.xml
jenkins.telemetry.Correlator.xml
jobs
logs
nodeMonitors.xml
nodes
org.jenkinsci.plugins.docker.workflow.declarative.GlobalConfig.xml
org.jenkinsci.plugins.github_branch_source.GitHubConfiguration.xml
org.jenkinsci.plugins.workflow.flow.GlobalDefaultFlowDurabilityLevel.xml
org.jenkinsci.plugins.workflow.libs.GlobalLibraries.xml
org.jenkins.plugins.lockableresources.LockableResourcesManager.xml
org.jvnet.hudson.plugins.SSHBuildWrapper.xml
plugins
queue.xml
queue.xml.bak
scriptApproval.xml
secret.key
secret.key.not-so-secret
secrets
updates
userContent
users
war
workflow-libs
workspace
02:查看Jenkins所有的JOB
进入
cd /root/.jenkins/jobs
目录
[root@iZ2zebjpjfqq58nc6ul6hnZ ~]# cd /root/.jenkins/jobs
[root@iZ2zebjpjfqq58nc6ul6hnZ jobs]# ls -l
total 16
drwxr-xr-x 3 root root 4096 May 17 15:33 jenkins_test
drwxr-xr-x 3 root root 4096 Jun 3 21:48 ly_test
drwxr-xr-x 3 root root 4096 Jun 13 12:52 test
drwxr-xr-x 3 root root 4096 Jun 13 13:28 test_git
[root@iZ2zebjpjfqq58nc6ul6hnZ jobs]#
03:进入Jenkins对应的JOB
进入
cd /root/.jenkins/jobs/test_git
目录
[root@iZ2zebjpjfqq58nc6ul6hnZ ~]# cd /root/.jenkins/jobs/test_git
[root@iZ2zebjpjfqq58nc6ul6hnZ test_git]# ll
total 12
drwxr-xr-x 4 root root 4096 Jun 13 13:28 builds
-rw-r--r-- 1 root root 1287 Jun 13 13:28 config.xml
-rw-r--r-- 1 root root 2 Jun 13 13:28 nextBuildNumber
04:查看对应JOB的配置文件
linux命令为
cat config.xml
[root@iZ2zebjpjfqq58nc6ul6hnZ test_git]# cat config.xml
<?xml version='1.1' encoding='UTF-8'?>
<project>
<actions/>
<description>测试拉取Git仓库最新代码</description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM" plugin="git@4.2.2">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>http://t.istester.com:3000/istester/gittest.git</url>
<credentialsId>70b2aba5-141f-4300-b62e-333c90cc798e</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions/>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>tar -zcvf isTester1.0.tar.gz ./*</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>