Skip to content

Commit

Permalink
ci: remove building/testing with tomcat 8.5
Browse files Browse the repository at this point in the history
Signed-off-by: Rado <[email protected]>
  • Loading branch information
radnov committed Oct 30, 2024
1 parent 08b7094 commit 4b7eb3e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 94 deletions.
4 changes: 2 additions & 2 deletions dhis-2/dhis-web/dhis-web-portal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<name>DHIS Web Portal</name>
<properties>
<rootDir>../../</rootDir>
<jib.version>3.3.1</jib.version>
<jib.from.image>tomcat:9.0-jre11</jib.from.image>
<jib.version>3.4.4</jib.version>
<jib.from.image>tomcat:9.0.96-jre11</jib.from.image>
<jib.to.image>dhis2/core-dev:local</jib.to.image>
<!-- uid=65534(nobody) gid=65534(nogroup) present in Tomcat image -->
<jib.container.user>65534</jib.container.user>
Expand Down
72 changes: 29 additions & 43 deletions jenkinsfiles/dev
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"
}
}
}
Expand All @@ -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"
}

Expand Down Expand Up @@ -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')]) {
Expand Down
7 changes: 4 additions & 3 deletions jenkinsfiles/rebuild-image
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
71 changes: 25 additions & 46 deletions jenkinsfiles/stable
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"
}
}
}
Expand All @@ -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.
Expand Down

0 comments on commit 4b7eb3e

Please sign in to comment.