From c643ed5b7d4af260f4d16117a231a1f797d85823 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Tue, 26 Nov 2024 19:08:00 +0100 Subject: [PATCH] OZG-7021 OZG-7217 Build, tag and push Docker images --- alfa-client/apps/info/Jenkinsfile | 21 ++++++++++++++++++--- alfa-client/apps/info/project.json | 3 ++- alfa-client/package.json | 3 --- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/alfa-client/apps/info/Jenkinsfile b/alfa-client/apps/info/Jenkinsfile index a8104a6a9f..733723cb4c 100644 --- a/alfa-client/apps/info/Jenkinsfile +++ b/alfa-client/apps/info/Jenkinsfile @@ -10,6 +10,7 @@ pipeline { SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ FAILED_STAGE = "" SH_SUCCESS_STATUS_CODE = 0 + FORCE_COLOR = 0 } options { timeout(time: 1, unit: 'HOURS') @@ -36,10 +37,24 @@ pipeline { sh 'echo "//nexus.ozg-sh.de/:_auth=amVua2luczprTSFnNVUhMVQzNDZxWQ==" >> ~/.npmrc' sh 'npm cache verify' sh 'npm install' - sh 'npm run ci-test-info' - sh 'npm run ci-build-info-by' - sh 'npm run ci-build-info-sh' + sh 'npx nx run info:test' // TODO: Is Sonar necessary? + + IMAGE_TAG = generateImageTag() + + if (isMasterBranch()) { + IMAGE_TAG = "snapshot-latest" + } + else if (isReleaseBranch()) { + IMAGE_TAG = "latest" + } + + withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) { + sh 'docker login docker.ozg-sh.de -u ${USER} -p ${PASSWORD}' + } + + sh "INPUT_TAGS=${IMAGE_TAG} INPUT_IMAGES=docker.ozg-sh.de/info-client-by npx nx container info --configuration=by" + sh "INPUT_TAGS=${IMAGE_TAG} INPUT_IMAGES=docker.ozg-sh.de/info-client-sh npx nx container info --configuration=sh" } } } diff --git a/alfa-client/apps/info/project.json b/alfa-client/apps/info/project.json index 522d61ad7f..ff755ade38 100644 --- a/alfa-client/apps/info/project.json +++ b/alfa-client/apps/info/project.json @@ -142,13 +142,14 @@ ], "options": { "engine": "docker", + "push": true, "metadata": { "images": [ "docker.ozg-sh.de/info" ], "load": true, "tags": [ - "build-latest" + "snapshot-latest" ] } } diff --git a/alfa-client/package.json b/alfa-client/package.json index 9fe33b8a53..fa0be06689 100644 --- a/alfa-client/package.json +++ b/alfa-client/package.json @@ -20,11 +20,8 @@ "ci-build-admin": "nx container admin && cp -r dist/ apps/admin/", "ci-prodBuild": "nx run alfa:build --outputHashing=all --configuration production", "ci-prodBuild-admin": "nx container admin && cp -r dist/ apps/admin/", - "ci-build-info-by": "INPUT_TAGS=by nx container info --configuration=by", - "ci-build-info-sh": "INPUT_TAGS=sh nx container info --configuration=sh", "ci-test": "nx run-many --target=test --parallel 20 -- --runInBand", "ci-sonar": "nx run-many --target=test --parallel 20 -- --runInBand --codeCoverage --coverageReporters=lcov --testResultsProcessor=jest-sonar-reporter && npx sonar-scanner", - "ci-test-info": "nx run info:test", "lint": "nx workspace-lint && nx lint", "affected:apps": "nx affected:apps", "affected:libs": "nx affected:libs", -- GitLab