Skip to content

Commit

Permalink
Update default value of Jenkins version (jenkinsci#1411)
Browse files Browse the repository at this point in the history
* Update default value of Jenkins version

* Try and fix tests

* Fix ps1

* Minimize diff

* Remove HTML from regex

* facepalm
  • Loading branch information
basil committed Jun 26, 2022
1 parent e400fd8 commit 4d817e0
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 28 deletions.
4 changes: 2 additions & 2 deletions 11/almalinux/almalinux8/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ RUN curl -fsSL "https://github.com/krallin/tini/releases/download/${TINI_VERSION

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 11/alpine/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ RUN mkdir -p ${REF}/init.groovy.d

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 11/centos/centos7/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ RUN curl -fsSL "https://github.com/krallin/tini/releases/download/${TINI_VERSION

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.289.3}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=996dfd29d5f933546af9e9f77c29b371fb0627b8266b6c9f134ac2e0f1248b87
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 11/debian/bullseye-slim/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ RUN mkdir -p ${REF}/init.groovy.d

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 11/debian/bullseye/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ RUN mkdir -p ${REF}/init.groovy.d

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 11/rhel/ubi8/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ RUN curl -fsSL "https://github.com/krallin/tini/releases/download/${TINI_VERSION

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 11/windows/windowsservercore-2019/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ RUN New-Item -ItemType Directory -Force -Path C:/ProgramData/Jenkins/Reference/i

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 17/alpine/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ RUN mkdir -p ${REF}/init.groovy.d

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 17/debian/bullseye-slim/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ RUN mkdir -p ${REF}/init.groovy.d

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
4 changes: 2 additions & 2 deletions 17/debian/bullseye/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ RUN mkdir -p ${REF}/init.groovy.d

# jenkins version being bundled in this docker image
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.303}
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.356}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA=4dfe49cd7422ec4317a7c7a7c083f40fa475a58a7747bd94187b2cf222006ac0
ARG JENKINS_SHA=1163c4554dc93439c5eef02b06a8d74f98ca920bbc012c2b8a089d414cfa8075

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Expand Down
6 changes: 3 additions & 3 deletions tests/runtime.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Describe "[$TEST_TAG] passing JVM parameters" {
$cspSetting = @'
-Dhudson.model.DirectoryBrowserSupport.CSP=\"default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';\"
'@
$cspRegex = [regex]::Escape("default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';")
$cspRegex = [regex]::Escape("default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';")

function Start-With-Opts() {
Param (
Expand Down Expand Up @@ -100,11 +100,11 @@ Describe "[$TEST_TAG] passing JVM parameters" {
}

function Get-Csp-Value() {
return (Get-JenkinsWebpage $SUT_CONTAINER "/systemInfo").Replace("</tr>","</tr>`n").Replace("<wbr>", "").Split("`n") | Select-String -Pattern '<td class="pane">hudson.model.DirectoryBrowserSupport.CSP</td>'
return (Run-In-Script-Console $SUT_CONTAINER "System.getProperty('hudson.model.DirectoryBrowserSupport.CSP')")
}

function Get-Timezone-Value() {
return (Get-JenkinsWebpage $SUT_CONTAINER "/systemInfo").Replace("</tr>","</tr>`n").Replace("<wbr>", "").Split("`n") | Select-String -Pattern '<td class="pane">user.timezone</td>'
return (Run-In-Script-Console $SUT_CONTAINER "System.getProperty('user.timezone')")
}
}

Expand Down
15 changes: 10 additions & 5 deletions tests/test_helpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function Get-JenkinsPassword($Container) {
return $null
}

function Get-JenkinsWebpage($Container, $Url) {
function Run-In-Script-Console($Container, $Script) {
$jenkinsPassword = Get-JenkinsPassword $Container
$jenkinsUrl = Get-JenkinsUrl $Container
if($null -ne $jenkinsPassword) {
Expand All @@ -146,10 +146,15 @@ function Get-JenkinsWebpage($Container, $Url) {
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{ Authorization = $basicAuthValue }

$res = Invoke-WebRequest -Uri $('{0}{1}' -f $jenkinsUrl, $Url) -Headers $Headers -TimeoutSec 60 -Method Get -UseBasicParsing
if($res.StatusCode -eq 200) {
return $res.Content
}
$crumb = (Invoke-RestMethod -Uri $('{0}{1}' -f $jenkinsUrl, '/crumbIssuer/api/json') -Headers $Headers -TimeoutSec 60 -Method Get -SessionVariable session -UseBasicParsing).crumb
if ($null -ne $crumb) {
$Headers += @{ "Jenkins-Crumb" = $crumb }
}
$body = @{ script = $Script }
$res = Invoke-WebRequest -Uri $('{0}{1}' -f $jenkinsUrl, '/scriptText') -Headers $Headers -TimeoutSec 60 -Method Post -WebSession $session -UseBasicParsing -Body $body
if ($res.StatusCode -eq 200) {
return $res.Content.replace('Result: ', '')
}
}
return $null
}
Expand Down

0 comments on commit 4d817e0

Please sign in to comment.