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

Build Type mergeBuild #152

Merged
merged 28 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c1e2a04
implementation of a new build type --outgoingChangesBuild
dennis-behm Nov 16, 2021
0df6c6a
fix syntax error
dennis-behm Nov 16, 2021
0bd1091
removing argument from build option
dennis-behm Nov 16, 2021
2e1a2a3
take the repoClient
dennis-behm Nov 16, 2021
e24aff6
preparing the buildSet by checking for script mappings
dennis-behm Nov 16, 2021
366f023
fix syntax error
dennis-behm Nov 16, 2021
4c6a3ff
update mainBuildBranch to the new branch name conventions
dennis-behm Nov 16, 2021
8417610
rename build option to be mergeBuild
dennis-behm Nov 16, 2021
e706a9c
rename build option to be mergeBuild
dennis-behm Nov 16, 2021
df9ce8d
improve outputs
dennis-behm Nov 16, 2021
510419b
skip rescanning source code
dennis-behm Nov 16, 2021
a981849
adding zunit test case for mergeBuild
dennis-behm Nov 16, 2021
7d51f2d
adding test case for mergeBuild
dennis-behm Nov 16, 2021
2f5dc27
modify mergeBuild scenario
dennis-behm Nov 16, 2021
c9e2294
documented build results
dennis-behm Nov 16, 2021
6af1788
test config for merge build test case
dennis-behm Nov 16, 2021
08e8964
supply changed application program sample
dennis-behm Nov 16, 2021
e6dc898
update replacement stratagy for changed file
dennis-behm Nov 17, 2021
9a27283
documentation update
dennis-behm Nov 17, 2021
c341e31
update replacement stratagy for changed file
dennis-behm Nov 17, 2021
40d1550
use epslis.bms for mergeBuild
dennis-behm Nov 17, 2021
40f1f84
fix syntax
dennis-behm Nov 17, 2021
f2651ed
fix syntax
dennis-behm Nov 17, 2021
856f7ba
skip print of output - this is available when a assert fails
dennis-behm Nov 17, 2021
3d1be01
Update TOC including correct link
dennis-behm Nov 18, 2021
233d2ae
Update documentation
dennis-behm Nov 18, 2021
3915430
Merge remote-tracking branch 'upstream/develop' into
dennis-behm Nov 18, 2021
94b3952
revert check for repoclient for fullbuild
dennis-behm Nov 18, 2021
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
213 changes: 169 additions & 44 deletions BUILD.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ zAppBuild supports a number of build scenarios:
* **Impact Build** - Build only programs impacted by source files that have changed since the last successful build.
* **Impact Build with baseline reference** - Build only programs impacted by source files that have changed by diff'ing to a previous configuration reference.
* **Topic Branch Build** - Detects when building a topic branch for the first time and will automatically clone the dependency data collections from the main build branch in order to avoid having to rescan the entire application.
* **Merge Build** - Build only changed programs which will be merged back into the mainBuildBranch by using a triple-dot git diff.
* **Scan Source** - Skip the actual building and only scan source files to store dependency data in collection (migration scenario).
* **Scan Source + Outputs** - Skip the actual building and only scan source files and existing load modules to dependency data in source and output collection (migration scenario with static linkage scenarios).

Expand Down
19 changes: 17 additions & 2 deletions build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ options:
cli.f(longOpt:'fullBuild', 'Flag indicating to build all programs for application')
cli.i(longOpt:'impactBuild', 'Flag indicating to build only programs impacted by changed files since last successful build.')
cli.b(longOpt:'baselineRef',args:1,'Comma seperated list of git references to overwrite the baselineHash hash in an impactBuild scenario.')
cli.m(longOpt:'mergeBuild', 'Flag indicating to build only changes which will be merged back to the mainBuildBranch.')
cli.r(longOpt:'reset', 'Deletes the dependency collections and build result group from the DBB repository')
cli.v(longOpt:'verbose', 'Flag to turn on script trace')

Expand Down Expand Up @@ -313,6 +314,7 @@ def populateBuildProperties(String[] args) {
if (opts.r) props.reset = 'true'
if (opts.v) props.verbose = 'true'
if (opts.b) props.baselineRef = opts.b
if (opts.m) props.mergeBuild = 'true'

// scan options
if (opts.s) props.scanOnly = 'true'
Expand Down Expand Up @@ -419,7 +421,11 @@ def createBuildList() {
// check if full build
if (props.fullBuild) {
println "** --fullBuild option selected. $action all programs for application ${props.application}"
buildSet = buildUtils.createFullBuildList()
if (repositoryClient) {
buildSet = buildUtils.createFullBuildList() }
else {
println "*! Full build requires a repository client connection to a DBB web application"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are changing the current behavior here. Any reason to force providing a repository connection in case of a full build?
I very often perform a full build without repository connection just to test that my whole application can compile.

Copy link
Member Author

@dennis-behm dennis-behm Nov 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting use case, I have not thought about this case so far. Always interesting to see the different usages.

Doesn't your use cause an issue when zAppBuild would like to update the collection? See line 517 in build.groovy

I felt it was a missing test for the fullBuild actually . Happy to revert this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this is behavior that @drbruce-git has intentionally implemented in its design.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reverted it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had always assumed that full build required a repository client so that it can store collections and build results for subsequent incremental builds.

}
// check if impact build
else if (props.impactBuild) {
Expand All @@ -430,6 +436,15 @@ def createBuildList() {
println "*! Impact build requires a repository client connection to a DBB web application"
}
}
else if (props.mergeBuild){
println "** --mergeBuild option selected. $action changed programs for application ${props.application} flowing back to ${props.mainBuildBranch}"
if (repositoryClient) {
assert (props.topicBranchBuild) : "*! Build type --mergeBuild can only be run on for topic branch builds."
(buildSet, deletedFiles) = impactUtils.createMergeBuildList(repositoryClient) }
else {
println "*! Merge build requires a repository client connection to a DBB web application"
}
}

// if build file present add additional files to build list (mandatory build list)
if (props.buildFile) {
Expand Down Expand Up @@ -490,7 +505,7 @@ def createBuildList() {
// scan and update source collection with build list files for non-impact builds
// since impact build list creation already scanned the incoming changed files
// we do not need to scan them again
if (!props.impactBuild && !props.userBuild) {
if (!props.impactBuild && !props.userBuild && !props.mergeBuild) {
println "** Scanning source code."
impactUtils.updateCollection(buildList, null, null, repositoryClient)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildOrder=BMS.groovy,Cobol.groovy,LinkEdit.groovy
#
# The main build branch. Used for cloning collections for topic branch builds instead
# of rescanning the entire application.
mainBuildBranch=master
mainBuildBranch=main

#
# The git repository URL of the application repository to establish links to the changed files
Expand Down
112 changes: 112 additions & 0 deletions test/applications/MortgageApplication/bms/epsmlis.bms
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
*********************************************************************** 00010000
EPSMLIS DFHMSD TYPE=&SYSPARM,MODE=INOUT,LANG=COBOL, X
STORAGE=AUTO,TIOAPFX=YES,DSATTS=(COLOR,HILIGHT), X 0009000
MAPATTS=(COLOR,HILIGHT) 0009100
EPSMLIS DFHMDI SIZE=(24,80),CTRL=(PRINT,FREEKB) 0011000
DFHMDF POS=(1,24),LENGTH=26,INITIAL='Better Mortgage Rates', *
ATTRB=(ASKIP,BRT)
DFHMDF POS=(24,58),LENGTH=0, *
ATTRB=ASKIP
* MENU MORTGAGE LIST MERGE BUILD TEST.

LITCOMP DFHMDF POS=(3,1),LENGTH=24,INITIAL='Company', *
ATTRB=(ASKIP,NORM)
LITPHN DFHMDF POS=(3,26),LENGTH=13,INITIAL='Phone Number', *
ATTRB=(PROT,NORM)
EPDIFF1 DFHMDF POS=(3,40),LENGTH=13,INITIAL='Interest Rate', *
ATTRB=(PROT,NORM)
EPDIFF2 DFHMDF POS=(3,54),LENGTH=16,INITIAL='Monthly Payment', *
ATTRB=(PROT,NORM)
LITPHN1 DFHMDF POS=(3,71),LENGTH=7,INITIAL='# Years', *
ATTRB=(PROT,NORM)
EPCMP1 DFHMDF POS=(4,1),LENGTH=24, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPPHN1 DFHMDF POS=(4,26),LENGTH=13, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPRATE1 DFHMDF POS=(4,45),LENGTH=5, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPLOAN1 DFHMDF POS=(4,56),LENGTH=12, *
ATTRB=(NUM,IC,NORM)
EPYEARS1 DFHMDF POS=(4,74),LENGTH=2, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPCMP2 DFHMDF POS=(5,1),LENGTH=24, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPPHN2 DFHMDF POS=(5,26),LENGTH=13, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPRATE2 DFHMDF POS=(5,45),LENGTH=5, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPLOAN2 DFHMDF POS=(5,56),LENGTH=12, *
ATTRB=(NUM,IC,NORM)
EPYEARS2 DFHMDF POS=(5,74),LENGTH=2, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPCMP3 DFHMDF POS=(6,1),LENGTH=24, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPPHN3 DFHMDF POS=(6,26),LENGTH=13, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPRATE3 DFHMDF POS=(6,45),LENGTH=5, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPLOAN3 DFHMDF POS=(6,56),LENGTH=12, *
ATTRB=(NUM,IC,NORM)
EPYEARS3 DFHMDF POS=(6,74),LENGTH=2, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPCMP4 DFHMDF POS=(7,1),LENGTH=24, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPPHN4 DFHMDF POS=(7,26),LENGTH=13, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPRATE4 DFHMDF POS=(7,45),LENGTH=5, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPLOAN4 DFHMDF POS=(7,56),LENGTH=12, *
ATTRB=(NUM,IC,NORM)
EPYEARS4 DFHMDF POS=(7,74),LENGTH=2, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPCMP5 DFHMDF POS=(8,1),LENGTH=24, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPPHN5 DFHMDF POS=(8,26),LENGTH=13, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPRATE5 DFHMDF POS=(8,45),LENGTH=5, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPLOAN5 DFHMDF POS=(8,56),LENGTH=12, *
ATTRB=(NUM,IC,NORM)
EPYEARS5 DFHMDF POS=(8,74),LENGTH=2, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPCMP6 DFHMDF POS=(9,1),LENGTH=24, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPPHN6 DFHMDF POS=(9,26),LENGTH=13, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPRATE6 DFHMDF POS=(9,45),LENGTH=5, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPLOAN6 DFHMDF POS=(9,56),LENGTH=12, *
ATTRB=(NUM,IC,NORM)
EPYEARS6 DFHMDF POS=(9,74),LENGTH=2, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPCMP7 DFHMDF POS=(10,1),LENGTH=24, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPPHN7 DFHMDF POS=(10,26),LENGTH=13, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPRATE7 DFHMDF POS=(10,45),LENGTH=5, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPLOAN7 DFHMDF POS=(10,56),LENGTH=12, *
ATTRB=(NUM,IC,NORM)
EPYEARS7 DFHMDF POS=(10,74),LENGTH=2, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPCMP8 DFHMDF POS=(11,1),LENGTH=24, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPPHN8 DFHMDF POS=(11,26),LENGTH=13, *
ATTRB=(PROT,NORM),HILIGHT=OFF,COLOR=GREEN
EPRATE8 DFHMDF POS=(11,45),LENGTH=5, *
ATTRB=(NUM,NORM),COLOR=GREEN
EPLOAN8 DFHMDF POS=(11,56),LENGTH=12, *
ATTRB=(NUM,IC,NORM)
DFHMDF POS=(11,69), *
ATTRB=ASKIP
EPYEARS8 DFHMDF POS=(11,74),LENGTH=2, *
ATTRB=(NUM,NORM),COLOR=GREEN
DFHMDF POS=(11,77),LENGTH=0, *
ATTRB=ASKIP
DFHMDF POS=(23,17),LENGTH=43, *
INITIAL='Press F3 to quit or Enter to calculate loan', *
ATTRB=(ASKIP,NORM),HILIGHT=OFF,COLOR=BLUE
MSGERR DFHMDF POS=(24,17),LENGTH=40,INITIAL='INVALID KEY PRESSED', X
ATTRB=(PROT,DRK)
EPSMLIS DFHMSD TYPE=FINAL
END
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# mainBuildBranch requires to be overriden for the mergeBuild test scenario
# mainBuildBranch=${props.branch}
61 changes: 61 additions & 0 deletions test/applications/MortgageApplication/cobol/epscsmrt.cbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
CBL NUMPROC(MIG),FLAG(I,W),RENT
ID DIVISION.
PROGRAM-ID. EPSCSMRT.
* THIS IS A CALLED PROGRAM EXAMPLE FOR DEMONSTRATION
*
* THIS PROGRAM IS INVOKED VIA A CICS LINK STATMENT
* AND DYNAMICALLY CALLS THE ACTUAL PROGRAM
*
* TEST CHANGE
*
* (C) 2017 IBM JIM HILDNER.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. FLEX-ES.
OBJECT-COMPUTER. FLEX-ES.
DATA DIVISION.
WORKING-STORAGE SECTION.
*
01 WS-CALLED-PROGRAM PIC X(8).

01 STATIC-CALLED-PROGRAMS.
03 STATIC-CALLED-PROGRAM-TABLE.
05 FILLER PIC X(8) VALUE 'EPSMPMT'.
05 FILLER PIC X(8) VALUE 'NOT VLD'.
05 FILLER PIC X(8) VALUE ' '.
03 CALLED-PROGRAM-TABLE
REDEFINES STATIC-CALLED-PROGRAM-TABLE
OCCURS 3 TIMES.
05 CALLED-PROGRAM-NAME PIC X(8).

COPY EPSPDATA.

LINKAGE SECTION.
*
01 DFHCOMMAREA.
COPY EPSMTCOM.

PROCEDURE DIVISION USING DFHCOMMAREA.
*
A000-MAINLINE.
MOVE EPSPCOM-PRINCIPLE-DATA TO EPSPDATA-PRINCIPLE-DATA.
MOVE EPSPCOM-NUMBER-OF-YEARS TO EPSPDATA-NUMBER-OF-YEARS.
MOVE 'Y' TO EPSPDATA-YEAR-MONTH-IND.
MOVE EPSPCOM-QUOTED-INTEREST-RATE
TO
EPSPDATA-QUOTED-INTEREST-RATE.
MOVE CALLED-PROGRAM-NAME(1) TO WS-CALLED-PROGRAM.
MOVE SPACES TO EPSPDATA-RETURN-ERROR.
* CALL 'EPSMPMT' USING EPSPDATA.
CALL WS-CALLED-PROGRAM USING EPSPDATA.
MOVE EPSPDATA-RETURN-MONTH-PAYMENT
TO
EPSPCOM-RETURN-MONTH-PAYMENT.
MOVE EPSPDATA-RETURN-ERROR TO EPSPCOM-ERRMSG.
IF EPSPDATA-RETURN-ERROR = SPACES
MOVE ZERO TO EPSPCOM-PROGRAM-RETCODE
ELSE
MOVE 8 TO EPSPCOM-PROGRAM-RETCODE
END-IF.
GOBACK
.
19 changes: 18 additions & 1 deletion test/applications/MortgageApplication/test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
########################
#
# list of test scripts to run for this application
test_testOrder=resetBuild.groovy,fullBuild.groovy,impactBuild.groovy,impactBuild_renaming.groovy,resetBuild.groovy
# the order of the list matters
test_testOrder=resetBuild.groovy,mergeBuild.groovy,fullBuild.groovy,impactBuild.groovy,impactBuild_renaming.groovy,resetBuild.groovy


#############################
Expand Down Expand Up @@ -45,3 +46,19 @@ impactBuild_rename_expectedFilesBuilt = epscsmr2.cbl :: cobol/epscsmrt.cbl
# list of source datasets (LLQ) that should be deleted during impactBuild.groovy cleanUp
impactBuild_rename_datasetsToCleanUp = BMS,COBOL,LINK,COPY,BMS.COPY,DBRM,LOAD,MFS,OBJ,TFORMAT


###############################
# mergeBuild.groovy properties
###############################
#
# build properties to overwrite a set of options to enable test scenario in test framework
mergeBuild_buildPropSetting = build-conf/mergeBuildOpts.properties
# list of changed source files to test impact builds
mergeBuild_changedFiles = bms/epsmlis.bms,cobol/epscsmrt.cbl
#
# list of source datasets (LLQ) that should be deleted during impactBuild.groovy cleanUp
mergeBuild_datasetsToCleanUp = BMS,COBOL,LINK
#
# Use file properties to associate expected files built to changed files
mergeBuild_expectedFilesBuilt = epsmlis.bms :: bms/epsmlis.bms
mergeBuild_expectedFilesBuilt = epsmlis.bms,epscsmrt.cbl :: cobol/epscsmrt.cbl
2 changes: 0 additions & 2 deletions test/testScripts/impactBuild_renaming.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ def validateImpactBuild(String renameFile, PropertyMappings filesBuiltMappings,
println "** Validating impact build results"
def expectedFilesBuiltList = filesBuiltMappings.getValue(renameFile).split(',')

println("*** Outputstream: $outputStream")

try{
// Validate clean build
assert outputStream.contains("Build State : CLEAN") : "*! IMPACT BUILD FAILED FOR $renameFile\nOUTPUT STREAM:\n$outputStream\n"
Expand Down
Loading