import Ġcom . bm us ch ko . gradle . docker . tasks . image . Docker Build Image Ċ import Ġcom . bm us ch ko . gradle . docker . tasks . image . Docker Push Image Ċ import Ġorg . gradle . configuration cache . extensions . capital ized Ċ Ċ plugins Ġ{ ĊĠ Ġid (" ot el . spot less - con ventions ") ĊĊĠ Ġid (" com . bm us ch ko . docker - remote - api ") Ċ } Ċ Ċ data Ġclass ĠImage Target ( val Ġversion : ĠList < String >, Ġval Ġvm : ĠList < String >, Ġval Ġj dk : ĠList < String >, Ġval Ġargs : ĠMap < String , ĠString > Ġ= Ġempty Map (), Ġval Ġwar : ĠString Ġ= Ġ" servlet - 3 . 0 ", Ġval Ġwindows : ĠBoolean Ġ= Ġtrue ) Ċ Ċ val Ġextra Tag Ġ= Ġfind Property (" extra Tag ") Ġ?: Ġjava . time . format . DateTime Formatter . of Pattern (" yyyy MM dd . HH mm SS "). format ( java . time . LocalDateTime . now ()) Ċ Ċ // ĠEach Ġline Ġunder Ġapp server Ġdescribes Ġone Ġmatrix Ġof Ġ( version Ġx Ġvm Ġx Ġj dk ), Ġdocker file Ġkey Ġoverrides Ċ // ĠDockerfile Ġname , Ġargs Ġkey Ġpasses Ġraw Ġarguments Ġto Ġdocker Ġbuild Ċ val Ġtargets Ġ= Ġmap Of ( ĊĠ Ġ" jetty " Ġto ĠlistOf ( ĊĠĠĠ ĠImage Target ( listOf (" 9 . 4 . 3 9 "), ĠlistOf (" hot spot "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 "), Ġmap Of (" source Version " Ġto Ġ" 9 . 4 . 3 9 . v 2 0 2 1 0 3 2 5 ")), ĊĠĠĠ ĠImage Target ( listOf (" 9 . 4 . 3 9 "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 6 "), Ġmap Of (" source Version " Ġto Ġ" 9 . 4 . 3 9 . v 2 0 2 1 0 3 2 5 ")), ĊĠĠĠ ĠImage Target ( listOf (" 1 0 . 0 . 7 "), ĠlistOf (" hot spot "), ĠlistOf (" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 "), Ġmap Of (" source Version " Ġto Ġ" 1 0 . 0 . 7 ")), ĊĠĠĠ ĠImage Target ( listOf (" 1 0 . 0 . 7 "), ĠlistOf (" openj 9 "), ĠlistOf (" 1 1 ", Ġ" 1 6 "), Ġmap Of (" source Version " Ġto Ġ" 1 0 . 0 . 7 ")), ĊĠĠĠ ĠImage Target ( listOf (" 1 1 . 0 . 7 "), ĠlistOf (" hot spot "), ĠlistOf (" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 "), Ġmap Of (" source Version " Ġto Ġ" 1 1 . 0 . 7 "), Ġ" servlet - 5 . 0 "), ĊĠĠĠ ĠImage Target ( listOf (" 1 1 . 0 . 7 "), ĠlistOf (" openj 9 "), ĠlistOf (" 1 1 ", Ġ" 1 6 "), Ġmap Of (" source Version " Ġto Ġ" 1 1 . 0 . 7 "), Ġ" servlet - 5 . 0 "), ĊĠ Ġ), ĊĠ Ġ" liberty " Ġto ĠlistOf ( ĊĠĠĠ Ġ// Ġrunning Ġconfigure . sh Ġis Ġfailing Ġwhile Ġbuilding Ġthe Ġimage Ġwith ĠJava Ġ 1 7 ĊĠĠĠ ĠImage Target ( listOf (" 2 0 . 0 . 0 . 1 2 "), ĠlistOf (" hot spot ", Ġ" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 6 "), Ġmap Of (" release " Ġto Ġ" 2 0 2 0 - 1 1 - 1 1 _ 0 7 3 6 ")), ĊĠĠĠ Ġ// Ġrunning Ġconfigure . sh Ġis Ġfailing Ġwhile Ġbuilding Ġthe Ġimage Ġwith ĠJava Ġ 1 8 ĊĠĠĠ ĠImage Target ( listOf (" 2 1 . 0 . 0 . 1 0 "), ĠlistOf (" hot spot "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 7 "), Ġmap Of (" release " Ġto Ġ" 2 0 2 1 - 0 9 - 2 0 _ 1 9 0 0 ")), ĊĠĠĠ ĠImage Target ( listOf (" 2 1 . 0 . 0 . 1 0 "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 6 "), Ġmap Of (" release " Ġto Ġ" 2 0 2 1 - 0 9 - 2 0 _ 1 9 0 0 ")), ĊĠ Ġ), ĊĠ Ġ" pay ara " Ġto ĠlistOf ( ĊĠĠĠ ĠImage Target ( listOf (" 5 . 2 0 2 0 . 6 "), ĠlistOf (" hot spot ", Ġ" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 ")), ĊĠĠĠ ĠImage Target ( listOf (" 5 . 2 0 2 1 . 8 "), ĠlistOf (" hot spot ", Ġ" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 ")), ĊĠ Ġ), ĊĠ Ġ" tomcat " Ġto ĠlistOf ( ĊĠĠĠ ĠImage Target ( listOf (" 7 . 0 . 1 0 9 "), ĠlistOf (" hot spot ", Ġ" openj 9 "), ĠlistOf (" 8 "), Ġmap Of (" major Version " Ġto Ġ" 7 ")), ĊĠĠĠ ĠImage Target ( listOf (" 8 . 5 . 7 2 "), ĠlistOf (" hot spot "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 "), Ġmap Of (" major Version " Ġto Ġ" 8 ")), ĊĠĠĠ ĠImage Target ( listOf (" 8 . 5 . 7 2 "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 "), Ġmap Of (" major Version " Ġto Ġ" 8 ")), ĊĠĠĠ ĠImage Target ( listOf (" 9 . 0 . 5 4 "), ĠlistOf (" hot spot "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 "), Ġmap Of (" major Version " Ġto Ġ" 9 ")), ĊĠĠĠ ĠImage Target ( listOf (" 9 . 0 . 5 4 "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 "), Ġmap Of (" major Version " Ġto Ġ" 9 ")), ĊĠĠĠ ĠImage Target ( listOf (" 1 0 . 0 . 1 2 "), ĠlistOf (" hot spot "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 "), Ġmap Of (" major Version " Ġto Ġ" 1 0 "), Ġ" servlet - 5 . 0 "), ĊĠĠĠ ĠImage Target ( listOf (" 1 0 . 0 . 1 2 "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 "), Ġmap Of (" major Version " Ġto Ġ" 1 0 "), Ġ" servlet - 5 . 0 "), ĊĠ Ġ), ĊĠ Ġ" to me e " Ġto ĠlistOf ( ĊĠĠĠ ĠImage Target ( listOf (" 7 . 0 . 9 "), ĠlistOf (" hot spot ", Ġ" openj 9 "), ĠlistOf (" 8 ")), ĊĠĠĠ ĠImage Target ( listOf (" 7 . 1 . 4 "), ĠlistOf (" hot spot ", Ġ" openj 9 "), ĠlistOf (" 8 ")), ĊĠĠĠ ĠImage Target ( listOf (" 8 . 0 . 8 "), ĠlistOf (" hot spot "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 ")), ĊĠĠĠ ĠImage Target ( listOf (" 8 . 0 . 8 "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 6 ")), ĊĠĠĠ ĠImage Target ( listOf (" 9 . 0 . 0 - M 7 "), ĠlistOf (" hot spot "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 "), Ġwar Ġ= Ġ" servlet - 5 . 0 "), ĊĠĠĠ ĠImage Target ( listOf (" 9 . 0 . 0 - M 7 "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 6 "), Ġwar Ġ= Ġ" servlet - 5 . 0 "), ĊĠ Ġ), ĊĠ Ġ" web sphere " Ġto ĠlistOf ( ĊĠĠĠ Ġ// ĠTODO Ġ( tr ask ) Ġthis Ġis Ġa Ġrecent Ġchange , Ġcheck Ġback Ġin Ġa Ġwhile Ġand Ġsee Ġif Ġit 's Ġbeen Ġfixed ĊĠĠĠ Ġ// Ġ 8 . 5 . 5 . 2 0 Ġonly Ġhas Ġlinux / ppc 6 4 le Ġimage ĊĠĠĠ ĠImage Target ( listOf (" 8 . 5 . 5 . 1 9 ", Ġ" 9 . 0 . 5 . 9 "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 "), Ġwindows Ġ= Ġfalse ), ĊĠ Ġ), ĊĠ Ġ" wild fly " Ġto ĠlistOf ( ĊĠĠĠ ĠImage Target ( listOf (" 1 3 . 0 . 0 . Final "), ĠlistOf (" hot spot ", Ġ" openj 9 "), ĠlistOf (" 8 ")), ĊĠĠĠ ĠImage Target ( listOf (" 1 7 . 0 . 1 . Final ", Ġ" 2 1 . 0 . 0 . Final ", Ġ" 2 5 . 0 . 1 . Final "), ĠlistOf (" hot spot "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 7 ", Ġ" 1 8 ")), ĊĠĠĠ ĠImage Target ( listOf (" 1 7 . 0 . 1 . Final ", Ġ" 2 1 . 0 . 0 . Final ", Ġ" 2 5 . 0 . 1 . Final "), ĠlistOf (" openj 9 "), ĠlistOf (" 8 ", Ġ" 1 1 ", Ġ" 1 6 ")), ĊĠ Ġ), Ċ ) Ċ Ċ val Ġmatrix Ġ= Ġmutable ListOf < String >() Ċ Ċ tasks Ġ{ ĊĠ Ġval Ġbuild Linux Test Images Ġby Ġregistering Ġ{ ĊĠĠĠ Ġgroup Ġ= Ġ" build " ĊĠĠĠ Ġdescription Ġ= Ġ" Build s Ġall ĠLinux ĠDocker Ġimages Ġfor Ġthe Ġtest Ġmatrix " ĊĠ Ġ} ĊĊĠ Ġval Ġbuild Windows Test Images Ġby Ġregistering Ġ{ ĊĠĠĠ Ġgroup Ġ= Ġ" build " ĊĠĠĠ Ġdescription Ġ= Ġ" Build s Ġall ĠWindows ĠDocker Ġimages Ġfor Ġthe Ġtest Ġmatrix " ĊĠ Ġ} ĊĊĠ Ġval Ġpush Matrix Ġby Ġregistering ( Docker Push Image :: class ) Ġ{ ĊĠĠĠ Ġmust Run After ( build Linux Test Images ) ĊĠĠĠ Ġmust Run After ( build Windows Test Images ) ĊĠĠĠ Ġgroup Ġ= Ġ" publishing " ĊĠĠĠ Ġdescription Ġ= Ġ" Push Ġall ĠDocker Ġimages Ġfor Ġthe Ġtest Ġmatrix " ĊĠĠĠ Ġimages . set ( matrix ) ĊĠ Ġ} ĊĊĠ Ġcreate Docker Tasks ( build Linux Test Images , Ġfalse ) ĊĠ Ġcreate Docker Tasks ( build Windows Test Images , Ġtrue ) ĊĊĠ Ġval Ġprint S moke Tests Configurations Ġby Ġregistering Ġ{ ĊĠĠĠ Ġfor Ġ(( server , Ġmatrices ) Ġin Ġtargets ) Ġ{ ĊĠĠĠĠĠ Ġval Ġs moke Test Server Ġ= Ġfind Property (" smoke Test Server ") ĊĠĠĠĠĠ Ġif Ġ( smoke Test Server Ġ!= Ġnull Ġ&& Ġserver Ġ!= Ġs moke Test Server ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcontinue ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġprintln ( server ) ĊĠĠĠĠĠ Ġval Ġserver Name Ġ= Ġserver . capital ized () ĊĠĠĠĠĠ Ġfor Ġ( entry Ġin Ġmatrices ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfor Ġ( version Ġin Ġentry . version ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġval Ġdot Index Ġ= Ġversion . indexOf ('.') ĊĠĠĠĠĠĠĠĠĠ Ġval Ġmajor Version Ġ= Ġif Ġ( dot Index Ġ!= Ġ- 1 ) Ġversion . substring ( 0 , Ġdot Index ) Ġelse Ġversion ĊĠĠĠĠĠĠĠĠĠ Ġfor Ġ( jdk Ġin Ġentry . jdk ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( vm Ġin Ġentry . vm ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprintln ("@ App Server ( version Ġ= Ġ\"$ version \", Ġj dk Ġ= Ġ\"$ jdk ${ if Ġ( vm Ġ== Ġ" hot spot ") Ġ"" Ġelse Ġ"- openj 9 "} \") ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprintln (" class Ġ${ server Name }${ major Version } J dk ${ jdk }${ if Ġ( vm Ġ== Ġ" hot spot ") Ġ"" Ġelse Ġ" Open j 9 "} Ġextends Ġ${ server Name } S moke Test Ġ{ ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprintln (" }") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ fun Ġconfigure Image ( parent Task : ĠTask Provider < out ĠTask >, Ġserver : ĠString , Ġdocker file : ĠString , Ġversion : ĠString , Ġvm : ĠString , Ġj dk : ĠString , Ġwar Project : ĠString , Ġargs : ĠMap < String , ĠString >, Ġis Windows : ĠBoolean ): ĠString Ġ{ ĊĠ Ġ// ĠUsing Ġseparate Ġbuild Ġdirectory Ġfor Ġdifferent Ġimage ĊĠ Ġval Ġdocker Working Dir Ġ= Ġfile ("$ build Dir / docker -$ server -$ version - jdk $ jdk -$ vm -$ war Project ") ĊĠ Ġval Ġdocker FileName Ġ= Ġ"$ dockerfile .${ if Ġ( is Windows ) Ġ" windows ." Ġelse Ġ"" } dockerfile " ĊĠ Ġval Ġplatform Suffix Ġ= Ġif Ġ( is Windows ) Ġ"- windows " Ġelse Ġ"" ĊĊĠ Ġval Ġprepare Task Ġ= Ġtasks . register < Copy >(" ${ server } Image Prepare -$ version - jdk $ jdk -$ vm $ platform Suffix ") Ġ{ ĊĠĠĠ Ġval Ġwar Task Ġ= Ġproject (": smoke - tests : images : servlet :$ war Project "). tasks . named < War >(" war ") ĊĠĠĠ Ġdepends On ( war Task ) ĊĠĠĠ Ġinto ( docker Working Dir ) ĊĠĠĠ Ġfrom (" src /$ docker FileName ") ĊĠĠĠ Ġfrom (" src / main / docker /$ server ") ĊĠĠĠ Ġfrom ( war Task . get (). archive File ) Ġ{ ĊĠĠĠĠĠ Ġrename Ġ{ Ġ" app . war " Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġval Ġvm Suffix Ġ= Ġif Ġ( vm Ġ== Ġ" hot spot ") Ġ"" Ġelse Ġ"- $ vm " ĊĠ Ġval Ġimage Ġ= Ġ" gh cr . io / open - telemetry / op entelemetry - java - instrumentation / smoke - test - servlet -$ server :$ version - jdk $ jdk $ vm Suffix $ platform Suffix -$ extra Tag " ĊĊĠ Ġval Ġj dk Image Ġ= Ġif Ġ( vm Ġ== Ġ" hot spot ") Ġ{ ĊĠĠĠ Ġif Ġ( jdk Ġ== Ġ" 1 8 ") Ġ{ ĊĠĠĠĠĠ Ġ" openjdk :$ jdk " ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠ Ġ" eclipse - tem ur in :$ jdk " ĊĠĠĠ Ġ} ĊĠ Ġ} Ġelse Ġif Ġ( vm Ġ== Ġ" openj 9 ") Ġ{ ĊĠĠĠ Ġ" ad opt openjdk :$ jdk - openj 9 " ĊĠ Ġ} Ġelse Ġ{ ĊĠĠĠ Ġthrow ĠGradle Exception (" Unexpected Ġvm : Ġ$ vm ") ĊĠ Ġ} ĊĊĠ Ġval Ġextra Args Ġ= Ġargs . to Mutable Map () ĊĠ Ġif Ġ( server Ġ== Ġ" wild fly ") Ġ{ ĊĠĠĠ Ġ// Ġwild fly Ġurl Ġwithout Ġ. zip Ġor Ġ. tar . gz Ġsuffix ĊĠĠĠ Ġval Ġmajor Version Ġ= Ġversion . substring ( 0 , Ġversion . indexOf (". ")). toInt () ĊĠĠĠ Ġval Ġserver BaseUrl Ġ= Ġif Ġ( major Version Ġ>= Ġ 2 5 ) Ġ{ ĊĠĠĠĠĠ Ġ" https :// github . com / wild fly / wild fly / releases / download /$ version / wild fly -$ version " ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠ Ġ" https :// download . jboss . org / wild fly /$ version / wild fly -$ version " ĊĠĠĠ Ġ} ĊĠĠĠ Ġextra Args [" base Download Url "] Ġ= Ġserver BaseUrl ĊĠ Ġ} Ġelse Ġif Ġ( server Ġ== Ġ" pay ara ") Ġ{ ĊĠĠĠ Ġif Ġ( version Ġ== Ġ" 5 . 2 0 2 0 . 6 ") Ġ{ ĊĠĠĠĠĠ Ġextra Args [" domain Name "] Ġ= Ġ" production " ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠ Ġextra Args [" domain Name "] Ġ= Ġ" domain 1 " ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġval Ġbuild Task Ġ= Ġtasks . register < Docker Build Image >(" ${ server } Image -$ version - jdk $ jdk $ vm Suffix $ platform Suffix ") Ġ{ ĊĠĠĠ Ġdepends On ( prepare Task ) ĊĠĠĠ Ġgroup Ġ= Ġ" build " ĊĠĠĠ Ġdescription Ġ= Ġ" Build s ĠDocker Ġimage Ġwith Ġ$ server Ġ$ version Ġon ĠJDK Ġ$ jdk -$ vm ${ if Ġ( is Windows ) Ġ" Ġon ĠWindows " Ġelse Ġ"" }" ĊĊĠĠĠ Ġinput Dir . set ( docker Working Dir ) ĊĠĠĠ Ġimages . add ( image ) ĊĠĠĠ Ġdocker File . set ( File ( docker Working Dir , Ġdocker FileName )) ĊĠĠĠ Ġbuild Args . set ( extra Args Ġ+ Ġmap Of (" jdk " Ġto Ġj dk , Ġ" vm " Ġto Ġvm , Ġ" version " Ġto Ġversion , Ġ" jdk Image " Ġto Ġj dk Image )) ĊĠĠĠ Ġdo Last Ġ{ ĊĠĠĠĠĠ Ġmatrix . add ( image ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġparent Task . configure Ġ{ ĊĠĠĠ Ġdepends On ( build Task ) ĊĠ Ġ} ĊĠ Ġreturn Ġimage Ċ } Ċ Ċ fun Ġcreate Docker Tasks ( parent Task : ĠTask Provider < out ĠTask >, Ġis Windows : ĠBoolean ) Ġ{ ĊĠ Ġval Ġresult Images Ġ= Ġmutable Set Of < String >() ĊĠ Ġfor Ġ(( server , Ġmatrices ) Ġin Ġtargets ) Ġ{ ĊĠĠĠ Ġval Ġs moke Test Server Ġ= Ġfind Property (" smoke Test Server ") ĊĠĠĠ Ġif Ġ( smoke Test Server Ġ!= Ġnull Ġ&& Ġserver Ġ!= Ġs moke Test Server ) Ġ{ ĊĠĠĠĠĠ Ġcontinue ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfor Ġ( entry Ġin Ġmatrices ) Ġ{ ĊĠĠĠĠĠ Ġval Ġdocker file Ġ= Ġserver ĊĠĠĠĠĠ Ġval Ġextra Args Ġ= Ġentry . args ĊĠĠĠĠĠ Ġval Ġwar Project Ġ= Ġentry . war ĊĠĠĠĠĠ Ġval Ġsupports Windows Ġ= Ġentry . windows ĊĊĠĠĠĠĠ Ġfor Ġ( version Ġin Ġentry . version ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfor Ġ( vm Ġin Ġentry . vm ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġfor Ġ( jdk Ġin Ġentry . jdk ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( supports Windows Ġ|| Ġ! is Windows ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresult Images . add ( configure Image ( parent Task , Ġserver , Ġdocker file , Ġversion , Ġvm , Ġj dk , Ġwar Project , Ġextra Args , Ġis Windows )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ