webMethods

 View Only
Expand all | Collapse all

How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

  • 1.  How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Fri September 09, 2022 02:30 AM

    We are using SAG WM 10.3 and using sagdevops-ci-assets (GitHub - SoftwareAG/sagdevops-ci-assets: Software AG DevOps library to support assets CI (continuous integration) with webMethods 9.x and 10.0. Work together with https://github.com/SoftwareAG/webmethods-sample-project-layout) for build and deployment.

    My build and deployment server is different.

    there are only build and deployment commands in sagdevops-ci-assets but no import command. we want to import variable substitution (.vs) file. In WmDeployer.sh, there is an “import” command using which .vs file can be imported. Same thing I want to do using sagdevops-ci-assets. Please help.

    Thanks in advance.


    #webMethods
    #webMethods-cloud
    #sagdevops-ci-assets
    #Software-AG
    #Integration-Server-and-ESB
    #webMethods-io-Integration


  • 2.  RE: How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Sat September 10, 2022 06:48 AM

    Please refer this Automated build and deployment using Jenkins, ABE, Deployer

    *cp .vs /IntegrationServer/instances//packages/WmDeployer/replicate/inbound/

    Deployer.bat --import -varsub <you-file-name(.vs file)> -map -project -validate <true/false> -host -port -user -pwd


    #sagdevops-ci-assets
    #Integration-Server-and-ESB
    #webMethods-cloud
    #webMethods
    #Software-AG
    #webMethods-io-Integration


  • 3.  RE: How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Thu November 10, 2022 06:50 AM

    Hi @srikanth.prathipati1803 - above import command is not working see the output error log.Error Executing Command

    [[DEP.0100.4.01] Error - -609] : [[DEP.0100.5.51] Import] : [DEP.0100.-609] Command requires -mapFile option. Please specify -mapFile option


    #Software-AG
    #webMethods-io-Integration
    #Integration-Server-and-ESB
    #webMethods
    #webMethods-cloud
    #sagdevops-ci-assets


  • 4.  RE: How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Mon September 12, 2022 09:42 AM

    Hi @aniruddha87 -

    I implemented this exact function for a customer a few years ago who had also used those GitHub projects as a starting point for their CI/CD implementation. Here are the related Ant targets from that implementation:

    	<target name="substituteVariables" depends="checkForVarsubFile, transformVarsubFile" if="${varsubFile.exists}">
    <echo>Substituting variables with file ${varsubFile}</echo>
    <exec executable="${deployerInstallationPath}/${deployerExecutable}" dir="${deployerInstallationPath}" failonerror="true" resultproperty="appState">
    <arg value="--import"/>
    <arg value="-varsub"/>
    <arg line="-vsFile ${varsubFile}"/>
    <arg line="-map myDeploymentMap"/>
    <arg line="-project ${projectName}"/>
    <arg line="-validate true"/>
    <arg line="-host ${deployerHost}"/>
    <arg line="-port ${deployerPort}"/>
    <arg line="-user ${deployerUsername}"/>
    <arg line="-pwd ${deployerPassword}"/>
    </exec>
    
    <if>
    <equals arg1="${appState}" arg2="0" trim="true"/>
    <then>
    <echo message="WMDeployer variable substitution successfully executed."/>
    </then>
    <else>
    <fail message="WMDeployer variable substitution failed."/>
    </else>
    </if>
    </target>
    
    <target name="checkForVarsubFile">
    <echo>Checking if Deployer variable substitution file ${varsubWorkspacePath}/${varsubFile} exists...</echo>
    <condition property="varsubFile.exists" else="false">
    <available file="${varsubWorkspacePath}/${varsubFile}"/>
    </condition>
    <echo>... file exists? ${varsubFile.exists}</echo>
    </target>
    
    <target name="transformVarsubFile" if="${varsubFile.exists}">
    <echo>Transforming variable substitution file with XSLT ${varsubXSLT} and copying the file to Deployer folder...</echo>
    <!-- Fill in attributes in varsub file and copy it to the Deployer location -->
    <xslt style="${varsubXSLT}" in="${varsubWorkspacePath}/${varsubFile}" out="${varsubDeployerPath}/${varsubFile}" force="true">
    <!--target server props -->
    <param name="serverAliasName" expression="${repositoryName}"/>
    <param name="targetServerName" expression="${deployerTargetAlias}"/>
    </xslt>
    <echo>... done.</echo>
    </target>
    

    And here’s the source code for the varsub XSLT:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" encoding="utf-8" indent="yes" />
    
    <xsl:param name="serverAliasName" />
    <xsl:param name="targetServerName" />
    
    <xsl:template match="@*|node()">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
    </xsl:template>
    
    <xsl:template match="Root/DeploymentSet/@serverAliasName">
    <xsl:attribute name="serverAliasName">
    <xsl:value-of select="$serverAliasName" />
    </xsl:attribute>
    </xsl:template>
    
    <xsl:template match="Root/DeploymentSet/@targetServerName">
    <xsl:attribute name="targetServerName">
    <xsl:value-of select="$targetServerName" />
    </xsl:attribute>
    </xsl:template>
    </xsl:stylesheet>
    

    Hope this helps,
    Percio


    #webMethods-io-Integration
    #sagdevops-ci-assets
    #Integration-Server-and-ESB
    #webMethods
    #Software-AG
    #webMethods-cloud


  • 5.  RE: How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Thu November 10, 2022 06:48 AM

    Hi @Percio_Castro1 where we have create above two file Or this file already exist inside our IS server, an you please give me more input on this since I’m new to this webmethod as you know very about in our previous post discussion.

    Thanks.


    #sagdevops-ci-assets
    #webMethods-cloud
    #webMethods-io-Integration
    #Integration-Server-and-ESB
    #webMethods
    #Software-AG


  • 6.  RE: How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Thu November 10, 2022 01:44 PM

    @palani_samy those snippets are for folks using the sagdevops-ci-asset GitHub project to kickstart their CI/CD pipeline. Are you using that project as a starting point?

    My particular client mentioned above was. In that case, I added those Ant targets in the buildDeployer.xml file and I simply placed the XSLT file it in a resources folder within that same project.

    If you’re not using that GitHub project as a starting point, then you wouldn’t perhaps use the snippets above. For example, in my current project where we’re using a Gitlab pipeline, I felt it was easier and simpler to just code everything in bash. The particular line that handles variable substitution looks like this:

    $DEP_HOME/bin/Deployer.sh --import -varsub -vsFile $VARSUB_ENV_FILE -map defaultMap -project cicdProject -validate true -host $DEPLOYER_HOST -port $DEPLOYER_PORT -user $DEPLOYER_USER -pwd $DEPLOYER_PWD -force

    It’s still a work in progress.

    Hope this helps,
    Percio


    #Integration-Server-and-ESB
    #sagdevops-ci-assets
    #webMethods-cloud
    #webMethods-io-Integration
    #webMethods
    #Software-AG


  • 7.  RE: How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Fri November 11, 2022 02:11 AM

    I’m not using GitHub project. Since I’m using Azure pipeline and also using bash script inside yaml file to run the above command (–import -varsub) but having question here correct me if anything wrong here.

    let say yesterday i have created my VS file from wmDeployer UI page by selecting specific services then the file is created under this path /home/user/SAG/IntegrationServer/instances/default/packages/WmDeployer/replicate/outbound, now the question is do i need create VS for each services like manually by using WmDeployer UI page or we can use single vs file as template and we and keep VS file is common for all the services we can change only required parameter from our azure pipeline using bash script.


    #webMethods
    #Software-AG
    #webMethods-io-Integration
    #Integration-Server-and-ESB
    #sagdevops-ci-assets
    #webMethods-cloud


  • 8.  RE: How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Fri November 11, 2022 01:13 PM

    I have a single vs file for each environment, i.e. development.vs, testing.vs, staging.vs, and production.vs. Each vs file has all the variable substitutions for that environment.

    Percio


    #webMethods
    #webMethods-io-Integration
    #Integration-Server-and-ESB
    #webMethods-cloud
    #Software-AG
    #sagdevops-ci-assets


  • 9.  RE: How to import variable substitution (.vs) file during Webmethods Deployment using sagdevops-ci-assets

    Posted Fri November 11, 2022 07:07 PM

    Thanks for the details again, i will create file as template from wmdeployer ui page then i will keep name as enviornment specific then while running pipeline i will find and replace value before run deployment command.


    #webMethods-io-Integration
    #sagdevops-ci-assets
    #Software-AG
    #Integration-Server-and-ESB
    #webMethods
    #webMethods-cloud