How to deploy packages to multiple environements using Jenkins pipeline

Hi All

I have done a POC on CI/CD and was able to successfully implement the same using GIT bash which i used for commiting the code to GIThub and jenkins for pulling the build and deploying it to target server automatically without the need of creating a jenkins job.

My question is i am able to do the deployment to 1 server only. What if there are multiple servers

like say 4 QA and 4 PROD so when i commit the code the deployment of packages need to happen to 4 QA and once the sign off is done later to 4 PROD and also how to change the global vars or Adapter connection properties at run time as test and prod can have different connection server details right.

This is currently my system.properties file i have used the SAG provided assets from GITHUB. I tried to add multiple servers below but that didnt work.

#Build Server Settings
deployerHost=localhost
deployerPort=5555
deployerUsername=Administrator
deployerPassword=manage

#Target CI Test Server Settings
testISHost=localhost
testISPort=7777
testISUsername=Administrator
testISPassword=manage

This is my pipeline job

pipeline {
agent any

stages {
    stage('Build'){
        steps {
            bat "${env.SAG_HOME}/common/lib/ant/bin/ant -DSAGHome=${env.SAG_HOME} -DSAG_CI_HOME=${env.SAG_CI_HOME} -DprojectName=${env.JOB_NAME} build"
        }
    }
    stage('Deploy') {
        steps {
	bat "${env.SAG_HOME}/common/lib/ant/bin/ant -DSAGHome=${env.SAG_HOME} -DSAG_CI_HOME=${env.SAG_CI_HOME} -DprojectName=${env.JOB_NAME} deploy"
        }
    }
stage('Test') {
        steps {
	bat "${env.SAG_HOME}/common/lib/ant/bin/ant -DSAGHome=${env.SAG_HOME} -DSAG_CI_HOME=${env.SAG_CI_HOME} -DprojectName=${env.JOB_NAME} test"
	junit 'report/'
        }
    }
}

}

Thanks in advance

Hi Parre,

if possible, try to use Deployer with Project Automator. This can even be used in Jenkins Jobs.

Here you can define Maps for the different stages and target serves in which you can define variable substitution to replace the values for the differen environments.

Due to technical issues I would advise to separate the Adapter Connections and Listeners to a dedicated package for each instance which will never be deployed but maintained manually instead.
Esp. SAP Adapter Listeners do not support variable substitution via Map.

Regards,
Holger

Hi Holger.

I didnt do the project automator steps . Do you have any steps has how that can be performed and added in jenkins.

As far as i know there should be deployer resource package installed in both source and target systems and in map we can configure target groups or target servers like add them as remote server alias.

Hi Parre,

you will require a Product called Deployer installed on one of your instances and define all possible target servers (and target groups) there.
After the servers are defined you can install the WmDeployerResource package from there to the targets.
Remember to update the WmDeployerResource package after applying Fixes to the Deployer.

Define the project and build it in Deployer as well as the required maps.

Project Automator is an OS script lcoated under packages/WmDeployer/bin, which can be invoked from Jenkins jobs.
It will take at least the build name and the map name as inputs.

See Deployer Users Guide for further informations.

Regards,
Holger

1 Like

+100 for this. Never put adapter connection pools in with code packages. Our convention is the same as what @Holger_von_Thomsen noted-- all connection pools are in one package and that package is never deployed. Via any tool. Simply manually created and maintained. Creating pools is a low-volume activity and changing them is even lower. There is no real value that I’ve seen in trying to version-control these and using automation to deploy them. You’ll spend more time figuring out how to do var substitution for the automation and more time figuring out and recovering issues when mistakes are made. Spend the 5 minutes creating it manually and be done with it. :slight_smile:

Edit: There should not be anything environment specific in any package that is deployed with Deployer or any other tool.

1 Like

Hi raemon / holger

i have deployer along with the deployer resource already installed and moreover the adapter connections are in different packages rather than in a package along with flow and other services.

I tried to change the jenkins pipeline by adding a stage separately and seems it worked but need to make some more changes additionally.