Page MenuHomePhabricator

Verify Groovy behavior on CI Jenkins under Java 17
Closed, ResolvedPublic

Description

When the releasing Jenkins has been switched to Java 17, one of the job failed due to a change in the Groovy stripIndent() method. See: https://gitlab.wikimedia.org/repos/releng/jenkins-deploy/-/commit/4ca4744163ae8d2bfd41cba952ddf3477549c926

The CI Jenkins makes use of Groovy as well:

https://gerrit.wikimedia.org/g/integration/pipelinelib
https://gerrit.wikimedia.org/g/integration/config/+/refs/heads/master/jjb/blubber-test.groovy
https://gerrit.wikimedia.org/g/integration/config/+/refs/heads/master/jjb/maintenance-disconnect-full-disks.groovy
https://gerrit.wikimedia.org/g/integration/config/+/refs/heads/master/jjb/maintenance-sample-workspace-sizes.groovy
https://gerrit.wikimedia.org/g/integration/config/+/refs/heads/master/jjb/service-pipeline-builder.groovy

integration/pipelinelib as an integration test suite. It uses registry.hub.docker.com/jenkins/jenkins:2.448-slim which currently seems to use Java 17. There are specific images to pin the JDK version: 2.448-slim-jdk11 and 2.448-slim-jdk17

From IRC:

10:31:53 <•hashar> jnuche: do you have any idea as to why the automatic branch cut job has failed with "set: Illegal option -o pipefail"  ? 
10:31:59 <•hashar> https://releases-jenkins.wikimedia.org/job/Automatic%20branch%20cut/254/console :)
10:32:56 <•jnuche> hashar: yep, this is the cause: https://gitlab.wikimedia.org/repos/releng/jenkins-deploy/-/commit/4ca4744163ae8d2bfd41cba952ddf3477549c926
10:44:38 <•jnuche> Java 17 now bundles a `stripIndent` that has exactly the new behavior we just saw: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html#stripIndent()
10:44:48 <•jnuche> that was missing in Java 11: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html
10:45:15 <•jnuche> most likely the new Groovy implementation delegates that method to Java for version 17

Event Timeline

hashar claimed this task.

Pipelinelib has two usage of stripIndent() which seems already properly indented:

test/org/wikimedia/integration/GerritPipelineCommentTest.groovy
  void testwithoutImage() {
    def expected = '''\
    pipeline-dashboard: service-pipeline-test-and-publish
    pipeline-build-result: SUCCESS (job: service-pipeline-test-and-publish, build: 25)
    '''.stripIndent()
...
  void testwithImage() {
    def tags = ['2019-02-11-214153-production', 'fc52e49b051872b282c6a66be6649c7d437bf066']
    def imageName = 'docker-registry.wikimedia.org/wikimedia/mediawiki-services-citoid'

    def expected = '''\
    pipeline-dashboard: service-pipeline-test-and-publish
    pipeline-build-result: SUCCESS (job: service-pipeline-test-and-publish, build: 25)

    IMAGE:
     docker-registry.wikimedia.org/wikimedia/mediawiki-services-citoid

    TAGS:
     2019-02-11-214153-production, fc52e49b051872b282c6a66be6649c7d437bf066
    '''.stripIndent()

There is no usage of that method in integration/config.

Maybe something else will break, though. We shall see :)