当前位置:首页 > 编程笔记 > 正文
已解决

Jenkins学习笔记4

来自网友在路上 148848提问 提问时间:2023-09-21 15:08:29阅读次数: 48

最佳答案 问答题库488位专家为你答疑解惑

配置构建流程:

Jenkins任务创建:

1)创建新任务:

把这个Accept first connection改成 No Validation。问题得到解决。 

说明下,要确认下主分支的名称是master还是main。

构建触发器这块暂时没有需要配置的。

传输文件到nginx-server这个web服务器中。 

将文件上传到/usr/share/nginx/html中。

这个流程就是一个构建。

集成是把代码结合在一起。

构建:Git clone项目,然后把文件发到nginx的/usr/local/nginx/html。

build:构建。

现在Nginx的html目录下,开发人员写的代码文件还没有上传到该目录中。

构建流程构建好了,但是jenkins没有触发,现在是手动的。

webhook钩子函数。github告诉jenkins,说它更新了。

手动构建:

点击“立即构建”。

出现错误,我初步判断是由于分支应该是master,不是main。

 

可以看到第二次构建成功了。

Started by user admin
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/nginx_root_sync
The recommended git tool is: NONE
using credential 0387bfd7-3a31-4e3d-b364-f6d4cac10954> git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/nginx_root_sync/.git # timeout=10
Fetching changes from the remote Git repository> git config remote.origin.url git@github.com:changchunhua2017/jenkins.git # timeout=10
Fetching upstream changes from git@github.com:changchunhua2017/jenkins.git> git --version # timeout=10> git --version # 'git version 1.8.3.1'
using GIT_SSH to set credentials > git fetch --tags --progress git@github.com:changchunhua2017/jenkins.git +refs/heads/*:refs/remotes/origin/* # timeout=10> git rev-parse refs/remotes/origin/main^{commit} # timeout=10
Checking out Revision dedcdf2904306588ad886c8a5f30e186dab2d5ce (refs/remotes/origin/main)> git config core.sparsecheckout # timeout=10> git checkout -f dedcdf2904306588ad886c8a5f30e186dab2d5ce # timeout=10
Commit message: "Added 2.php"
First time build. Skipping changelog.
SSH: Connecting from host [localhost.localdomain]
SSH: Connecting with configuration [nginx-server] ...
SSH: EXEC: completed after 201 ms
SSH: Disconnecting configuration [nginx-server] ...
SSH: Transferred 3 file(s)
Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
Finished: SUCCESS

 可以看到控制台的输出信息,最后是SUCCESS的信息。

然后我们再到Nginx服务器上看下:

可以看到文件已经同步过来了。

我们也看到了123这个文件。

这个示例是我们手动构建的。

查看全文

99%的人还看了

相似问题

猜你感兴趣

版权申明

本文"Jenkins学习笔记4":http://eshow365.cn/6-10761-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!