官术网_书友最值得收藏!

Configuring Jenkins

The next page will ask you if you want to install suggested plugins, but you do not want that. In fact, you do not want anything at this moment, so just close the popup (on the Jenkins website, not the browser). Jenkins will inform you that it has created an admin user with the password you used earlier and then take you to the Jenkins home page (logged in as admin, as seen at the top-right). On the homepage find Manage Jenkins (in the left side menu) and, from Manage Jenkins, go to Manage Users. You should see your admin user, so you can either select it and then go to Configure on the left-hand side menu, or you can click on the cog on the right-hand side of the admin user to be taken to the configuration screen directly. On the configuration screen, you can enter (and re-enter) a password you can actually remember (like 1234) and save your settings. Try logging out (in the top right of the screen) and logging back in without your new password.

The next thing we are going to do is try and get our Git project pulled into Jenkins. Jenkins alone does not do a lot. Luckily, there is a Jenkins plugin for practically everything. Go to Manage Jenkins and from there to Manage Plugins. Many plugins require other plugins to be installed too, but Jenkins will handle that for you. You can browse through all the different plugins at your leisure, but for now we are interested in just one plugin, which is the Git plugin. You can filter for Git in the upper-right corner (NOT the Search bar, quite confusing). You will find GitHub, GitLab (which we will look at later), Git client, Git server... just a whole lot of Git really. We want the vanilla Git Plugin. So check it and hit Install without restart at the bottom. This will install the Git Plugin and thirteen other plugins that are needed to run the Git plugin.

Now, we can create a job. Go back to the Jenkins homepage and either click New item on the left-hand side menu or click on Please create new jobs to get started right in the middle of your screen. Choose Freestyle project and a name such as Test or whatever. The next screen is the job configuration screen. What you see here depends on your kind of job and on the plugins you have installed. The only thing we will do right now is get our source from Git and into Jenkins. Under Source Code Management, select Git. You can find the Repository URL in your GitLab project; mine is http://ciserver/sander/test.git. Then, choose to add a credential. We want the Username with password kind and your username and password are the ones you use to log in to GitLab. Also, give it an ID so you can recognize it later. That should do the trick. Save your configuration and you will be taken to the project page. On the left-hand side menu, you can view the workspace (which includes the files that are currently in your job). You do not have a workspace yet, but that will change as soon as you build the job. So click Build Now and you will notice that a build is added to the build history and that, when you refresh your workspace, you will see your text files.

If a build fails (for now because you misspelled your Git repository or you used the wrong credentials), you will see that the build ball in the build history turns red, indicating failure. That is what we expected. However, when a build succeeds, the ball turns blue when you probably expected green. It has to do with the Jenkins creator, Kohsuke Kawaguchi, being Japanese. In Japan, red means stop and blue means go. Apparently, it is an issue for a lot of people so the Green Balls Plugin is pretty popular (as is the Chuck Norris Plugin!). You can read about the blue ball phenomenon in this Jenkins blog: https://jenkins.io/blog/2012/03/13/why-does-jenkins-have-blue-balls/.

Congratulations, you have successfully installed and configured Jenkins! That is all we are going to do with Jenkins for now, but we will be using Jenkins a lot throughout this book.

主站蜘蛛池模板: 无为县| 灵武市| 闸北区| 高清| 云浮市| 淳化县| 军事| 浮山县| 溧水县| 慈利县| 德钦县| 洛南县| 商都县| 江西省| 荥阳市| 崇左市| 化州市| 阿坝县| 天水市| 科技| 福泉市| 荣成市| 石楼县| 丹巴县| 崇明县| 巨鹿县| 同心县| 老河口市| 黄石市| 台安县| 毕节市| 望谟县| 当涂县| 包头市| 那坡县| 本溪| 衡阳市| 长阳| 武汉市| 大厂| 土默特左旗|