{"id":17121445,"url":"https://github.com/hellojukay/jenkins101","last_synced_at":"2025-07-14T04:37:34.678Z","repository":{"id":140615439,"uuid":"185033538","full_name":"hellojukay/jenkins101","owner":"hellojukay","description":"一个超简单的 jenkins 使用教程","archived":false,"fork":false,"pushed_at":"2019-05-07T08:41:37.000Z","size":701,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T02:33:26.101Z","etag":null,"topics":["jenkins"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hellojukay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-05T13:15:10.000Z","updated_at":"2020-08-05T13:33:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"e25a619e-b221-4612-9110-95409bdee7e1","html_url":"https://github.com/hellojukay/jenkins101","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":"0.47058823529411764","last_synced_commit":"a27a8afcd6e3472095d381b99ee6b9b5aa4770bf"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hellojukay/jenkins101","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fjenkins101","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fjenkins101/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fjenkins101/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fjenkins101/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellojukay","download_url":"https://codeload.github.com/hellojukay/jenkins101/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fjenkins101/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265241122,"owners_count":23733185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jenkins"],"created_at":"2024-10-14T18:02:30.253Z","updated_at":"2025-07-14T04:37:34.629Z","avatar_url":"https://github.com/hellojukay.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jenkins101\n这是一个 jenkins 的中文介绍教程．\n\n\u003e 精细完整的文档，　参考 jenkins 的官网: https://jenkins.io/zh/\n## 安装 Jenkins\n* docker 安装\n直接使用 docker run 安装最新版本的 jenkins\n```shell\ndocker run -u root --rm -it -d -p 8080:8080  -p 50000:50000  -v jenkins-data:/var/jenkins_home  -v /var/run/docker.sock:/var/run/docker.sock  jenkinsci/blueocean \n```\n当然，　也可以使用　docker-compose 来安装\n```shell\ndocker-compose up -d\n```\n```yml\nversion: '3'\nservices:\n    jenkins:\n    image: 'jenkins/jenkins:lts'\n    container_name: jenkins\n    restart: always\n    ports:\n        - '8080:8080'\n        - '50000:50000'\n    volumes:\n        jenkins_home:/var/jenkins_home\nvolumes:\n    jenkins_home:\n        external: true\n```\n* JAVA War 包安装\n```shell\njava -jar jenkins.war\n```\n* yum,apt,brew,pacman 安装\n通过包管理工具也能安装 jenkins\n\n1. yum 安装 jenkinsfile\n```shell\nsudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo\nsudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key\nyum install jenkins\n```\n2. apt 安装 jenkins\n```shell\nwget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -\nsudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ \u003e /etc/apt/sources.list.d/jenkins.list'\nsudo apt-get update\nsudo apt-get install jenkins\n```\n3. mac 上 brew 安装 jenkins\n```shell\nbrew update \u0026\u0026 brew install jenkins\n```\n4. arch 上使用 pacman　安装 jenkins\n```shell\npacman -S jenkins\n```\n\n## Jenkins 的用户界面\n* 经典界面\n* Blue Ocean\n\njenkins　的用户界面有两种，　一种是经典模式的界面，　另一种是　Blue Ocean　界面，　Blue Ocean　目前是插件的方式存在，　如果要想使用这个 UI 界面，　需要单独安装这个插件. 在未来　Blue Ocean　会组件取代现有的经典模式的功能。随着Blue Ocean的成熟，用户回到经典UI的理由将越来越少。\n\n## 创建任务\n* 自由风格\n* 流水线\n* 多分支流水线\n\n在说创建任务之间，要先说一个　jenkins 中的文件夹的。在 jenkins 中项目是存放在文件中的，这里的文件夹也就相当于分组的意思，　我们可以通过将任务合理组织在各个文件夹中来达到隔离权限的目的。\n\n１. 自由风格\n\n如图，填写名字以后选择第一个\n![自由风格](images/free.png)\n支持 git 和 svn ，在填写仓库的时候，注意加上仓库认证的账号和密码\n![添加仓库](images/git_svn.png)\n在邮件步骤中加入自己的构建中要执行的操作\n![构建步骤](images/build.png)\n推荐将构建过程写在仓库中，比如 `build.sh` 或者 `build.bat` ,在构建步骤中直接执行预定义的构建脚本，这样你的构建脚本也能被版本管理起来。\n如果你先刚要通过 gitlab 来触发构建，　那么你应该在　gitlab 或者 github　上配置对应的 webhook\n![webhook](images/webhook.png)\n\n2. 流水线\n\n流水先的写法和自由风格不一样，　他是使用　groovy 语言的　DSL 来编写构建过程，关于 DSL 的语法，　清参考 jenkins 的官方网站。同样也支持　github 和　gitlab 的 webhook 触发。\n![流水线](images/pipeline.png)\n\n3. 多分支流水线\n\n多分支流水线和流水线一样，　也是使用的 DSL 的语法，　需要你在项目里面添加一个 `Jenkinsfile`, 当然，这个文件名字你是可以指定的。\n![多分支](images/mutil_branch.png)\n\n## 有疑问\n如果有疑问，请查官方文档，google 搜索, 或则在本项目中添加 [Issue](https://github.com/hellojukay/jenkins101/issues/new)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellojukay%2Fjenkins101","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellojukay%2Fjenkins101","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellojukay%2Fjenkins101/lists"}