Hi,
I'm trying to replace a local database from within a Jenkins pipeline.
The database may or may not be running (eclipse PDSOE autostarted) so I added a proshut target to my ant build.
This works fine in an interactive session but fails when run from a jenkins agent
I have following target in an ant build file
<target name="database_proshut" > <echo>Shutdown ${localdatadir}/${dbName}/${dbName}</echo> <exec dir="${localdatadir}/${dbName}" executable="${progress.DLC}/bin/_mprshut"> <env key="DLC" value="${progress.DLC}" /> <arg value="${dbName}" /> <arg value="-by"/> </exec> </target>
C:\Users\cvb>ant -f git/ccesmarttools/CceSmartTools/files/devtools/buildnightly/build.xml -Dbasedir=. -Ddumptemp=c:\temp -Dlocaldatadir=c:/cce/localdata -DdbName=LISA database_proshut Buildfile: C:\Users\cvb\git\ccesmarttools\CceSmartTools\files\devtools\buildnightly\build.xml database_proshut: [echo] Shutdown c:/cce/localdata/LISA/LISA [exec] Shutdown is executing. (1613) [exec] Shutdown complete. (1614) BUILD SUCCESSFUL Total time: 6 seconds
The jenkins agent is running a a server, the server is running with the same credentials as the interactive session.
Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] echo Will create local databases on port_cvb [Pipeline] node Running on CVB portable in C:\Users\cvb\jenkins_data\workspace\laptop localdatabase [Pipeline] { [Pipeline] dir Running in c:\Users\cvb [Pipeline] { [Pipeline] stage [Pipeline] { (Create db) [Pipeline] isUnix [Pipeline] tool [Pipeline] bat c:\Users\cvb>ant -f git/ccesmarttools/CceSmartTools/files/devtools/buildnightly/build.xml -Dbasedir=. -Ddumptemp=c:\temp -Dlocaldatadir=c:/cce/localdata -DdbName=LISA database_proshut Buildfile: c:\Users\cvb\git\ccesmarttools\CceSmartTools\files\devtools\buildnightly\build.xml database_proshut: [echo] Shutdown c:/cce/localdata/LISA/LISA [exec] There is no server for database LISA. (1423) [exec] Result: 8 BUILD SUCCESSFUL Total time: 0 seconds [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // dir [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS
I do not know why _mproshut is failing, we stop / start databases from Jenkins using dbman with a sleep loop detecting .lk detection:
<macrodef name="dbman"> <attribute name="name" /> <attribute name="name.ext" default="" /> <attribute name="action" default="start" /> <attribute name="progress" /> <attribute name="failonerror" default="false" /> <sequential xmlns:if="ant:if"> <local name="dlc" /> <property name="dlc" value="c:\progress\oe@{progress}" if:set="os.windows" /> <property name="dlc" value="/opt/progress/oe@{progress}" if:set="os.linux" /> <set-bat-extension /> <exec executable="${dlc}/bin/dbman${bat}" failonerror="@{failonerror}"> <env key="DLC" value="${dlc}" /> <arg value="-@{action}" /> <arg value="-db" /> <arg value="db${exact.release.short}@{name}@{name.ext}${build.type}" /> </exec> </sequential> </macrodef>
<echo message="stopping databases" /> <parallel> <dbman progress="11.7" name="exactcs" action="stop" /> <dbman progress="11.7" name="edis" action="stop" /> </parallel> <waitfor maxwait="60" maxwaitunit="second"> <not> <and> <available file="${working.dir}/db/exactcs.lk" /> <available file="${working.dir}/db/edis.lk" /> </and> </not> </waitfor>