Jenkins + Fastlane 最新版本 安装和项目配置

2022-09-05  本文已影响0人  Jesscia_Liu

以目前最新版本jenkins为例:即jenkins2.346.3

Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件项目可以进行持续集成

一、使用Homebrew安装Jenkins

1.升级本机java环境到java18

2.更新Homebrew到Homebrew 3.5.8

3.使用Homebrew安装Jenkins

$ brew install jenkins

jenkins 2.313 is already installed but outdated (so it will be upgraded).
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/17/manifests/17.0.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/17/blobs/sha256:c776c051a277ee7b54471048
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:c776c051a277
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jenkins/manifests/2.363
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jenkins/blobs/sha256:22f59f02ad274445ccf5d999ae5
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:22f59f02ad27
######################################################################## 100.0%
==> Upgrading jenkins
  2.313 -> 2.363 

==> Installing dependencies for jenkins: openjdk@17
==> Installing jenkins dependency: openjdk@17
==> Pouring openjdk@17--17.0.4.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/openjdk@17/17.0.4: 639 files, 305.5MB
==> Installing jenkins
==> Pouring jenkins--2.363.all.bottle.tar.gz
==> Caveats
Note: When using launchctl the port will be 8080.

To restart jenkins after an upgrade:
  brew services restart jenkins
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/jenkins/bin/jenkins --httpListenAddress=127.0.0.1 --httpPort=8080
==> Summary
🍺  /usr/local/Cellar/jenkins/2.363: 8 files, 92.4MB
==> Running `brew cleanup jenkins`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /usr/local/Cellar/jenkins/2.313... (8 files, 72.2MB)
Removing: /Users/用户名/Library/Caches/Homebrew/jenkins--2.313... (71.5MB)
==> Caveats
==> jenkins
Note: When using launchctl the port will be 8080.

To restart jenkins after an upgrade:
  brew services restart jenkins
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/jenkins/bin/jenkins --httpListenAddress=127.0.0.1 --httpPort=8080

4.安装成功,启动Jenkins

$ brew services start jenkins

==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 2057, done.
remote: Counting objects: 100% (449/449), done.
remote: Compressing objects: 100% (101/101), done.
remote: Total 2057 (delta 380), reused 356 (delta 348), pack-reused 1608
Receiving objects: 100% (2057/2057), 557.31 KiB | 251.00 KiB/s, done.
Resolving deltas: 100% (951/951), done.
Tapped 1 command (45 files, 710.8KB).
==> Successfully started `jenkins` (label: homebrew.mxcl.jenkins)

5. 浏览器输入localhost:8080

To restart jenkins after an upgrade:
  brew services restart jenkins
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/jenkins/bin/jenkins --httpListenAddress=127.0.0.1 --httpPort=8080
首页引导.png 点击安装推荐的插件.png

6.按浏览器内操作提示操作,成功后跳转Jenkins配置主页

C2FC72D7-1925-45C3-B814-C782E427049C.png

二、使用Tomcat安装Jenkins

参考:Tomcat的安装和使用

三、使用Jenkins集成一个最简单的git项目

1.新建一个任务

新建任务.png

2.配置项目信息 - General

填写项目描述.png 参数化构建过程.png

3.配置项目信息 - 源码管理

源码管理.png

4.配置项目信息 - 构建

Fastlane安装和配置参考:Fastlane的集成和使用 包括 ios/mac 项目示例

cd /Users/用户名/Desktop/项目名 #定位到项目目录下
sh ./fastlane/Fastlane.sh #自己新建的脚本文件,内容为fastlane命令
#echo "打包app并封装成dmg"
fastlane archive_debug

#echo "更新.dmg上传到服务器"
ssh-add
fastlane upload_toServer
shell脚本构建内容示例.png

5、返回项目-选择立即构建

四、设置用户和权限

权限设置.png

1. 全局安全配置

2.管理用户

用户列表.png

五、使用其他test用户电脑访问管理员电脑配置的Jenkins项目

1.查看管理员mac本机电脑的IPv4地址

2. 找到jenkins安装目录

3. 修改此安装目录下的plist文件

4. 更改web浏览器Jenkins管理页的地址和端口号

图2.png

六、集成项目过程中可能遇到的问题和解决方法

参考:ios/macos Jenkins+fastlane安装和配置问题汇总

其他参考

git多分支配置:持续集成之jenkins参数化构建、git多分支选择
Linux服务器集成配置: 从零开始-Linux服务器上用jenkins搭建Java/Android/Ios持续集成环境

上一篇下一篇

猜你喜欢

热点阅读