From a4f559f9c1bcb5429925278eea6ba7e66ee2a148 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Mon, 14 Dec 2020 11:40:50 +0100 Subject: [PATCH] Downgrade Jenkins JDK version to Java 8 (#1473) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Downgrade Jenkins JDK version to Java 8 The unit tests cannot run properly with Java 11. We have to downgrade our image to use Java 8 instead until we have fixed this issue. * Fix unit tests that have not been adapted during the failed builds Co-authored-by: René Pfeuffer --- Jenkinsfile | 2 +- build/Dockerfile | 2 +- build/Makefile | 2 +- .../sonia/scm/api/v2/resources/BranchRootResourceTest.java | 2 +- .../java/sonia/scm/api/v2/resources/TagRootResourceTest.java | 2 +- .../scm/security/AuthorizationChangedEventProducerTest.java | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9acca06822..362fc1ea6a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -204,7 +204,7 @@ String developmentBranch String mainBranch Maven setupMavenBuild() { - MavenWrapperInDocker mvn = new MavenWrapperInDocker(this, "scmmanager/java-build:11.0.9_11.1") + MavenWrapperInDocker mvn = new MavenWrapperInDocker(this, "scmmanager/java-build:8u275-b01") mvn.enableDockerHost = true // disable logging durring the build diff --git a/build/Dockerfile b/build/Dockerfile index b5b2585c2b..ab9b395cc6 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -22,7 +22,7 @@ # SOFTWARE. # -FROM adoptopenjdk/openjdk11:x86_64-debian-jdk-11.0.9_11.1 +FROM adoptopenjdk/openjdk8:x86_64-debian-jdk8u275-b01 ENV DOCKER_VERSION=19.03.8 \ DOCKER_CHANNEL=stable \ diff --git a/build/Makefile b/build/Makefile index 8aa8cefc1d..58c2d7cd19 100644 --- a/build/Makefile +++ b/build/Makefile @@ -1,4 +1,4 @@ -VERSION:=11.0.9_11.1 +VERSION:=8u275-b01 .PHONY:build build: diff --git a/scm-webapp/src/test/java/sonia/scm/api/v2/resources/BranchRootResourceTest.java b/scm-webapp/src/test/java/sonia/scm/api/v2/resources/BranchRootResourceTest.java index 7022422cea..f2c0a29cee 100644 --- a/scm-webapp/src/test/java/sonia/scm/api/v2/resources/BranchRootResourceTest.java +++ b/scm-webapp/src/test/java/sonia/scm/api/v2/resources/BranchRootResourceTest.java @@ -275,7 +275,7 @@ public class BranchRootResourceTest extends RepositoryTestBase { @Test public void shouldNotDeleteBranchIfNotPermitted() throws IOException, URISyntaxException { - doThrow(AuthorizationException.class).when(subject).checkPermission("repository:modify:repoId"); + doThrow(AuthorizationException.class).when(subject).checkPermission("repository:push:repoId"); when(branchesCommandBuilder.getBranches()).thenReturn(new Branches(Branch.normalBranch("suspicious", "0"))); MockHttpRequest request = MockHttpRequest diff --git a/scm-webapp/src/test/java/sonia/scm/api/v2/resources/TagRootResourceTest.java b/scm-webapp/src/test/java/sonia/scm/api/v2/resources/TagRootResourceTest.java index 7655dd7c9b..62183c5b09 100644 --- a/scm-webapp/src/test/java/sonia/scm/api/v2/resources/TagRootResourceTest.java +++ b/scm-webapp/src/test/java/sonia/scm/api/v2/resources/TagRootResourceTest.java @@ -325,7 +325,7 @@ public class TagRootResourceTest extends RepositoryTestBase { @Test public void shouldNotDeleteTagIfNotPermitted() throws IOException, URISyntaxException { - doThrow(AuthorizationException.class).when(subject).checkPermission("repository:modify:repoId"); + doThrow(AuthorizationException.class).when(subject).checkPermission("repository:push:repoId"); Tags tags = new Tags(); tags.setTags(Collections.singletonList(new Tag("newtag", "592d797cd36432e591416e8b2b98154f4f163411"))); when(tagsCommandBuilder.getTags()).thenReturn(tags); diff --git a/scm-webapp/src/test/java/sonia/scm/security/AuthorizationChangedEventProducerTest.java b/scm-webapp/src/test/java/sonia/scm/security/AuthorizationChangedEventProducerTest.java index f76d3e5a0f..c9abf21d92 100644 --- a/scm-webapp/src/test/java/sonia/scm/security/AuthorizationChangedEventProducerTest.java +++ b/scm-webapp/src/test/java/sonia/scm/security/AuthorizationChangedEventProducerTest.java @@ -85,13 +85,13 @@ public class AuthorizationChangedEventProducerTest { private void assertUserEventIsFired(String username){ assertNotNull(producer.event); - assertTrue(producer.event.isEveryUserAffected()); + assertFalse(producer.event.isEveryUserAffected()); assertEquals(username, producer.event.getNameOfAffectedUser()); } private void assertGlobalEventIsFired(){ assertNotNull(producer.event); - assertFalse(producer.event.isEveryUserAffected()); + assertTrue(producer.event.isEveryUserAffected()); } /**