Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First extension of standard scripts #1

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e0a9e20
first update to build and deploy scripts without Artifactory integration
Apr 5, 2017
cbf4480
consistent naming
Apr 5, 2017
3db11bd
simplification and unification of scripts
Apr 6, 2017
b2b631d
cleanup; moved ENV.groovy to webmethods-sample-project-layout, since …
Apr 6, 2017
a629441
cleanup
Apr 7, 2017
2e8efa0
cleanup
Apr 7, 2017
69f7cd5
integration of artifactory
Apr 12, 2017
a704122
artifactory integration
Apr 12, 2017
8ef1e9c
added default parameters to ENV.groovy
Apr 12, 2017
90ae188
removed log file from repo
Apr 19, 2017
6920ed0
enabling varsub for is configuration assets
Apr 19, 2017
fa03005
added example varsub files
Apr 19, 2017
05ec17a
enhanced loggign
Apr 19, 2017
3489304
removed varsub templates and moved to webmethods-sample-project-layou…
Apr 19, 2017
62ba88b
injecting build number and release version into ABE by setting approp…
Apr 19, 2017
3618b8b
moved configuration parameters to the project specfific configuraatio…
Apr 19, 2017
02af61b
added groovy utility to extract varsub templates from Deployer varsub…
Apr 20, 2017
538211a
extended documentation
Apr 20, 2017
ca55d7e
first version using splitDelpoymentSets
Apr 25, 2017
2cedddc
added capability to split deployments into multiple deplyoment sets
Apr 26, 2017
d193af1
added capability to split deployments into multiple deplyoment sets
Apr 26, 2017
e83b93f
WmTestSuite jar cleanup; replaced eternal jars where possible with in…
May 4, 2017
3e61a22
moved WmTestSuite jars to separate folder. Removed unnecessary groovy…
May 4, 2017
0d13fd1
added sources and build script for custom logger
May 4, 2017
e867a30
Additional targets for Artifactory Upload Spec invocation
May 4, 2017
c687acb
removed all jars from project except WmTestSuite jars; added ant buil…
May 15, 2017
801220a
removed all jars from project except WmTestSuite jars; added ant buil…
May 15, 2017
97ec7d2
removed all jars from project except WmTestSuite jars; added ant buil…
May 15, 2017
1c51d16
cleanup. removed unused property configDir for assets
May 17, 2017
d0cf4a5
moved config property config.deployer.doVarSub to webmethods-sample-p…
May 17, 2017
b34c13e
added switch for ivy dependency management
May 17, 2017
ae9741c
added httpunit and xmlunit jars to Ivy dependency. moved local SAG ja…
May 18, 2017
732b0af
simplified ivy setup; added option to download ivy jars to local folder
May 18, 2017
8baa8a7
cleanup of ivy build
May 18, 2017
eb935fd
cleanup of ivy build
May 18, 2017
cd9d5cc
added default properties and additional checks for mandatory properti…
May 24, 2017
c37aeca
added quiesce mode for jms and messaging triggers. triggers are suspe…
May 24, 2017
8018a73
removed build.number file, which is created by ANT if it doesn't exist
May 24, 2017
faf73d0
adjusted ivy to load less transient dependent jars; adjusted ProjectA…
May 25, 2017
e55a0b4
adjusted ivy to load less transient dependent jars; adjusted ProjectA…
May 25, 2017
30870bd
bug fixing groovy script invocation with parameters: setting path var…
May 25, 2017
6beaffe
added static code analysis support with ISCCR
May 31, 2017
035334e
added junit jar to ivy dependencies
May 31, 2017
5188825
added junit jar to ivy dependencies
May 31, 2017
fab9fdb
added separate target for static code analysis
May 31, 2017
169c472
streamlined isccr test results
May 31, 2017
5ebee3b
update to readme
May 31, 2017
2de7a50
Merge branch 'master' of https://github.com/HenningWaack/sagdevops-ci…
May 31, 2017
39d5aa8
enhanced error handling for ISCCR
Jun 1, 2017
0e39e1f
bugfixing varsub creation and usage
Jun 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="lib" path="lib/wmtestsuite/serviceInterceptor.jar"/>
<classpathentry kind="lib" path="lib/wmtestsuite/serviceMockClient.jar"/>
<classpathentry kind="var" path="WEBMETHODS_COMMON_LIB_EXT/log4j.jar"/>
<classpathentry kind="var" path="IS_MAIL"/>
<classpathentry kind="var" path="IS_SERVER"/>
<classpathentry kind="var" path="WEBMETHODS_COMMON_LIB/wm-isclient.jar"/>
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=henning_sagdevops-ci-assets&amp;ivyXmlPath=resources%2Fivy%2Fivy-remote.xml&amp;confs=*&amp;ivySettingsPath=resources%2Fivy%2Fivysettings-remote.xml&amp;loadSettingsOnDemand=false&amp;ivyUserDir=c%3A%5CUsers%5CAdministrator%5C.ivy%5C&amp;propertyFiles=resources%2Fivy%2Fivy.properties"/>
<classpathentry kind="output" path="bin"/>
</classpath>
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/tmp
/logs/
/bin/
/lib/**/ivy*.jar
.settings/org.eclipse.jdt.groovy.core.prefs
ISCCR.log
build.number
25 changes: 25 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>henning_sagdevops-ci-assets</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.apache.ivyde.eclipse.ivynature</nature>
</natures>
</projectDescription>
7 changes: 7 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
2 changes: 2 additions & 0 deletions .settings/org.eclipse.jdt.groovy.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
groovy.compiler.level=-1
4 changes: 4 additions & 0 deletions .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.8"/>
</faceted-project>
Empty file modified LICENSE
100644 → 100755
Empty file.
55 changes: 30 additions & 25 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,66 @@ Software AG DevOps library to support assets CI (continuous integration) with we


## Description
sagdevops-ci-assets is a library that easily enables CI for your webMethods projects. You can setup your infrastructure in minutes and then deploy flowlessly on your test service while also checking the quality
by running all tests uploaded your version control.
sagdevops-ci-assets is a library that easily enables CI for your webMethods projects. You can setup your infrastructure in minutes and then deploy flowlessly on your test service while also checking the quality by running all tests uploaded your version control.

Note: the scripts in this repository are not project specific, they are generic and can be used by multiple projects (in parallel). For this tutorial, the project specific scripts and source code assets like IS packages are stored in a separate repository ([https://github.com/SoftwareAG/webmethods-sample-project-layout](https://github.com/SoftwareAG/webmethods-sample-project-layout)) and are "referenced" by the pipeline setup described below.


## Set-up

### webMethods Installation
Prepare your webMethods installation - your build server can contain only a plain IntegrationServer with Deployer. Keep the server plain - there is no need for designer or database connection.

Your test server can be more complex as CI will execute unit and integration tests against it. The build and the test server must reach each other over http so that the deployment and the testing can be performed.

### CI Library
Download the library on your build server by
Download the sagdevops-ci-assets respository on your build server by

```
git clone https://github.com/SoftwareAG/sagdevops-ci-assets.git
```

Edit the _System.properties_ to correspond to your inftrastucture - deployerHost is the machine where your Deployer is running(normally the build server) where targetHost is your test server - where the packages will be deployed and tested.
Edit the _System.properties_ to correspond to your infrastructure:

*Notice* change the path the Deployer if you're not using the _default_ Integration Server instance.
* __config.deployer.*__: Configuration parameters which specify your Deployer installation and Deployer server
* __config.tmpdir__: Points to a tempory directory where assets are stored for the deployment process. **Note**: take care to clean this directory up regularly!
* __config.build.buildStorageDir__: Where to store the file based repositories created by the Asset Build Environment
* __config.deployer.projectNamePrefix__: Defines the Deployer Project Name prefix. Can either be static, e.g. "BDA", or it can be dynamic, e.g. "Jenkins_${env.BUILD_NUMBE}"
* __config.libs.resolve__:
* Set to "**remote**" if dependent jars should be downloaded from remote maven repositories with Apache Ivy. See "[resources/ivy/ivy-remote.xml](resources/ivy/ivy-remote.xml)" for list of jars. See "[resources/ivy/ivysettings-remote.xml](resources/ivy/ivysettings-remote.xml)" for list of repositories from which jars are downloaded. **Note**: Software AG jars are referenced with a filesystem resolver pointing to the respective local installation.
* Set to "**local**" if no internet connection is available and place necessary jars (see "[resources/ivy/ivy-remote.xml](resources/ivy/ivy-remote.xml)" for list) into folder "**lib/ext**".


### Build/CI Environment
* On your build server set-up the default java on PATH to be the JDK that comes with your webMethods installation ${SAG_HOME}/jvm/jvm/bin/java
### Build/CI Environment

* On your build server install Jenkins CI Server and run it with the same user that run your webMethods processes. The CI can work also with other CI server, but for the reference implementation we've chosen Jenkins.
Setup your build server in the following way:

* Add the default java to your PATH variable. Use the JDK that comes with your webMethods installation ${SAG_HOME}/jvm/jvm/bin/java
* Install Jenkins CI Server v2 ([https://jenkins.io/](https://jenkins.io/)) and run it with the same user that run your webMethods processes. This webMethods CI framework can work also with other CI servers, but for the reference implementation we've chosen Jenkins 2 with native Pipeline support.

* In Jenkins->Manage Jenkins->Configure System->EnvironmentVariables define the following environment variables:
1. SAG_CI_HOME = path_to_th_sagdevops-ci-assets on the local file system.
2. SAG_HOME = path_to_your_local_webmethods_installation

Use slash "/" as path separator. Example: "C:/SoftwareAG", instead of "C:\SoftwareAG".
Setup your Jenkins server in the following way:

* In "Jenkins > Manage Jenkins > Configure System > EnvironmentVariables" define the following environment variables:
1. __SAG_CI_HOME__: path_to_the_sagdevops-ci-assets on the local file system. I.e., if you have cloned the sagdevops-ci-assets respository to the directory "/home/user/sag/sagdevops-ci-assets", the set "SAG_CI_HOME=/home/user/sag/sagdevops-ci-assets" in Jenkins.
2. __SAG_HOME__: path_to_your_local_webmethods_installation

Note: Use slash "/" as path separator. Example: "C:/SoftwareAG", instead of "C:\SoftwareAG".

### Jenkins Pipeline Job
In Jenkins, create a new item from type pipeline. Give it a **unique name** as we use the job name as identifier further down the process. Scroll down the page to the pipeline definition
and choose _Pipeline definition from SCM_. Choose git as system and give the url of the webmethods-sample-project-layout - _https://github.com/SoftwareAG/webmethods-sample-project-layout.git_
In Jenkins, create a new item from type pipeline. Give it a **unique name** as we use the job name as identifier further down the process. Scroll down the page to the pipeline definition and choose _Pipeline definition from SCM_. Choose git as system and give the url of the webmethods-sample-project-layout [https://github.com/SoftwareAG/webmethods-sample-project-layout.git](https://github.com/SoftwareAG/webmethods-sample-project-layout.git).

This sample project contains two pre-created pipeline definitions - Jenkinsfile.win and Jenkinsfile.unix that run on the respective operating systems. Type in the correct file in respect of you
build server OS.
This sample project contains two pre-created pipeline definitions - Jenkinsfile.win and Jenkinsfile.unix that run on the respective operating systems. Type in the correct file in respect of you build server OS.

Those pipeline definition are orchestrating all steps around the build, deploy and the test on your server. If the all environment variables are set correctly you should not change anything here.


## How it works
After your pipeline job is set-up, trigger it. It will download the pipeline description automatically, then checkout the sources, build the core, deploy the code and run tests.
Whenever a developer checks in new IS packages and Tests those will be automatically deployed and all new tests will be executed. For this to work, the structure defined here _https://github.com/SoftwareAG/webmethods-sample-project-layout.git_ has followed.

## Notice
The wM Test Suite tests will have to be places in a directory a *setup* directory inside the test project, so that it can be picked up by the test executor.



After your pipeline job is set-up, trigger it. It will download the pipeline description automatically for the webmethods-sample-project-layout repository, then checkout the sources, build the code (using Asset Build Environment), create a project in Deployer referencing the build (using Project Automator), deploy the code using Deployer and finally run tests using the WmTestSuite.

Whenever a developer checks in new IS packages or WmTestSuite tests, those will be automatically deployed and all new tests will be executed. For this to work, the structure defined in the project [https://github.com/SoftwareAG/webmethods-sample-project-layout.git](https://github.com/SoftwareAG/webmethods-sample-project-layout.git) has to be adhered.

## Test Execution
The wM Test Suite tests will have to be places in a directory a *setup* directory inside the test project, so that it can be picked up by the test executor. Please see [https://github.com/SoftwareAG/webmethods-sample-project-layout](https://github.com/SoftwareAG/webmethods-sample-project-layout) for details.



Expand Down
39 changes: 28 additions & 11 deletions System.properties
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
#System properties for the deployer solution

# Use slash "/" as path separator. Example: Use "C:/SoftwareAG", instead of "C:\SoftwareAG".
deployerInstallationPath=${SAGHome}/IntegrationServer/instances/default/packages/WmDeployer/bin/
config.deployer.deployerInstallationPath=${SAGHome}/IntegrationServer/instances/default/packages/WmDeployer/bin/
#config.deployer.deployerInstallationPath=${SAGHome}/IntegrationServer/instances/deployer/packages/WmDeployer/bin/

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

#Target CI Test Server Settings
testISHost=localhost
testISPort=5555
testISUsername=Administrator
testISPassword=manage
config.deployer.deployerHost=localhost
config.deployer.deployerPort=5599
config.deployer.deployerUsername=Administrator
config.deployer.deployerPassword=manage

# where to store temporary files
config.tmpdir=tmp

# where to store the file based repositories created by the ABE
config.build.buildStorageDir=${config.tmpdir}/fbr

#config.deployer.projectNamePrefix=Jenkins_${env.BUILD_NUMBER}
config.deployer.projectNamePrefix=BDA

config.build.abeHome=${SAGHome}/common/AssetBuildEnvironment

# where to get external jars from, either "remote" (needs internet connection to access remote maven repos), or "local" (assumes libs are manually downloaded and placed in "lib/ext" folder)
config.libs.resolve=remote

# IS Continuous Code Review
config.isccr.enable=false
# Install dir of ISCCR
config.isscr.home=c:/Tools/ISCCRv4

# configure a reportDir, should be the same as configured in the Jenkins pipeline
config.test.reportDir=${env.WORKSPACE}/report
59 changes: 43 additions & 16 deletions build.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,29 +1,56 @@
<?xml version="1.0"?>
<project name="Build and Deploy Solution" default="buildDeployTest" basedir="." >
<property file="${project.properties}"/>
<property file="System.properties"/>

<import file="buildInitProject.xml"/>
<import file="buildCallABE.xml"/>
<import file="buildDeployer.xml"/>
<import file="buildTest.xml"/>

<project name="BDA" default="buildDeployTest" basedir=".">
<property file="${project.properties}" />
<property file="System.properties" />

<import file="buildInitProject.xml" />
<import file="buildCallABE.xml" />
<import file="buildDeployer.xml" />
<import file="buildTest.xml" />
<import file="buildISCCR.xml" />
<import file="buildRepo.xml" />

<taskdef classpath="lib/ant-contrib.jar" resource="net/sf/antcontrib/antlib.xml"/>

<target name="build" depends="initProject,buildWM">
<target name="build" depends="bda.init.Project, bda.abe.buildWM, bda.repo.processBuildOutput">
<description>Build project.</description>
</target>
<target name="deploy" depends="initProject,deployWM">

<target name="deploy" depends="bda.init.Project, bda.repo.prepareFbrForDeployment, bda.deployer.startDeployer">
<description>Deploy project.</description>
</target>

<target name="test" depends="initProject,startTest">
<target name="extractVarSubTemplates" depends="bda.init.Project">
<description>Extract varsub.</description>
<ant antfile="buildDeployer_Varsub.xml" target="bda.deployer.varsub.generateVarSubTemplates" inheritrefs="true" />
</target>

<target name="prepareArtifactoryDownloadSpec" depends="bda.init.Project, bda.repo.prepareArtifactoryDownloadSpec">
<description>Preparing donwload spec.</description>
</target>

<target name="prepareArtifactoryUploadSpec" depends="bda.init.Project, bda.repo.processBuildOutputForArtifactory">
<description>Preparing donwload spec.</description>
</target>

<target name="test" depends="bda.init.Project, bda.test.startTest">
<description>Run tests.</description>
</target>
</target>

<target name="staticCodeAnalysis" depends="bda.init.Project, bda.test.isccr.reviewPackages">
<description>Run static code analysis.</description>
</target>

<target name="buildDeployTest" depends="build, deploy, test">
<description>Build and deploy the project.</description>
</target>

<target name="_TEST_startTest" depends="bda.init.Project, bda.test.isccr.reviewPackages, test">
<description>_TEST</description>
</target>

<!--
-->
<target name="_getJarsToLocal" depends="bda.init.Project, bda.dependencies.util.downloadJarsToLibFolder">
<description>Get jars from remote repo with ivy and then retrieve into local lib/ext folder</description>
</target>

</project>
53 changes: 28 additions & 25 deletions buildCallABE.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,46 +1,49 @@
<?xml version="1.0"?>
<project name="Build" default="buildWM" basedir=".">

<property name="abeHome" value="${SAGHome}/common/AssetBuildEnvironment"/>

<property name="abeBuildfileDir" value="master_build"/>
<project name="Build" default="bda.abe.buildWM" basedir=".">

<property name="abeBuildfileFile" value="build.xml"/>
<import file="build_QuiesceDeployment.xml" />

<property name="abeBuildPropertiesReference" value="master_build_Reference/build.properties"/>
<!--
<property name="abeHome" value="${SAGHome}/common/AssetBuildEnvironment" />
<property name="abeHome" value="${config.build.abeHome}" />
-->
<property name="abeBuildfileDir" value="master_build" />
<property name="abeBuildfileFile" value="build.xml" />
<property name="abeBuildPropertiesReference" value="master_build_Reference/build.properties" />



<target name="buildWM" description="build project" depends="cleanupBuild, prepareABEproperties">
<echo>invoke ABE Build</echo>
<ant antfile="${abeBuildfileFile}" dir="${abeHome}/${abeBuildfileDir}" target="build"/>
<target name="bda.abe.buildWM" description="build project" depends="bda.abe.cleanupBuild, bda.abe.prepareABEproperties, bda.abe.prepareSources">
<echo>invoke ABE Build</echo>
<ant antfile="${abeBuildfileFile}" dir="${config.build.abeHome}/${abeBuildfileDir}" target="build" />
</target>
<target name="cleanupBuild">

<target name="bda.abe.cleanupBuild">
<if>
<available file="${buildOutputDir}" type="dir"/>
<available file="${fbrRepoDir}" type="dir" />
<then>
<delete includeemptydirs="true">
<fileset dir="${buildOutputDir}" includes="**/*"/>
</delete>
<fileset dir="${fbrRepoDir}" includes="**/*" />
</delete>
</then>
</if>
</target>
<target name="prepareABEproperties">

<target name="bda.abe.prepareABEproperties">
<if>
<not>
<available file="${abeHome}/${abeBuildfileDir}/build.properties.original" type="file"/>
<available file="${config.build.abeHome}/${abeBuildfileDir}/build.properties.original" type="file" />
</not>
<then>
<!-- back up the original if not back up is being made -->
<move file="${abeHome}/${abeBuildfileDir}/build.properties" tofile="${abeHome}/${abeBuildfileDir}/build.properties.original"/>
<move file="${config.build.abeHome}/${abeBuildfileDir}/build.properties" tofile="${config.build.abeHome}/${abeBuildfileDir}/build.properties.original" />
</then>
</if>

<!-- move build.properties from SVN to the target ABE folder -->
<copy file="${abeBuildPropertiesReference}" tofile="${abeHome}/${abeBuildfileDir}/build.properties" overwrite="true"/>
<copy file="${abeBuildPropertiesReference}" tofile="${config.build.abeHome}/${abeBuildfileDir}/build.properties" overwrite="true" />
</target>



<target name="bda.abe.prepareSources" depends="bda.quiesce.deployment.start">

</target>

</project>
Loading