Skip to content

Commit

Permalink
ci: set compose project name as env variable [skip ci] (#18854)
Browse files Browse the repository at this point in the history
Signed-off-by: Rado <radoslav@dhis2.org>
  • Loading branch information
radnov authored Oct 17, 2024
1 parent 59872ab commit 040a2d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions jenkinsfiles/dev
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pipeline {
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 {
Expand All @@ -88,10 +89,9 @@ pipeline {
stage('Run tests') {
steps {
script {
projectName = "${DOCKER_IMAGE_TAG_BASE.replaceAll('\\.', '-')}"
dir("dhis-2/dhis-test-e2e") {
sh "docker pull ${DOCKER_IMAGE_NAME_FULL}"
sh "DHIS2_IMAGE=${DOCKER_IMAGE_NAME_FULL} docker compose --project-name ${projectName} --file docker-compose.yml --file docker-compose.e2e.yml up --remove-orphans --exit-code-from test"
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"
}
}
}
Expand All @@ -108,8 +108,8 @@ pipeline {
failure {
script {
dir("dhis-2/dhis-test-e2e") {
sh "docker compose --project-name ${projectName} logs web > ${projectName}-logs.txt"
archiveArtifacts artifacts: "${projectName}-logs.txt"
sh "docker compose --project-name ${COMPOSE_PROJECT_NAME} logs web > ${COMPOSE_PROJECT_NAME}-logs.txt"
archiveArtifacts artifacts: "${COMPOSE_PROJECT_NAME}-logs.txt"
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions jenkinsfiles/stable
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pipeline {
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 {
Expand All @@ -79,10 +80,9 @@ pipeline {
stage('Run tests') {
steps {
script {
projectName = "${DOCKER_IMAGE_TAG_BASE.replaceAll('\\.', '-')}"
dir("dhis-2/dhis-test-e2e") {
sh "docker pull ${DOCKER_IMAGE_NAME_FULL}"
sh "DHIS2_IMAGE=${DOCKER_IMAGE_NAME_FULL} docker compose --project-name ${projectName} --file docker-compose.yml --file docker-compose.e2e.yml up --remove-orphans --exit-code-from test"
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"
}
}
}
Expand All @@ -99,8 +99,8 @@ pipeline {
failure {
script {
dir("dhis-2/dhis-test-e2e") {
sh "docker compose --project-name ${projectName} logs web > ${projectName}-logs.txt"
archiveArtifacts artifacts: "${projectName}-logs.txt"
sh "docker compose --project-name ${COMPOSE_PROJECT_NAME} logs web > ${COMPOSE_PROJECT_NAME}-logs.txt"
archiveArtifacts artifacts: "${COMPOSE_PROJECT_NAME}-logs.txt"
}
}
}
Expand Down

0 comments on commit 040a2d7

Please sign in to comment.