From ee8ab6ceda4a88e3c02c65ba5c12c2243f2883dc Mon Sep 17 00:00:00 2001 From: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Mon, 6 Sep 2021 21:32:15 +0100 Subject: [PATCH] Update to latest version of docker/agent (#240) --- 11/windows/windowsservercore-1809/Dockerfile | 41 -------------------- Jenkinsfile | 23 ++++++----- README.md | 4 +- docker-bake.hcl | 4 +- 4 files changed, 18 insertions(+), 54 deletions(-) delete mode 100644 11/windows/windowsservercore-1809/Dockerfile diff --git a/11/windows/windowsservercore-1809/Dockerfile b/11/windows/windowsservercore-1809/Dockerfile deleted file mode 100644 index f9dfb377..00000000 --- a/11/windows/windowsservercore-1809/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# escape=` -# The MIT License -# -# Copyright (c) 2019, Alex Earl -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -ARG VERSION=4.9-1 -FROM jenkins/agent:${VERSION}-jdk11-windowsservercore-1809 - -LABEL Description="This is a base image, which allows connecting Jenkins agents via JNLP protocols on Windows" Vendor="Jenkins Project" Version="$VERSION" - -ARG user=jenkins - -RUN $output = net users ; ` - if(-not ($output -match $env:user)) { ` - Write-Host 'user does not exist?' ; ` - net user $env:user /add /expire:never /passwordreq:no ; ` - net localgroup Administrators /add $env:user ; ` - wmic useraccount WHERE Name=$env:user set PasswordExpires=false; ` - } - -COPY jenkins-agent.ps1 C:/ProgramData/Jenkins -USER ${user} -ENTRYPOINT ["powershell.exe", "-f", "C:/ProgramData/Jenkins/jenkins-agent.ps1"] diff --git a/Jenkinsfile b/Jenkinsfile index 3adb93c9..bbb7bc4f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -63,18 +63,23 @@ pipeline { steps { script { def branchName = "${env.BRANCH_NAME}" - if (branchName ==~ 'master') { - // publish the images to Dockerhub - infra.withDockerCredentials { + infra.withDockerCredentials { + if (branchName ==~ 'master') { + // publish the images to Dockerhub + sh ''' + docker buildx create --use + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + docker buildx bake --push --file docker-bake.hcl linux + ''' + } else if (env.TAG_NAME == null) { + sh 'make build' + sh 'make test' sh ''' - docker buildx create --use - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - docker buildx bake --push --file docker-bake.hcl linux + docker buildx create --use + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + docker buildx bake --file docker-bake.hcl linux ''' } - } else if (env.TAG_NAME == null) { - sh 'make build' - sh 'make test' } if(env.TAG_NAME != null) { diff --git a/README.md b/README.md index 4e0461cd..4a6e9acd 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ To run a Docker container Windows agent: - docker run jenkins/inbound-agent:windowsservercore-1809 -Url http://jenkins-server:port -Secret -Name + docker run jenkins/inbound-agent:windowsservercore-ltsc2019 -Url http://jenkins-server:port -Secret -Name To run a Docker container with [Work Directory](https://github.com/jenkinsci/remoting/blob/master/docs/workDir.md) @@ -34,7 +34,7 @@ To run a Docker container with [Work Directory](https://github.com/jenkinsci/rem Windows agent: - docker run jenkins/inbound-agent:windowsservercore-1809 -Url http://jenkins-server:port -WorkDir=C:/Jenkins/agent -Secret -Name + docker run jenkins/inbound-agent:windowsservercore-ltsc2019 -Url http://jenkins-server:port -WorkDir=C:/Jenkins/agent -Secret -Name Optional environment variables: diff --git a/docker-bake.hcl b/docker-bake.hcl index d63566c7..107cc17c 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -23,7 +23,7 @@ group "linux-ppc64le" { # update this to use a newer build number for jenkins/docker image variable "AGENT_IMAGE_BUILD_NUMBER" { - default = "1" + default = "4" } variable "REGISTRY" { @@ -104,5 +104,5 @@ target "debian_jdk11" { "${REGISTRY}/${JENKINS_REPO}:latest", "${REGISTRY}/${JENKINS_REPO}:latest-jdk11", ] - platforms = ["linux/amd64", "linux/arm64"] + platforms = ["linux/amd64", "linux/arm64", "linux/s390x"] }