diff --git a/dhis-2/dhis-web/dhis-web-portal/pom.xml b/dhis-2/dhis-web/dhis-web-portal/pom.xml index a208d46fafc8..ff1db9554e7d 100644 --- a/dhis-2/dhis-web/dhis-web-portal/pom.xml +++ b/dhis-2/dhis-web/dhis-web-portal/pom.xml @@ -13,8 +13,8 @@ DHIS Web Portal ../../ - 3.3.1 - tomcat:9.0-jre11 + 3.4.4 + tomcat:9.0.96-jre11 dhis2/core-dev:local 65534 diff --git a/jenkinsfiles/dev b/jenkinsfiles/dev index 62abae2ddd73..dd0d6db399d8 100644 --- a/jenkinsfiles/dev +++ b/jenkinsfiles/dev @@ -23,7 +23,6 @@ pipeline { DHIS2_VERSION = readMavenPom(file: 'dhis-2/pom.xml').getVersion() DOCKER_IMAGE_NAME = "${DOCKER_HUB_OWNER}/core-dev" DOCKER_IMAGE_TAG = "${env.GIT_BRANCH}" - DOCKER_IMAGE_NAME_PUBLISH_SOURCE = "tomcat:9.0-jre11" } stages { @@ -55,62 +54,47 @@ pipeline { RP_UUID = credentials('report-portal-access-uuid') RP_ENABLE = 'true' RP_ATTRIBUTES = "version:${env.GIT_BRANCH};" - DOCKER_IMAGE_NAME_BASE = 'tomcat' + DOCKER_IMAGE_NAME_FULL = "${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" } - matrix { - axes { - axis { - name 'DOCKER_IMAGE_TAG_BASE' - values '9.0-jre11', '8.5-jre11' + stages { + stage('Build Docker image') { + steps { + withDockerRegistry([credentialsId: "docker-hub-credentials", url: ""]) { + withMaven(options: [artifactsPublisher(disabled: true)]) { + sh "mvn --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true \ + --file dhis-2/dhis-web/dhis-web-portal/pom.xml --activate-profiles jibBuild jib:build \ + -Djib.to.image=${DOCKER_IMAGE_NAME_FULL} \ + -Djib.container.labels=DHIS2_VERSION=${DHIS2_VERSION},DHIS2_BUILD_REVISION=${GIT_COMMIT},DHIS2_BUILD_BRANCH=${env.GIT_BRANCH}" + } + } } } - environment { - DOCKER_IMAGE_NAME_BASE_FULL = "${DOCKER_IMAGE_NAME_BASE}:${DOCKER_IMAGE_TAG_BASE}" - DOCKER_IMAGE_NAME_FULL = "${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}-${DOCKER_IMAGE_TAG_BASE}" // used to test against different Tomcat variants - COMPOSE_PROJECT_NAME = "${DOCKER_IMAGE_TAG_BASE.replaceAll('\\.', '-')}" - } - - stages { - stage('Build Docker image') { - steps { - withDockerRegistry([credentialsId: "docker-hub-credentials", url: ""]) { - withMaven(options: [artifactsPublisher(disabled: true)]) { - sh "mvn --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true \ - -f dhis-2/dhis-web/dhis-web-portal/pom.xml jib:build -PjibBuild \ - -Djib.from.image=${DOCKER_IMAGE_NAME_BASE_FULL} -Djib.to.image=${DOCKER_IMAGE_NAME_FULL} \ - -Djib.container.labels=DHIS2_VERSION=${DHIS2_VERSION},DHIS2_BUILD_REVISION=${GIT_COMMIT},DHIS2_BUILD_BRANCH=${env.GIT_BRANCH}" - } + stage('Run tests') { + steps { + script { + dir("dhis-2/dhis-test-e2e") { + sh "docker pull ${DOCKER_IMAGE_NAME_FULL}" + sh "DHIS2_IMAGE=${DOCKER_IMAGE_NAME_FULL} docker compose --file docker-compose.yml --file docker-compose.e2e.yml up --remove-orphans --exit-code-from test" } } } - stage('Run tests') { - steps { + post { + always { script { dir("dhis-2/dhis-test-e2e") { - sh "docker pull ${DOCKER_IMAGE_NAME_FULL}" - sh "DHIS2_IMAGE=${DOCKER_IMAGE_NAME_FULL} docker compose --project-name ${COMPOSE_PROJECT_NAME} --file docker-compose.yml --file docker-compose.e2e.yml up --remove-orphans --exit-code-from test" + archiveArtifacts artifacts: "coverage.csv", allowEmptyArchive: true } } } - post { - always { - script { - dir("dhis-2/dhis-test-e2e") { - archiveArtifacts artifacts: "coverage.csv", allowEmptyArchive: true - } - } - } - - failure { - script { - dir("dhis-2/dhis-test-e2e") { - sh "docker compose --project-name ${COMPOSE_PROJECT_NAME} logs web > ${COMPOSE_PROJECT_NAME}-logs.txt" - archiveArtifacts artifacts: "${COMPOSE_PROJECT_NAME}-logs.txt" - } + failure { + script { + dir("dhis-2/dhis-test-e2e") { + sh "docker compose logs web > web-logs.txt" + archiveArtifacts artifacts: "web-logs.txt" } } } @@ -137,7 +121,8 @@ pipeline { stage('Publish image') { environment { - BASE_IMAGE = "$DOCKER_IMAGE_NAME_PUBLISH_SOURCE" + // THIS MUST be kept in sync with the jib.from.image in ../dhis-2/dhis-web/dhis-web-portal/pom.xml + BASE_IMAGE = "tomcat:9.0.96-jre11" IMAGE_REPOSITORY = "$DOCKER_IMAGE_NAME" } @@ -175,6 +160,7 @@ pipeline { MIN_READY_SECONDS = "240" CORE_RESOURCES_REQUESTS_MEMORY = "2500Mi" } + steps { script { withCredentials([usernamePassword(credentialsId: 'dhis2-im-bot', passwordVariable: 'PASSWORD', usernameVariable: 'USER_EMAIL')]) { diff --git a/jenkinsfiles/rebuild-image b/jenkinsfiles/rebuild-image index 4e28f976c6bc..bdc5f9c0d976 100644 --- a/jenkinsfiles/rebuild-image +++ b/jenkinsfiles/rebuild-image @@ -40,11 +40,12 @@ pipeline { env.VERSIONS_TO_REBUILD.tokenize(" ").each { version -> def majorVersion = version.split('\\.')[0].toInteger() if (majorVersion >= 42) { - env.BASE_IMAGE = "tomcat:10.0-jre17" + // THIS MUST be kept in sync with the jib.from.image in ../dhis-2/dhis-web-server/pom.xml + env.BASE_IMAGE = "tomcat:10.1.30-jre17" } else if (majorVersion == 41) { - env.BASE_IMAGE = "tomcat:9.0-jre17" + env.BASE_IMAGE = "tomcat:9.0.96-jre17" } else { - env.BASE_IMAGE = "tomcat:9.0-jre11" + env.BASE_IMAGE = "tomcat:9.0.96-jre11" } sh """#!/bin/bash diff --git a/jenkinsfiles/stable b/jenkinsfiles/stable index 5176eca67807..0d75f23c73a2 100644 --- a/jenkinsfiles/stable +++ b/jenkinsfiles/stable @@ -18,8 +18,9 @@ pipeline { DOCKER_IMAGE_NAME_DEV = "${DOCKER_HUB_OWNER}/core-dev" DOCKER_IMAGE_NAME = "${DOCKER_HUB_OWNER}/core" DOCKER_IMAGE_TAG = "${env.DHIS2_VERSION.replace('SNAPSHOT', 'rc')}" - DOCKER_IMAGE_NAME_PUBLISH_SOURCE = "tomcat:9.0-jre11" // source of image to publish to Dockerhub (one of the matrix axes) DOCKER_IMAGE_NAME_PUBLISH_TARGET = "${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" // used to publish to Dockerhub + BASE_IMAGE = "tomcat:9.0.96-jre11" + IMAGE_REPOSITORY = "$DOCKER_IMAGE_NAME" } stages { @@ -47,61 +48,44 @@ pipeline { RP_UUID = credentials('report-portal-access-uuid') RP_ENABLE = 'true' RP_ATTRIBUTES = "version:${env.GIT_BRANCH};" - DOCKER_IMAGE_NAME_BASE = 'tomcat' + DOCKER_IMAGE_NAME_FULL = "${DOCKER_IMAGE_NAME_DEV}:${DOCKER_IMAGE_TAG}" } - matrix { - axes { - axis { - name 'DOCKER_IMAGE_TAG_BASE' - values '9.0-jre11', '8.5-jre11' + stages { + stage('Build Docker image') { + steps { + withDockerRegistry([credentialsId: "docker-hub-credentials", url: ""]) { + withMaven(options: [artifactsPublisher(disabled: true)]) { + sh './dhis-2/build-docker-image.sh -t "${DOCKER_IMAGE_TAG}" -d' + } + } } } - environment { - DOCKER_IMAGE_NAME_FULL = "${DOCKER_IMAGE_NAME_DEV}:${DOCKER_IMAGE_TAG}-${DOCKER_IMAGE_TAG_BASE}" // used to test against different Tomcat variants - BASE_IMAGE = "${DOCKER_IMAGE_NAME_BASE}:${DOCKER_IMAGE_TAG_BASE}" - IMAGE_REPOSITORY = "$DOCKER_IMAGE_NAME_DEV" - UNARCHIVED_WAR_DIR = "dhis2-war-$DOCKER_IMAGE_TAG_BASE" // this needs to be different for the two matrix stages, as they run in parallel - COMPOSE_PROJECT_NAME = "${DOCKER_IMAGE_TAG_BASE.replaceAll('\\.', '-')}" - } - - stages { - stage('Build Docker image') { - steps { - withDockerRegistry([credentialsId: "docker-hub-credentials", url: ""]) { - withMaven(options: [artifactsPublisher(disabled: true)]) { - sh './dhis-2/build-docker-image.sh -t "${DOCKER_IMAGE_TAG}-${DOCKER_IMAGE_TAG_BASE}" -d' - } + stage('Run tests') { + steps { + script { + dir("dhis-2/dhis-test-e2e") { + sh "docker pull ${DOCKER_IMAGE_NAME_FULL}" + sh "DHIS2_IMAGE=${DOCKER_IMAGE_NAME_FULL} docker compose --file docker-compose.yml --file docker-compose.e2e.yml up --remove-orphans --exit-code-from test" } } } - stage('Run tests') { - steps { + post { + always { script { dir("dhis-2/dhis-test-e2e") { - sh "docker pull ${DOCKER_IMAGE_NAME_FULL}" - sh "DHIS2_IMAGE=${DOCKER_IMAGE_NAME_FULL} docker compose --project-name ${COMPOSE_PROJECT_NAME} --file docker-compose.yml --file docker-compose.e2e.yml up --remove-orphans --exit-code-from test" + archiveArtifacts artifacts: "coverage.csv", allowEmptyArchive: true } } } - post { - always { - script { - dir("dhis-2/dhis-test-e2e") { - archiveArtifacts artifacts: "coverage.csv", allowEmptyArchive: true - } - } - } - - failure { - script { - dir("dhis-2/dhis-test-e2e") { - sh "docker compose --project-name ${COMPOSE_PROJECT_NAME} logs web > ${COMPOSE_PROJECT_NAME}-logs.txt" - archiveArtifacts artifacts: "${COMPOSE_PROJECT_NAME}-logs.txt" - } + failure { + script { + dir("dhis-2/dhis-test-e2e") { + sh "docker compose logs web > web-logs.txt" + archiveArtifacts artifacts: "web-logs.txt" } } } @@ -111,11 +95,6 @@ pipeline { } stage('Publish images') { - environment { - BASE_IMAGE = "$DOCKER_IMAGE_NAME_PUBLISH_SOURCE" - IMAGE_REPOSITORY = "$DOCKER_IMAGE_NAME" - } - steps { script { // Remove -rc suffix in case it's there, will be added later if needed.