jenkins从gitlab克隆代码简单案例

jenkins从gitlab克隆代码简单案例,第1张

jenkins从gitlab克隆代码简单案例

一、添加凭据
系统管理—>>manage credential—>>系统—>>添加凭据,如下:


二、创建gitlab项目

root@Think-pad:~/pipeline-helloworld-scm# vim Jenkinsfile
pipeline {
    agent any
    stages {
        stage('hello') {
            steps {
                echo "hello world"
            }
        }
    }
}

root@Think-pad:~/pipeline-helloworld-scm# git add .
root@Think-pad:~/pipeline-helloworld-scm# git commit -m "update the Jenkinsfile to pipeline format"
[master 7d4b04e] update the Jenkinsfile to pipeline format
 1 file changed, 10 insertions(+), 1 deletion(-)
root@Think-pad:~/pipeline-helloworld-scm# git push -u origin
Username for 'http://192.168.1.12': root
Password for 'http://root@192.168.1.12': 
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 343 bytes | 343.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://192.168.1.12/root/pipeline-helloworld-scm.git
   a16bbed..7d4b04e  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.


三、创建pipeline流水线

配置流水线,选择"scm",如下:


脚本路径默认为Jenkins

四、开始构建



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4662919.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-06
下一篇 2022-11-06

发表评论

登录后才能评论

评论列表(0条)

保存