Jenkins 安装与配置

    0

准备工作

  1. centos7.9
  2. docker环境

Jenkins 安装与配置

jenkins-docker镜像官网

  1. 使用docker安装jenkins

    bash
    docker run -d -u root -v jenkins_home:/var/jenkins_home -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 --restart=always jenkins/jenkins:lts-jdk11
  2. 获取密码

bash
docker ps docker exec -u 0 -it container_id /bin/bash cat /var/jenkins_home/secrets/initialAdminPassword

1643290620250xbnxNv 4. 插件安装

  1. Generic Webhook Trigger
  2. Publish over SSH
  3. nodejs
  4. ssh
  5. Maven Integration
#Generic Webhook Trigger配置
^(refs/heads/master)_(jello-web)$
$ref_$name

jar包进程脚本

bash
#!/bin/bash SERVER_NAME=jello JAR_NAME=jello-0.0.1-SNAPSHOT echo "查询进程id-->$SERVER_NAME" PID=`ps -ef | grep "$SERVER_NAME" | grep -v grep | awk '{print $2}'` echo "得到进程ID:$PID" echo "结束进程" for id in $PID do kill -9 $id echo "killed $id" done echo "结束进程完成" cd /www/wwwroot/api.jello.annyyy.com/ chmod 755 $JAR_NAME.jar nohup java -jar $JAR_NAME.jar & echo '执行完了构建'
bash
npm ci npm run build tar -czvf dist.tar.gz \.next env public package.json \.npmrc

F&Q

  1. 构建springboot不能自动结束
bash
nohup java -jar test.jar >start.log 2>&1 &
  1. 时间比主机时间慢8小时

一次性设置,重启无效

System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone','Asia/Shanghai')

永久设置

bash
docker exec -it -u root container_id bash cat /etc/timezone echo 'Asia/Shanghai' > /etc/timezone
评论区

共有评论 0

暂无评论