创建git pull流水线任务:pull git源码
步骤jenkins源码:
编写Jenkinsfile上传Github)创建凭据(Jenkinsfile项目或待拉取有密码的项目)创建Jenkins工程jenkins源码,使用Jenkinsfile的gitlab(可使用凭据)jenkins源码,自定义工程注释与参数启动工程,查看Console Output输出“新建任务”配置任务流水线脚本生成脚本
git credentialsId: 'pft-gitlab', url: 'http://host:port//ql-dev/perfect-digital-plant.git'在gitlab的工程根目录下创建Jenkinsfile
pipeline { agent any stages{ stage('pull git demo') { steps{ //拉取代码,这里也是可以使用凭据的,为jenkins源码了方便没贴出来 git credentialsId: 'perfect-gitlab', url: 'http://host:port/ql-dev/perfect-digital-plant.git' } } } }构建点击#1-> Console Output:
Started by user Bruce Zou Obtained Jenkinsfile from git http://host:port//ql-dev/perfect-digital-plant.git Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /data/bruce/jenkins/workspace/pull-digital-factory [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Checkout SCM) [Pipeline] checkout The recommended git tool is: NONE using credential perfect-gitlab Cloning the remote Git repository Cloning repository http://host:port//ql-dev/perfect-digital-plant.git > git init /data/bruce/jenkins/workspace/pull-digital-factory # timeout=10 Fetching upstream changes from http://host:port//ql-dev/perfect-digital-plant.git > git --version # timeout=10 > git --version # 'git version 1.8.3.1' using GIT_ASKPASS to set credentials > git fetch --tags --progress http://host:port//ql-dev/perfect-digital-plant.git +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url http://shost:port//ql-dev/perfect-digital-plant.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 Avoid second fetch > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 9a28de3e6ae72344003e3f1953279e0540836ca2 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 9a28de3e6ae72344003e3f1953279e0540836ca2 # timeout=10 Commit message: "Update Jenkinsfile" First time build. Skipping changelog. [Pipeline] } [Pipeline] // stage [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (pull git demo) [Pipeline] git The recommended git tool is: NONE using credential perfect-gitlab > git rev-parse --resolve-git-dir /data/bruce/jenkins/workspace/pull-digital-factory/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url http://host:port/ql-dev/perfect-digital-plant.git # timeout=10 Fetching upstream changes from http://host:port//ql-dev/perfect-digital-plant.git > git --version # timeout=10 > git --version # 'git version 1.8.3.1' using GIT_ASKPASS to set credentials > git fetch --tags --progress http://shost:port/0/ql-dev/perfect-digital-plant.git +refs/heads/*:refs/remotes/origin/* # timeout=10 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 9a28de3e6ae72344003e3f1953279e0540836ca2 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 9a28de3e6ae72344003e3f1953279e0540836ca2 # timeout=10 > git branch -a -v --no-abbrev # timeout=10 > git checkout -b master 9a28de3e6ae72344003e3f1953279e0540836ca2 # timeout=10 Commit message: "Update Jenkinsfile" [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS 海报
0 条评论
34
相关文章
本站已关闭游客评论,请登录或者注册后再评论吧~