Open4
RaspberryPi3B+にJenkins入れるメモ
OSは普通にRaspberry Pi OS Lite。ディスクイメージの書き込み時にSSH host key等が同時投入できて大分便利になった。
apt
で導入
これは公式サイト https://www.jenkins.io/doc/book/installing/linux/ 通り。
apt install openjdk-11-jre-headless
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
タイムアウトで起動しない
何かバカみてぇに遅い。。
Job for jenkins.service failed because a timeout was exceeded.
See "systemctl status jenkins.service" and "journalctl -xe" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: timeout) since Fri 2022-05-27 21:19:48 JST; 32ms ago
Process: 6430 ExecStart=/usr/bin/jenkins (code=exited, status=143)
Main PID: 6430 (code=exited, status=143)
Status: "Jenkins stopped"
CPU: 2min 34.108s
May 27 21:19:48 minigate systemd[1]: Failed to start Jenkins Continuous Integration Server.
May 27 21:19:48 minigate systemd[1]: jenkins.service: Consumed 2min 34.108s CPU time.
dpkg: error processing package jenkins (--configure):
installed jenkins package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
とりあえずserviceのファイル /etc/systemd/system/multi-user.target.wants/jenkins.service
を直接編集して起動タイムアウトを無限にした。
TimeoutStartSec=infinity
タイムアウトを無限にした後は、サービス自体をリロードする必要がある。
systemctl daemon-reload
systemd未だに慣れないんだよなぁ。。
CSRFトークンが正常に発行されない
May 27 21:56:49 minigate jenkins[7353]: 2022-05-27 12:56:49.294+0000 [id=342] INFO hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1
May 27 21:57:53 minigate jenkins[7353]: 2022-05-27 12:57:53.361+0000 [id=12] WARNING hudson.security.csrf.CrumbFilter#doFilter: Found invalid crumb f22b374618684dc8a3f0e528ec98b61dc11e2a902a611688cada66fbf6c6144b. If you are calling this URL with a script, please use the API Token instead. More information: https://www.jenkins.io/redirect/crumb-cannot-be-used-for-script
May 27 21:57:53 minigate jenkins[7353]: 2022-05-27 12:57:53.365+0000 [id=12] WARNING hudson.security.csrf.CrumbFilter#doFilter: No valid crumb was included in request for /pluginManager/checkUpdatesServer by admin. Returning 403.
グローバルセキュリティの設定 > CSRF Protection > プロキシーとの互換性を有効化
で多少マシになった気がする。