目录一览:
0x02 Jenkins工作节点之自定义jnlp容器模板
-
Dockerfile 构建依赖
-
Dockerfile 构建操作
-
自定义 jenkins-jnlp 镜像
实现部分效果展示:
打开和彩云PC网页或者客户端下载Jenkins Jnlp 容器生成的依赖软件
链接: https://caiyun.139.com/m/i?085CtKxWLzs7l
提取码: 公众号回复 Jenkins 即可获得,或者在本文章末尾获得。
0x02 Jenkins工作节点之自定义jnlp容器模板
Dockerfile 构建依赖
描述: 下述相关脚本以及文件下载地址请在WeiyiGeek
微信公众号回复jenkins-jnlp-dockerfile
关键字获取;
自定义的jnlp容器模板主要实现功能:
-
用户权限控制(sudo)
-
ssh 远程连接
-
git 代码版本控制
-
docker 容器管理
-
kubectl 集群管理
-
Java 运行环境
-
Maven 运行环境
-
SonarQube 扫描环境
-
Gitlab_release 上传环境
-
中文环境支持
-
时区更改配置
Tips: 在K8s集群中测试alpine镜像执行相应的安装(需要在Alpine调试新安装软件时使用):
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: alpine-app
spec:
containers:
- name: alpine-app
image: alpine:latest
args:
- sleep
- "100000"
EOF
pod/alpine-app created
$ kubectl get pods -o wide
# NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
# alpine-app 1/1 Running 0 116s 10.100.37.194 worker-02 <none> <none>
Dockerfile
#----------------------------------------------------------------------#
# Title: Base in Alpine Images Create Custom Jenkins Kubernetes jnlp Images
# Author: WeiyiGeek
# WebSite: https://weiyigeek.top
# MainFunction:
# Install ssh-server docker git openssh tzdata curl tar sudo git ca-certificates wget unzip docker zlib nodejs npm jq
# Install JDK8
# - https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
# - https://github.com/sgerrand/alpine-pkg-glibc/releases/
# - https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
# Install jnlp
# - https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/
# Install Maven
# - https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
# Install SonarqubeScan
# - https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.5.0.2216-linux.zip
# Install Gitlab Release Version: 0.0.6
# - https://gitlab.com/gitlab-org/release-cli/-/releases
# Install kubernetes cli
# - kubectl Version: 1.19.3
# Version: alpine-3.13.1
# Release: v1.10
# ChangeLog:
# v1.9 - 增加 中文环境
# v1.10 - 增加 node.js 环境支持
#-------------------------------------------------#
说明: 镜像构建文件