Continuous Integration With PowerBuilder

Transcription

Continuous Integration with PowerBuilderBruce Armstrong 2017 Appeon Limited and its subsidiaries. All rights reserved.

DISCLAIMERThis presentation was authored by volunteer(s) in the Appeon community. This is nota work for hire by Appeon. The views and opinions expressed in this presentation arethose of the author(s).Its contents are protected by US copyright law and may not be reproduced,distributed, transmitted, displayed, published or broadcast without the prior writtenpermission of Appeon. All rights belong to their respective owners.Any reference to third-party materials, including but not limited to Websites,content, services, or software, has not been reviewed or endorsed by Appeon. YOUR USEOF THIRD-PARTY MATERIALS SHALL BE AT YOUR OWN RISK.Appeon makes no warranty of any kind, either express or implied, including but notlimited to, the implied warranties of merchantability, fitness for a particularpurpose, or non-infringement.Appeon assumes no responsibility for errors oromissions.

Agenda About the Presenter Continuous Integration Prerequisites Installation Configuration Questionselevate.appeon.compage3

AuthorProfileAboutDevelopment lead with Integrated Data Services since 2004Independent consultant for 15 years doing PowerBuilderdevelopment for companies such as Rockwell, Hughes,Boeing, Western Asset Management, Investment TechnologyGroup and Johnson & Johnson.Using PowerBuilder since version 1.0.BCharter member of TeamSybase (formerly TeamPS),PowerBuilder MVP, SAP MentorContributing author to SYS-CON's PowerBuilder 4.0 Secretsof the Masters.Bruce ngEditor of SAMs' PowerBuilder 9: Advanced Client/ServerDevelopmentContributed numerous articles to the PowerBuilderDeveloper's Journal (PBDJ) and the ISUG Tech JournalEditor-in-chief of PBDJ from 2004 to 2013https://twitter.com/bruce armstrongServed as a technical editor for the ISUG Tech Journalhttps://plus.google.com/ BruceArmstrongHas done sessions on PowerBuilder at most TechWaves since2004 and at other user group meetings, including meetingsin Columbia, Germany, Belgium, Switzerland, England, Italyand France.elevate.appeon.com

CompanyProfileAboutIntegrated Data Services (IDS) is a leading provider of customsoftware products and Government financial managementservices.IDS was founded in 1997 in El Segundo, Califonia, and sincethat time has seen tremendous growth and success.Currently IDS has offices supporting customers nationwide.Integrated Data By providing customers with fast, efficient and reliableinformation systems and support services, IDS has become apreferred provider of financial and programmatic systems,services, and solutions across a wide variety of governmentagencies.

ContinuousIntegration The term "continuous integration" has a somewhatambiguous definition, but generally it means that: developers check in changes frequently (at least daily) and build are done on a regular basis (at least daily, but can beas frequently as after each check-in) Ideally, automated testing routines would be run on eachbuild to ensure that feedback on any functionality thatwas broken by the latest code changes are returned to thedevelopers as soon as possible.elevate.appeon.compage6

Prerequisites A windows machine (can be virtual) .Net Framework 4.6 IIS configured for ASP.Net Bonobo Git Server Jenkinselevate.appeon.compage7

Prerequisites (cont.) AutoCompile.exe (pbc170.exe and orcascript170.exe) License free stand alone compiler introduced in PowerBuilder2017 In the C:\Program Files (x86)\Appeon\PowerBuilder17.0\AutoCompiler directory from your PowerBuilder 2017 install For older versions of PowerBuilder: Use the command line argument feature of the PowerBuilder IDE(requires license) PowerGen in scripted modeelevate.appeon.compage8

Installation –Bonobo Git Server Copy the main folder from the unzipped download into thewwwroot folder for IIS Give the IIS User modify and write permissions to theApp Data folder of the app Convert the folder into an Application in IIS Manager Ensure that the app pool that the application uses isbased on .Net 4.0 rather than 2.0elevate.appeon.compage9

Installation Jenkins Jenkins uses a standard Windows installer. After the install is complete it will generate a randompassword for the administrator into a file within theinstall and provide you with a message as to where tolocate it. Jenkins will prompt you as to the plugins you wish toinstall. The primary one we're interested in is the Git plugin, which ispart of the default set of plugins that Jenkins will recommendfor use.elevate.appeon.compage10

Install - AutoCompile AutoCompile uses a standard Windows installer. It automatically add the directory it is installed ininto the PATHelevate.appeon.compage11

Confige Jenkins Change the Jenkins URLfrom localhost to theactual name of the serverthat it's running on.elevate.appeon.com

Configure Bonobo Login as theadministrator and createa repository The only thing you needto provide is a nameelevate.appeon.com

Configure Bonobo(cont.) Once you're back at thelist of repositories youcan use the option thereto copy the url for thenew repository to theclipboard.elevate.appeon.com

ConfigurePowerBuilder IDE Technically what you will be doing is configuring the PowerBuilder IDEto use a local repository and then configuring that local repository touse the new repository as a remote. The steps are: Use TortoiseGit to create a new 'bare' repository in the directory where thePowerBuilder source is located. Create a small text file (e.g., readme.md) in the directory. Use TortoiseGit to add and commit the file. In PowerBuilder, select PGS Git MSSCCI as the source control system for theworkspace. Make sure that "Suppress prompts to overwrite read-only files" ischecked. In PowerBuilder, add the application target(s) to source control. In PowerBuilder, add the remaining PowerBuilder objects to source control. In TortoiseGit settings for the directory, configure the Bonobo repository youcreated above as a remote repository for the local repository. In TortoiseGit, do a push from the local repository to the remote repository.elevate.appeon.compage15

Create JenkinsProject Create a new 'FreeStyleProject' in Jenkinselevate.appeon.com

Set SCM option onJenkins project Under the Source CodeManagement section of thenew project, select Gitand then provide therepository URL andcredentials to connect tothe Git server.elevate.appeon.com

Set Build Triggers onJenkins project Under the Build Triggers,specify any automaticbuild triggers you wantto use. For this example, I'mgoing to use "Poll SCM"and configure it to pollevery 15 minutes.elevate.appeon.com

Do a "Build Now" onthe Jenkins project Because we haven'tcreated any build stepsyet this won't buildanything yet. What it will do is createa workspaceunder C:\Program Files(x86)\Jenkins\workspaceand populate it with thecurrent source code fromthe Git repository.elevate.appeon.com

ORCAScript(createpbls.orca)start sessionset debug truescc set connect property logfile "createpbls.log"scc connect offlinescc set target "pfc ci\pfc ci.pbt" importonlyscc exclude liblist "pbdom\pbdom170.pbd"scc refresh target 3passscc closeend sessionelevate.appeon.com

ORCAScript(createpbls.orca) Because Jenkins pulled the source code for us already wedon't have to provide source control settings in theORCAScript file and can use scc connect offline. "ImportOnly" tells ORCAScript to build PBLs from source. "Refresh Target 3pass" tells ORCAScript to do a multi-passcompile. I'm using a sample app based on a recent version of the opensource PFC, which now includes a reference toPBDOM. Therefore I'm using "scc exclude liblist" to tellORCAScript to ignore that library during the source codeimport.elevate.appeon.compage21

ORCAScript batch file(run orcascript.cmd)orcascr170 createpbls.orcaelevate.appeon.com

PBC batch file(run pbc.cmd) The application projectobject in PowerBuildershows you the argumentsyou would need to pass tomatch the settings in theproject object.elevate.appeon.com

PBC batch file(run pbc.cmd)pbc170 /d "pfc ci\pfc ci.pbt" /o "pfc ci\pfc ci.exe" /w n /m n /x 32 /p "PowerBuilderEnterprise Series" /cp "Appeon" /de "Appeon Product File" /v "1.0.0.1" /fv "1.0.0.1"elevate.appeon.com

Copy files batch file(copyfiles.cmd)md c:\builds\%JOB NAME% %BUILD NUMBER%\FOR /d %%a in (*) do copy %%a\*.exe c:\builds\%JOB NAME% %BUILD NUMBER%\FOR /d %%a in (*) do copy %%a\*.pbd c:\builds\%JOB NAME% %BUILD NUMBER%\elevate.appeon.com

Copy files batch file(copyfiles.cmd) The batch files uses environment variables that Jenkinsmakes available when the batch file is run to create aseparate directory for each build.elevate.appeon.compage26

Create Build Steps Add a Build Step thatexecutes a batch command.elevate.appeon.com

Create Build Steps(cont.) Specify therun orcascript.cmd fileas the first batch fileto run.elevate.appeon.com

Create Build Steps(cont.) Add another build step after the orcascript step andpoint this one at the run pbc.cmd file. Finally, create one more build step after the run pbc oneand have it run the copyfiles.cmd file.elevate.appeon.compage29

Do a Build Now on theJenknis project We're going to test outour scripts to make surethat Jenkins can do thebuild. Once you've scheduled abuild you should see itbeing processed in thelist of buildselevate.appeon.com

Do a Build Now on theJenknis project(cont.) If you click on thebuild, you'll be taken toanother page with moredetails, including theability to view theconsole output from therunning build.elevate.appeon.com

Test the SCM poll Go back into PowerBuilder and check out an object. Make a trivial change and commit it. Using TortoiseGit, push that change to the Bonohorepository. Watch Jenkins and what you should see is that some timeafter Bonoho has been updated (depending on what you setthe SCM polling time to in Jenkins) Jenkins willautomatically launch a build of the project.elevate.appeon.compage32

Next Steps There is a Jenkins plugin for the Visual Studio commandline build utility (MSBUILD). I'm looking at creating asimilar plugin for the PowerBuilder build utility. Integration with JIRA. Rather than firing a build onevery checkin, the checkins would be tagged with a JIRAissue and the build would only fire when the JIRA issueis moved to the JIRA "Waiting for Deployment" status.elevate.appeon.compage33

Questions?elevate.appeon.com

Connect with theAppeon kedin.comDiscussions, tech articles and videos,free online training, and more.Build up your career profile, and stayin contact with other ppeonHQEncourage us with a “like”, see coolpics, and get notified of upcomingevents.Share important Appeon videos withothers; no account peon.comFollow Appeon and community members toget the latest tech news.Follow Appeon and community members toget the latest tech news.

License free stand alone compiler introduced in PowerBuilder 2017 In the C:\Program Files (x86)\Appeon\PowerBuilder 17.0\AutoCompiler directory from your PowerBuilder 2017 install For older versions of PowerBuilder: Use the command line argument feature of the PowerBuilder IDE (requires license) PowerGen in scripted mode Prerequisites (cont.) page elevate.appeon.com 9 Copy .