Skip to content

Commit

Permalink
Pull request #5: Update jenkinsfile.
Browse files Browse the repository at this point in the history
Merge in SITC/product-items-report from feature/ETDS-600-Update-jenkinsfiles-to-upload-files-to-jfrog to master

Squashed commit of the following:

commit 97e9b33db13768a82a7ceff50ece3e99fc6ffa68
Author: indaleciocb <[email protected]>
Date:   Wed Aug 9 12:23:04 2023 +0200

    Update jenkinsfile.
  • Loading branch information
indaleciocb committed Aug 9, 2023
1 parent e4932b9 commit 6ac3e72
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def environment = [

PUBLISH_PACKAGE: true,
PACKAGE_TYPE: "zip",
STORAGE_HOST: "storage.dev.cloud.im",
STORAGE_PATH: "/home/storage/connect/${env.PROJECT_NAME}",
JFROG_REPO: "aps-integrations",
JFROG_PATH: "", // Leave empty to use the PROJECT_NAME
JFROG_URL: "https://repo.com.int.zone/artifactory/",

FILE_NAME_PYPROJECT_TOML: "pyproject.toml",
FILE_NAME_REQUIREMENTS: "requirements.txt",
Expand Down Expand Up @@ -60,6 +61,12 @@ def pipelineStages = [
}

env.PROJECT_DELIVERABLE="${env.PROJECT_NAME}-${env.PROJECT_VERSION}.${env.PACKAGE_TYPE}"

if (env.JFROG_PATH == null) {
env.JFROG_UPLOAD_URL = "${env.JFROG_URL}${env.JFROG_REPO}/${env.PROJECT_NAME}/"
} else {
env.JFROG_UPLOAD_URL = "${env.JFROG_URL}${env.JFROG_REPO}/${env.JFROG_PATH}/"
}
}],
[name: 'Installing tools', steps: {
sh """#!/bin/bash
Expand Down Expand Up @@ -328,13 +335,11 @@ def pipelineStages = [
[name: 'Publish Package', steps: {
if (env.PUBLISH_PACKAGE.toBoolean()) {
if (env.BRANCH_NAME == "master" && env.SEMANTIC_VERSION != "v0.0.0-dev") {
withCredentials([sshUserPrivateKey(credentialsId: 'connect-storage-dev-ssh-key', keyFileVariable: 'SSH_PRIVATE_KEY')]) {
withCredentials([usernamePassword(credentialsId: 'ci-user', passwordVariable: 'CRED_SECRET', usernameVariable: 'CRED_USER')]) {
sh """#!/bin/bash
set -euxo pipefail
ssh -i $SSH_PRIVATE_KEY -o StrictHostKeyChecking=no -l storage ${env.STORAGE_HOST} "[ -d ${env.STORAGE_PATH} ] || mkdir -p ${env.STORAGE_PATH}"
scp -i $SSH_PRIVATE_KEY "${env.PROJECT_DELIVERABLE}" storage@${env.STORAGE_HOST}:${env.STORAGE_PATH}/${env.PROJECT_DELIVERABLE}
echo "Link to download the package: http://${env.STORAGE_HOST}:81/connect/${env.PROJECT_NAME}/${env.PROJECT_DELIVERABLE}"
curl -sSf -u ${CRED_USER}:${CRED_SECRET} -X PUT -T "${env.PROJECT_DELIVERABLE}" "${env.JFROG_UPLOAD_URL}${env.PROJECT_DELIVERABLE}"
"""
}
}
Expand Down

0 comments on commit 6ac3e72

Please sign in to comment.