From 9279c3dd09bbaa57f7b265ffeb81895d2c7797ca Mon Sep 17 00:00:00 2001 From: GuangJie1 Date: Wed, 20 Aug 2025 09:50:09 +0800 Subject: [PATCH] upgrade jenkins --- Others/jenkins/2.502/24.03-lts-sp1/Dockerfile | 17 +++++- Others/jenkins/2.523/24.03-lts-sp1/Dockerfile | 17 +++++- Others/jenkins/2.524/24.03-lts-sp2/Dockerfile | 31 ++++++++++ Others/jenkins/README.md | 52 ++++++++++++++--- Others/jenkins/doc/image-info.yml | 56 +++++++++++++++---- Others/jenkins/meta.yml | 4 +- 6 files changed, 150 insertions(+), 27 deletions(-) create mode 100644 Others/jenkins/2.524/24.03-lts-sp2/Dockerfile diff --git a/Others/jenkins/2.502/24.03-lts-sp1/Dockerfile b/Others/jenkins/2.502/24.03-lts-sp1/Dockerfile index e9708982..766e88cd 100644 --- a/Others/jenkins/2.502/24.03-lts-sp1/Dockerfile +++ b/Others/jenkins/2.502/24.03-lts-sp1/Dockerfile @@ -1,7 +1,6 @@ ARG BASE=openeuler/openeuler:24.03-lts-sp1 -FROM ${BASE} +FROM ${BASE} AS builder -ARG TARGETARCH ARG VERSION=2.502 ARG MAVEN_VERSION=3.9.6 ARG MAVEN_URL=https://repo.huaweicloud.com/apache/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz @@ -17,4 +16,16 @@ ENV PATH=$PATH:/usr/local/maven/bin RUN git clone -b jenkins-${VERSION} https://github.com/jenkinsci/jenkins.git && \ cd jenkins && \ - mvn clean install -Dmaven.test.skip=true \ No newline at end of file + mvn clean install -Dmaven.test.skip=true + +FROM ${BASE} +COPY --from=builder /jenkins/war/target/jenkins.war /jenkins/jenkins.war + +RUN dnf update -y \ + && dnf install -y java-17-openjdk \ + && dnf clean all \ + && rm -rf /var/run/dnf/* + +WORKDIR /jenkins + +CMD ["java", "-jar", "./jenkins.war"] diff --git a/Others/jenkins/2.523/24.03-lts-sp1/Dockerfile b/Others/jenkins/2.523/24.03-lts-sp1/Dockerfile index 5f3e17aa..65bc2a19 100644 --- a/Others/jenkins/2.523/24.03-lts-sp1/Dockerfile +++ b/Others/jenkins/2.523/24.03-lts-sp1/Dockerfile @@ -1,7 +1,6 @@ ARG BASE=openeuler/openeuler:24.03-lts-sp1 -FROM ${BASE} +FROM ${BASE} AS builder -ARG TARGETARCH ARG VERSION=2.523 ARG MAVEN_VERSION=3.9.6 ARG MAVEN_URL=https://repo.huaweicloud.com/apache/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz @@ -17,4 +16,16 @@ ENV PATH=$PATH:/usr/local/maven/bin RUN git clone -b jenkins-${VERSION} https://github.com/jenkinsci/jenkins.git && \ cd jenkins && \ - mvn clean install -Dmaven.test.skip=true \ No newline at end of file + mvn clean install -Dmaven.test.skip=true + +FROM ${BASE} +COPY --from=builder /jenkins/war/target/jenkins.war /jenkins/jenkins.war + +RUN dnf update -y \ + && dnf install -y java-17-openjdk \ + && dnf clean all \ + && rm -rf /var/run/dnf/* + +WORKDIR /jenkins + +CMD ["java", "-jar", "./jenkins.war"] diff --git a/Others/jenkins/2.524/24.03-lts-sp2/Dockerfile b/Others/jenkins/2.524/24.03-lts-sp2/Dockerfile new file mode 100644 index 00000000..109c5d09 --- /dev/null +++ b/Others/jenkins/2.524/24.03-lts-sp2/Dockerfile @@ -0,0 +1,31 @@ +ARG BASE=openeuler/openeuler:24.03-lts-sp2 +FROM ${BASE} AS builder + +ARG VERSION=2.524 +ARG MAVEN_VERSION=3.9.6 +ARG MAVEN_URL=https://repo.huaweicloud.com/apache/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz + +RUN yum install -y java-17-openjdk-devel git && \ + yum clean all && \ + curl -fSL -o apache-maven.tar.gz ${MAVEN_URL} && \ + mkdir -p /usr/local/maven && \ + tar -zxf apache-maven.tar.gz -C /usr/local/maven --strip-components=1 && \ + rm -rf apache-maven.tar.gz + +ENV PATH=$PATH:/usr/local/maven/bin + +RUN git clone -b jenkins-${VERSION} https://github.com/jenkinsci/jenkins.git && \ + cd jenkins && \ + mvn clean install -Dmaven.test.skip=true + +FROM ${BASE} +COPY --from=builder /jenkins/war/target/jenkins.war /jenkins/jenkins.war + +RUN dnf update -y \ + && dnf install -y java-17-openjdk \ + && dnf clean all \ + && rm -rf /var/run/dnf/* + +WORKDIR /jenkins + +CMD ["java", "-jar", "./jenkins.war"] diff --git a/Others/jenkins/README.md b/Others/jenkins/README.md index b30fdac8..52e82fda 100644 --- a/Others/jenkins/README.md +++ b/Others/jenkins/README.md @@ -19,20 +19,54 @@ The tag of each `jenkins` docker image is consist of the version of `jenkins` an | Tag | Currently | Architectures | |----------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|---------------| | [2.502-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/jenkins/2.502/24.03-lts-sp1/Dockerfile) | Jenkins 2.502 on openEuler 24.03-LTS-SP1 | amd64, arm64 | +| [2.523-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/jenkins/2.523/24.03-lts-sp1/Dockerfile) | Jenkins 2.523 on openEuler 24.03-LTS-SP1 | amd64, arm64 | +| [2.524-oe2403sp2](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/jenkins/2.524/24.03-lts-sp2/Dockerfile) | Jenkins 2.524 on openEuler 24.03-LTS-SP2 | amd64, arm64 | # Usage In this usage, users can select the corresponding `{Tag}` based on their requirements. -- Add jenkins dependency +- Start a jenkins instance - Maven: Add the following dependency to your `pom.xml`. - ``` - - org.jenkins-ci - jenkins - ${jenkins.version} - - ``` + ```bash + docker run -d --name my-jenkins -p 8080:8080 openeuler/jenkins:{Tag} + ``` + + 1. Browse to http://localhost:8080 (or whichever port you configured for Jenkins when installing it) and wait until the Unlock Jenkins page appears. + 2. From the Jenkins console log output, copy the automatically-generated alphanumeric password (between the 2 sets of asterisks). + ``` + ...... + 2025-08-20 01:40:48.403+0000 [id=45] INFO jenkins.install.SetupWizard#init: + + ************************************************************* + ************************************************************* + ************************************************************* + + Jenkins initial setup is required. An admin user has been created and a password generated. + Please use the following password to proceed to installation: + + be31b4b99afe42538822ffce31fa8103 + + This may also be found at: /root/.jenkins/secrets/initialAdminPassword + + ************************************************************* + ************************************************************* + ************************************************************* + + 2025-08-20 01:40:53.216+0000 [id=45] INFO jenkins.InitReactorRunner$1#onAttained: Completed initialization + ...... + ``` + +- View container running logs + + ```bash + docker logs -f my-jenkins + ``` + +- To get an interactive shell + + ```bash + docker exec -it my-jenkins bash + ``` # Question and answering If you have any questions or want to use some special features, please submit an issue or a pull request on [openeuler-docker-images](https://gitee.com/openeuler/openeuler-docker-images). \ No newline at end of file diff --git a/Others/jenkins/doc/image-info.yml b/Others/jenkins/doc/image-info.yml index 2335ac23..f121f18b 100644 --- a/Others/jenkins/doc/image-info.yml +++ b/Others/jenkins/doc/image-info.yml @@ -9,9 +9,11 @@ environment: | tags: | jenkins镜像的Tag由其版本信息和基础镜像版本信息组成,详细内容如下 - | Tag | Currently | Architectures | - |----------|-------------|------------------| - |[2.502-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/jenkins/2.502/24.03-lts-sp1/Dockerfile)| Jenkins 2.502 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + | Tag | Currently | Architectures | + |----------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|---------------| + | [2.502-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/jenkins/2.502/24.03-lts-sp1/Dockerfile) | Jenkins 2.502 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + | [2.523-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/jenkins/2.523/24.03-lts-sp1/Dockerfile) | Jenkins 2.523 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + | [2.524-oe2403sp2](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/jenkins/2.524/24.03-lts-sp2/Dockerfile) | Jenkins 2.524 on openEuler 24.03-LTS-SP2 | amd64, arm64 | download: | 拉取镜像到本地 @@ -20,15 +22,47 @@ download: | ``` usage: | - - 添加maven依赖 - - Maven: 在`pom.xml`文件中引入jenkins依赖 + - 启动容器 ``` - - org.jenkins-ci - jenkins - ${jenkins.version} - + docker run -d --name my-jenkins -p 8080:80 openeuler/jenkins:{Tag} + ``` + 用户可根据自身需求选择对应版本的{Tag}、容器启动的选项。`my-jenkins`启动之后,通过`http://localhost:8080`访问jenkins服务。 + + 1. 访问 **http://localhost:8080**(或配置的端口),解锁 Jenkins。 + 2. 从 Jenkins 控制台日志输出中,复制自动生成的字母数字组合密码(位于两组星号之间)。 + ``` + ...... + 2025-08-20 01:40:48.403+0000 [id=45] INFO jenkins.install.SetupWizard#init: + + ************************************************************* + ************************************************************* + ************************************************************* + + Jenkins initial setup is required. An admin user has been created and a password generated. + Please use the following password to proceed to installation: + + be31b4b99afe42538822ffce31fa8103 + + This may also be found at: /root/.jenkins/secrets/initialAdminPassword + + ************************************************************* + ************************************************************* + ************************************************************* + + 2025-08-20 01:40:53.216+0000 [id=45] INFO jenkins.InitReactorRunner$1#onAttained: Completed initialization + ...... + ``` + + - 容器测试 + + 查看运行日志 + ``` + docker logs -f my-jenkins + ``` + + 使用shell交互 + ``` + docker exec -it my-jenkins bash ``` license: MIT license diff --git a/Others/jenkins/meta.yml b/Others/jenkins/meta.yml index b38844ed..c89e9bc9 100644 --- a/Others/jenkins/meta.yml +++ b/Others/jenkins/meta.yml @@ -1,4 +1,6 @@ 2.502-oe2403sp1: path: 2.502/24.03-lts-sp1/Dockerfile 2.523-oe2403sp1: - path: 2.523/24.03-lts-sp1/Dockerfile \ No newline at end of file + path: 2.523/24.03-lts-sp1/Dockerfile +2.524-oe2403sp2: + path: 2.524/24.03-lts-sp2/Dockerfile \ No newline at end of file -- Gitee