Skip to content

Latest commit

 

History

History
1136 lines (909 loc) · 48.6 KB

README.asciidoc

File metadata and controls

1136 lines (909 loc) · 48.6 KB

Intershop Commerce Management - Docker Plugins

Summary

This plugin collection contains plugins for building container images and starting container of and for Intershop Commerce Management. It is necessary that the 'ICM Gradle plugin' was applied to the project. Version 6.0.0 of this plugin is the minimum version.

This plugin is based on 'Gradle Docker plugin' and the 'Docker-Java Framework'.

Intershop Commerce Management Docker Plugin

This plugin configures the basics of an Intershop Commerce Management product project.

Plugin Configuration

The plugins must be applied to the root project.

Groovy
build.gradle
plugins {
    id 'com.intershop.gradle.icm.base' version '6.0.0'
    id 'com.intershop.gradle.icm.docker' version '5.0.0'
}

intershop {
    // see https://github.com/IntershopCommunicationsAG/icm-gradle-plugin
    projectInfo {}
    projectConfig {}
}

intershop_docker {
    images {
        webadapter = 'intershophub/icm-webadapter:2.4.9'
        webadapteragent = 'intershophub/icm-webadapteragent:4.0.0'

        mssql = 'intershophub/mssql-intershop:2019-latest'

        mailsrv = 'mailhog/mailhog:latest'
    }

    imageBuild {
        license = 'Intershop Communications AG'
        maintainer = 'Intershop Communications AG "www.intershop.de"'
        baseDescription = 'Intershop Commerce Management'

        baseImageName = '${dockerRegHostName}/intershop/icm'
        images {
            mainImage {
                dockerfile = file('docker/main/Dockerfile')
                addFiles(tasks.createMainPkg.outputs.files)
                dockerBuildDir = 'main'
                description = 'AppServer Container'
                enabled = true
            }
            testImage {
                dockerfile = file('docker/test/Dockerfile')
                addFiles(tasks.createTestPkg.outputs.files)
                dockerBuildDir = 'test'
                description = 'AppServer Test Container'
                enabled = true
            }
        }
    }
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.gradle.icm.base") version "6.0.0"
    id("com.intershop.gradle.icm.docker") version "5.0.0"
}

intershop {
    // see https://github.com/IntershopCommunicationsAG/icm-gradle-plugin
    projectInfo {}
    projectConfig {}
}

intershop_docker {
    images {
        webadapter.set("'intershophub/icm-webadapter:2.4.9")
        webadapteragent.set("intershophub/icm-webadapteragent:4.0.0")

        mssql.set("intershophub/mssql-intershop:2019-latest")

        mailsrv.set("mailhog/mailhog:latest")
    }


imageBuild {
        license.set("Intershop Communications AG")
        maintainer.set("Intershop Communications AG 'www.intershop.de'")
        baseDescription.set("Intershop Commerce Management")

        baseImageName.set("${dockerRegHostName}/intershop/icm")
        images {
            mainImage {
                dockerfile.set(file("docker/main/Dockerfile"))
                addFiles(tasks.createMainPkg.get().outputs.files)
                dockerBuildDir.set("main")
                description.set("AppServer Container")
                enabled.set(true)
            }
            testImage {
                dockerfile.set(file("docker/test/Dockerfile"))
                addFiles(tasks.createTestPkg.get().outputs.files)
                dockerBuildDir.set("test")
                description.set("AppServer Test Container")
                enabled.set(true)
            }
        }
    }

    developmentConfig {
        cartridgeList.set(setOf("ft_starter_store"))
    }
}

Extension 'intershop_docker'

Properties

Property Type Default value Description

containerProjectPrefix

Property<String>

<project name>

Underscores will be replaced with dashes. This property is used for container names, volumes and network in Docker.

developmentConfig

DevelopmentConfiguration

This extension handles the access to a local property file, to adapt the configuration to a local environment. See Configuration properties file.

images

Images

This extension contains the configuration of all supported and necessary images.

imageBuild

ProjectConfiguration

This part contains the configuration for all image artifacts of a build project.

Methods

Method Parameter Description

developmentConfig

Closure<DevelopmentConfiguration>

Configures the development configuration of this project in a Groovy context.

developmentConfig

Action<in DevelopmentConfiguration>

Configures the development configuration of this project in a Kotlin script context.

images

Closure<Images>

Configures the images' configuration of this project in a Groovy context.

images

Action<in Images>

Configures the images' configuration of this project in a Kotlin script context.

imageBuild

Closure<ProjectConfiguration>

Configures the image build configuration of this project in a Groovy context.

imageBuild

Action<in ProjectConfiguration>

Configures the image build configuration of this project in a Kotlin script context.

Development Configuration DevelopmentConfiguration

Properties

Property Type Default value Description

appserverAsContainer

Boolean

false

If the appserver runs as a container this value must be true. This is used for customer projects.

licenseDirectory

String

<GRADLE_USER_HOME>/icm-default/lic

The directory with a valid license file for the running project.
Deprecated since 2.9.0: Property licenseDirectory is unsupported.

configDirectory

String

<GRADLE_USER_HOME>/icm-default/conf

This directory contains the environment specific development configuration for ICM. See Configuration properties file.

licenseFilePath

String

<licenseDirectory>/license.xml

The file path of the license file (read only).
Deprecated since 2.9.0: Property licenseFilePath is unsupported.

configFilePath

String

<configDirectory>/icm.properties

The path of the configuration file (read only).

cartridgeList

SetProperty<String>

none

The names of the cartridges to be used whenever an ICM-AS server is started inside a container.

Methods

Method Parameter Description

getConfigProperty

String

Get a property from the configuration file. If the property key is not available the return value is empty.

getConfigProperty

String, String

Get a property from the configuration file. If the property key is not available the return value is specified by the second parameter.

Image Configuration Images

Properties

Property Type Default value Description

webadapter

Property<String>

docker.intershop.de/intershop/icm-webadapter:latest

The image contains the web server of the Intershop Commerce Management application with a special Intershop Apache module.

webadapteragent

Property<String>

docker.intershop.de/intershop/icm-webadapteragent:latest

The web adapter agent image of the Intershop Commerce Management application.

mssqldb

Property<String>

mcr.microsoft.com/mssql/server:2019-latest

The Microsoft SQL server image. There will be also a build file available.

mailsrv

Property<String>

mailhog/mailhog:latest

A mail server for testing the mail feature of the application.

solr

Property<String>

solr/latest

This image is used for the Solr Cloud configuration with a single node.

zookeeper

Property<String>

zookeeper:latest

This image is used for the Solr Cloud configuration with a single node.

icm-nginx

Property<String>

icm-nginx:latest

This image is used for the Nginx reverse proxy for development without the WebAdapter.

redis

Property<String>

redis:latest

This image is used for a local redis instance, which can be used as a pagecache when the WebAdapter is disabled.

===== Image Build Configuration ProjectConfiguration

Properties

Property Type Default value Description

license

Property<String>

"Intershop Communications AG"

The license of image artifacts created by this build.

maintainer

Property<String>

"Intershop Communications AG \"www.intershop.de\""

The maintainer of image artifacts created by this build.

baseDescription

Property<String>

"Intershop Commerce Management"

The base description for all image artifacts created by this build.

version

Property<String>

The version of image artifacts created by this build.

created

Property<String>

<build time>

The build time of image artifacts created by this build. The machine time is used for the default value.

baseImageName

Property<String>

"server/intershop/icm"

The base image name for all image artifacts created by this build.

images

Images

The detailed configuration of all image builds.

Image Build Configuration Images

Properties

Property Type Default value Description

mainImage

ImageConfiguration

The configuration of the main server image build.

testImage

ImageConfiguration

The configuration of the test server image build. This image uses the main image as a base image.

For all properties configurations methods with a closure or an action are available.

Detailed Image Build Configuration ImageConfiguration

Properties

Property Type Default value Description

nameExtension

Property<String>

Image name extension of the special image. The base is used from the [ProjectConfiguration].

description

Property<String>

Extended description of the image.

srcFiles

ConfigurableFileCollection

Source files for the build (start scripts etc.). These files are referenced by the Dockerfile.

pkgTaskName

Property<String>

Files will be packaged by the build for an installation in a docker image. This is the name of the package task.

dockerfile

RegularFileProperty

The docker file for the image build.

dockerBuildDir

Property<String>

The working director for the image build.

enabled

Property<Boolean>

The build of the image can be disabled for the project.

Tasks

Task name Description

prepareNetwork

Creates a network with the specified name <extension name>-network. All start tasks are dependent on this task.

removeNetwork

Removes the network from the Docker configuration.

*MSSQL

These tasks pull, start, stop and remove the MSSQL image.

*MailSrv

These tasks pull, start, stop and remove the Mail server image.

*SolrCloud

These tasks orchestrate all Solr Cloud related tasks.

*ZK

These tasks pull, start, stop and remove the Zookeeper image.

*Solr

These tasks pull, start, stop and remove the Solr image.

createWebVolumes

Creates necessary volumes for the ICM web server with WebAdapter Agent.

removeWebVolumes

Removes web server volumes from the Docker configuration.

*WAA

These tasks pull, start, stop and remove the ICM Web Adapter Agent image.

*WA

These tasks pull, start, stop and remove the ICM Web Adapter image. This image contains an Apache webserver with the ICM WA module.

*WebServer

These tasks orchestrate all web server related tasks.

containerClean

This task starts the remove tasks for all available objects.

generateICMProps

Generates an icm.properties file for local development.

showICMASConfig

Shows a special part of icm.properties for local application server development.

startEnv

Starts a docker based environment based on "intershop.environment.container" in the icm properties file.

stopEnv

Stops the docker based environment based on "intershop.environment.container" in the icm properties file.

*NGINX

These tasks pull, start, stop and remove the ICM NGINX image. This image contains a NGINX configured to terminate TLS and reverse proxy directly to the Application Server.

*Redis

These tasks pull, start, stop and remove the redis image. Redis is always started on Port 6379.

generateICMProps Parameters

The task can be called with the following parameters:

Parameter Description

--db

Option for the used database. The following values are possible:
mssql-container - MSSQL configuration for database provided by a container
mssql - MSSQL configuration for an external database

--icmas

If this parameter specified, the properties file will be generated for app server development.

--icmenvops

A comma-separated list of options for the icm.properties files.
dev - General development properties for the application server
mail - MailHog container is used as test mail server
solr - Single node solr cluster with containers is used

The package of all tasks is com.intershop.gradle.icm.docker.tasks.

Task name Class Description

pull*

AbstractPullImage

These task pull the image or a set of images.

start*

StartExtraContainer

Start image with the necessary configuration.

stop*

StopExtraContainer

Stop image by name.

remove*

RemoveContainerByName

Removes image from Docker by name.

Task configuration

The following properties are part of the Configuration properties file.

MSSQL
Key Description Co-domain Mandatory/Optional Default value

intershop.db.mssql.port

the container port to be used for the database (normally no need to change)

Integer

Optional

1433

intershop.db.container.mssql.hostport

the host port to be used for the database

Integer

Optional

1433

intershop.db.mssql.sa.password

the password to be set for the sa-user

Integer

Optional

1ntershop5A

intershop.db.mssql.dbname

the name of the actual DB to be created

String

Optional

icmtestdb

intershop.db.mssql.recreatedb

controls if the actual DB is recreated on container start

Boolean

Optional

false

intershop.db.mssql.recreateuser

controls if the DB-user is recreated on container start

Boolean

Optional

false

intershop.db.mssql.useHostUser

controls if the host system’s current user is used for the container start

Boolean

Optional

false

intershop.jdbc.user

the name of the actual DB user to be created

String

Optional

intershop

intershop.jdbc.password

the password of the actual DB user to be created

String

Optional

intershop

WA
Key Description Co-domain Mandatory/Optional Default value

webserver.http.port

the host port to be used for the WebAdapter http port

Integer

Optional

8080

webserver.https.port

the host port to be used for the WebAdapter https port

Integer

Optional

8443

webserver.container.http.port

the container port to be used for the WebAdapter http port (normally no need to change)

Integer

Optional

8080

webserver.container.https.port

the container port to be used for the WebAdapter https port (normally no need to change)

Integer

Optional

8443

webServer.cert.path

the host path to look for TLS certificate and private key (if not defined, no certificates will be mounted for the WA)

Path

Optional

<none>

webserver.cert.server

short name of the certificate file inside of webServer.cert.path

String

mandatory if webServer.cert.path is set

<none>

webserver.cert.privatekey

short name of the private key file inside of webServer.cert.path

String

mandatory if webServer.cert.path is set

<none>

intershop.ws.readinessProbe.interval

interval in seconds to be used to check if the WebAdapter is ready

Integer

Optional

2

intershop.ws.readinessProbe.timeout

max. number of seconds to wait for the WebAdapter to become ready

Integer

Optional

30

webserver.use.http2

enables/disables usage of HTTP2

Boolean

Optional

false

wa.useHostUser

controls if the host system’s current user is used for the container start

Boolean

Optional

false

WAA
Key Description Co-domain Mandatory/Optional Default value

waa.useHostUser

controls if the host system’s current user is used for the container start

Boolean

Optional

false

NGINX
Key Description Co-domain Mandatory/Optional Default value

nginx.http.port

the host port to be used for the NGINX http port

Integer

Optional

8080

nginx.https.port

the host port to be used for the WebAdapter https port

Integer

Optional

8443

nginx.cert.path

the host path to look for TLS certificate and private key (if not defined the certificates will be mounted from the Webserver certificate path)

Path

Optional

<none>

nginx.cert.filename

name of the certificate file

String

Optional

fullchain.pem

nginx.privatekey.filename

name of the certificate private key file

String

Optional

privkey.pem

nginx.useHostUser

controls if the host system’s current user is used for the container start

Boolean

Optional

false

Solr
Key Description Co-domain Mandatory/Optional Default value

solr.clusterIndexPrefix

prefix to be used for indexed inside Solr

String

Optional

<empty>

solr.port

the host port to be used for the Solr server primary port

Integer

Optional

8983

solr.useHostUser

controls if the host system’s current user is used for the container start

Boolean

Optional

false

ZooKeeper
Key Description Co-domain Mandatory/Optional Default value

zookeeper.port

the host port to be used for the Zookeeper’s primary port

Integer

Optional

2181

zookeeper.metrics.port

the host port to be used for the Zookeeper’s metrics port

Integer

Optional

7000

zookeper.useHostUser

controls if the host system’s current user is used for the container start

Boolean

Optional

false

Mail
Key Description Co-domain Mandatory/Optional Default value

mail.smtp.host.port

the host port to be used for the SMTP port

Integer

Optional

25

mail.admin.host.port

the host port to be used for the MailHog administration/backoffice port

Integer

Optional

8025

mail.readinessProbe.interval

interval in seconds to be used to check if the mail server is ready

Integer

Optional

2

mail.readinessProbe.timeout

max. number of seconds to wait for the mail server to become ready

Integer

Optional

30

mail.useHostUser

controls if the host system’s current user is used for the container start

Boolean

Optional

true

Mails are stored in the build directory mailoutput.

Redis
Key Description Co-domain Mandatory/Optional Default value

redis.useHostUser

controls if the host system’s current user is used for the container start

Boolean

Optional

true

Intershop Commerce Management Customization Docker Plugin

This plugin configures additional tasks of an Intershop Commerce Management customization project. It uses the same Gradle configuration like the Docker Plugin. With this plugin the task dependencies are adapted to build customization images.

The plugins must be applied to the root project.

Plugin Configuration

Extension 'intershop_docker'

Properties

Property Type Default value Description

ishUnitTests

NamedDomainObjectContainer<Suite>

This is a configuration for special Intershop server unit tests. This configuration is used only in a customer project.

Object Suite

Properties

Property Type Default value Description

cartridge

Property<String>

This is the name of a cartridge that also contains ishUnitTests.

testSuite

Property<String>

The name of the test suite.

Additional Image Configuration Images

Properties

Property Type Default value Description

icmbase

Property<String>

docker.intershop.de/intershop/icm-as:latest

This image is used as a base image for the ICM application server image.

icmbasetest

Property<String>

docker.intershop.de/intershop/icm-as-test:latest

This image is used as a base image for the ICM application server image whenever tests are executed.

icmcustomizationbase

Property<String>

intershophub/icm-as-customization-base:latest

This image is used as a base image for the ICM application server customization image.

Tasks

Task name Description

*Container

These tasks pull, start, stop and remove the ICM application server image with a special command. There is no running process inside, but it uses the same configuration as the appserver container.

*AS

These tasks pull, start, stop and remove the ICM application server image.

*Server

These tasks orchestrate all ICM server related tasks (web server and app server)

dbPrepare

This task starts dbPrepare inside the running "Container" docker container.

ishUnitTestReport

This task starts the creation of a report for all ISHUnit test executions.

*ISHUnitTest

This task starts ishUnit tests inside the running "Container" docker container.

For task classes see the documentation of task in the Intershop Commerce Management Docker Plugin. The task startContainer and startAS uses StartServerContainer. pullContainer and pullAS uses PullImage. With this task it is possible to use an alternative image for these tasks with a command line parameter --altImage.

Task configuration

The following properties are part of the Configuration properties file.

dbPrepare
Key Description Co-domain Mandatory/Optional Default value

intershop.as.connector.port

the container port to be used for the appserver service connector http port (normally no need to change)

Integer

Optional

7743

intershop.servletEngine.connector.port

the host port to be used for the appserver service connector http port

Integer

Optional

7743

intershop.as.managementConnector.port

the container port to be used for the appserver management connector http port (normally no need to change)

Integer

Optional

7743

intershop.servletEngine.managementConnector.port

the host port to be used for the appserver management connector http port

Integer

Optional

7743

intershop.as.jmx.connector.port

the host port to be used for the appserver JMX port

Integer

Optional

7747

intershop.as.debug.port

the host port to be used for the appserver debug port

Integer

Optional

7746

intershop.databaseType

database type to be used

{ mssql }

Mandatory

<none>

intershop.jdbc.url

JDBC URL pointing to the database to be used

URL

Mandatory

<none>

intershop.jdbc.user

JDBC database user

String

Mandatory

<none>

intershop.jdbc.password

JDBC database password

String

Mandatory

<none>

intershop.environment.intershop.dbinit.breakOnError

if true dbPrepare/startAS fails if any init-preparation step fails

Boolean

Optional

false

intershop.environment.intershop.dbmigrate.breakOnError

if true dbPrepare/startAS fails if any migrate-preparation step fails

Boolean

Optional

false

intershop.encryption.strictMode.enabled

If not specified or set to false the ICM configuration property intershop.encryption.strictMode.enabled is set to false allowing the icm-as to work without any encryption configuration. To enforce the icm-as to work with intershop.encryption.strictMode.enabled=true explicitly set intershop.encryption.strictMode.enabled=true in icm.properties.

Boolean

Optional

false

The referenced database can either be an externally running database or an instance started using the gradle Tasks startMSSQL. In either case the properties intershop.databaseType and intershop.jdbc.* have to be defined properly (when using the gradle tasks the hostname equals the container name).

Application Server

Configuration of dbPrepare also applies to the application server. But there are some additional properties:

Key Description Co-domain Mandatory/Optional Default value

intershop.as.readinessProbe.interval

interval in seconds to be used to check if the appserver is ready

Integer

Optional

15

intershop.as.readinessProbe.timeout

max. number of seconds to wait for the appserver to become ready

Integer

Optional

6000 (full dbinit may be necessary)

ISH unit tests

Configuration of dbPrepare also applies to the container started to run the ISH unit tests.

Task parameters

dbPrepare
Parameter Description Co-domain Default value

mode

controls which mode is used by dbPrepare (forced initialization/migration or automatic)

{ init, migrate, auto }

auto

clean

controls if dbPrepare just cleans the DB and sites (only), cleans and initializes the DB and sites (yes) or migrates the DB and sites (no)

{only, yes, no}

no

cartridges

controls which cartridges are actually prepared

comma-separated list of cartridge names to prepare

<none>

property-keys

controls which preparers are actually executed

comma-separated list of preparer property keys to execute

<none>

additional-parameter

additional command line parameters to be passed to dbPrepare. Use more than once to passed more than 1 parameter

String

<none>

debug-icm

controls if the Java code inside of dbPrepare can be debugged and if the JVM suspends until a debug client connects

{ no, yes, suspend }

no

classpathLayout

sets a custom classpath layout

comma separated list of {release,source,sourceJar,eclipse}, default value is sourceJar,release

sourceJar,release

Note
To make the classpathLayout sourceJar work the gradle-property localVersion has to be set to true (see https://github.com/IntershopCommunicationsAG/gitflow-version-gradle-plugin#gradle-properties).
Examples
fresh initialization
./gradlew dbPrepare --mode=init --clean=yes
only execute some preparers of a cartridge
./gradlew dbPrepare --cartridges=core --property-keys=Class2,Class4
use custom parameters
./gradlew dbPrepare --additional-parameter="--force-exec-id=core:Class2,core:Class4" --additional-parameter="--dry-run-save"
Application Server
Important
The following parameters actually belong to the task createAS (not startAS).
Parameter Description Co-domain Default value

debug-icm

controls if the Java code inside application server can be debugged and if the JVM suspends until a debug client connects

{ no, yes, suspend }

no

gclog

toggles if GC logs are written by the application server

Switch

false

heapdump

toggles if a heapdump is written by the application server in case of an OutOfMemoryError

Switch

false

appserver-name

sets a custom name for the application server

String

appserver

classpathLayout

sets a custom classpath layout

comma separated list of {release,source,sourceJar,eclipse}, default value is sourceJar,release

sourceJar,release

Note
To make the classpathLayout sourceJar work the gradle-property localVersion has to be set to true (see https://github.com/IntershopCommunicationsAG/gitflow-version-gradle-plugin#gradle-properties).
Examples
create application server container with debugging (default port 5005) in suspend mode
./gradlew createAS --debug-icm=suspend
create application server container with GC-logging and heap dump
./gradlew createAS --gclog --heapdump
start application server container previously created
./gradlew startAS
Important
As long as the application server is starting the container’s log output is forwarded to the host’s standard out. Afterwards, it is only accessible by docker logs.
Note
the application server can be started using a custom image (e.g. different version) using the --altImage parameter.
ISH unit tests
Parameter Description Co-domain Default value

debug-icm

controls if the Java code inside application server can be debugged and if the JVM suspends until a debug client connects

{ no, yes, suspend }

no

classpathLayout

sets a custom classpath layout

comma separated list of {release,source,sourceJar,eclipse}, default value is sourceJar,release

sourceJar,release

Note
To make the classpathLayout sourceJar work the gradle-property localVersion has to be set to true (see https://github.com/IntershopCommunicationsAG/gitflow-version-gradle-plugin#gradle-properties).
Examples
start all ISH unit tests
./gradlew ishUnitTestReport
start ISH unit tests of suite ac_solr_cloud_test (defined inside of intershop_docker.ishUnitTests)
./gradlew ac_solr_cloud_testISHUnitTest
Note
The ISH unit test report is generated to <buildRoot>/build/ishunitrunner.

Intershop Commerce Management Test Docker Plugin

Additional test tasks of an Intershop Commerce Management project will be added by this plugin. It uses the same Gradle configuration like the Docker Plugin. One additional task is added by this plugin.

The plugins must be applied to the root project.

Plugin Configuration

Additional Image Configuration Images

Properties

Property Type Default value Description

testmailsrv

Property<String>

docker-internal.rnd.intershop.de/icm-test/iste-mail:latest

This image is used for ICM HTMLUnitTests.

Tasks

Task name Description

*TestMailSrv

These tasks pull, start, stop and remove the Test mail server image.

Intershop Commerce Management GebTest Docker Plugin

This plugin adds test tasks for Geb.

Plugin Configuration

The plugin must be applied to the project with included Geb tests. It requires an applied ICM Docker plugin. Furthermore, it depends on the configuration of Geb self (GebConfig.groovy).

Groovy
build.gradle
plugins {
    id 'com.intershop.gradle.icm.docker.gebtest' version '5.0.0'
}

gebConfiguration {
    localDriver {
        geckoDriver {
            osPackages {
                linux {
                    url = 'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz'
                    archiveType = 'tar.gz'
                    webDriverExecName = 'geckodriver'
                }
                win {
                    url = 'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win32.zip'
                    archiveType = 'zip'
                    webDriverExecName = 'geckodriver.exe'
                }
                mac {
                    url = 'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz'
                    archiveType = 'tar.gz'
                    webDriverExecName = 'geckodriver'
                }
            }
        }
        chromeDriver {
            osPackages {
                linux {
                    url = 'https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_linux64.zip'
                    archiveType = 'zip'
                    webDriverExecName = 'chromedriver'
                }
                win {
                    url = 'https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_win32.zip'
                    archiveType = 'zip'
                    webDriverExecName = 'chromedriver.exe'
                }
                mac {
                    url = 'https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_mac64.zip'
                    archiveType = 'zip'
                    webDriverExecName = 'chromedriver'
                }
            }
        }
    }
}
Kotlin
build.gradle.kts
plugins {
    id("com.intershop.gradle.icm.docker.gebtest") version "5.0.0"
}

extensions.getByType(GebConfiguration::class.java).apply {
    localDriver {
        register("geckoDriver") {
            osPackages {
                register("linux") {
                    url.set("https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz")
                    archiveType.set("tar.gz")
                    webDriverExecName.set("geckodriver")
                }
                register("win") {
                    url.set("https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win32.zip")
                    archiveType.set("zip")
                    webDriverExecName.set("geckodriver.exe")
                }
                register("mac") {
                    url.set("https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz")
                    archiveType.set("tar.gz")
                    webDriverExecName.set("geckodriver")
                }
            }
        }
        register("chromeDriver") {
            osPackages {
                register("linux") {
                    url.set("https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_linux64.zip")
                    archiveType.set("zip")
                    webDriverExecName.set("chromedriver")
                }
                register("win") {
                    url.set("https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_win32.zip")
                    archiveType.set("zip")
                    webDriverExecName.set("chromedriver.exe")
                }
                register("mac") {
                    url.set("https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_mac64.zip")
                    archiveType.set("zip")
                    webDriverExecName.set("chromedriver")
                }
            }
        }
    }
}

This plugin adds also a source set configuration for gebTests:

  • source directory is "src/gebTest/groovy"

  • resource directory is "src/gebTest/resources"

The plugin is based on the following GebTest configuration:

resources/GebConfig.groovy
import org.junit.runner.Description
import org.junit.runners.model.Statement
import org.openqa.selenium.Dimension
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.firefox.FirefoxDriverLogLevel
import org.testcontainers.DockerClientFactory
import org.testcontainers.containers.BrowserWebDriverContainer
import org.testcontainers.containers.Network

def webDriverExec = System.getProperty('webdriverExec')
def containerNetwork = System.getProperty('container.network')

waiting {
    // max request time in seconds
    timeout = 90
    // http://gebish.org/manual/current/#failure-causes
    includeCauseInMessage = true
}

environments {
    firefoxContainer {
        driver = {
            def networkId = findNetworkIdForName(containerNetwork)
            BrowserWebDriverContainer webdriverContainer = addFirefoxContainerToNetwork(networkId)
            webdriverContainer.start()
            driver = webdriverContainer.getWebDriver()
            driver
        }
    }

    chromeContainer {
        driver = {
            def networkId = findNetworkIdForName(containerNetwork)
            BrowserWebDriverContainer webdriverContainer = addFirefoxContainerToNetwork(networkId)
            webdriverContainer.start()
            driver = webdriverContainer.getWebDriver()
            driver
        }
    }

    chromeTablet {
        driver = {
            def driver = createChromeDriverInstance(webDriverExec)
            driver.manage().window().setSize(new Dimension(1024, 768))
            driver
        }
    }

    chromePC {
        driver = {
            def driver = createChromeDriverInstance(webDriverExec)
            driver.manage().window().setSize(new Dimension(1920, 1200))
            driver
        }
    }

    geckoPC {
        driver = {
            def driver = createGeckoDriverInstance(webDriverExec)
            driver.manage().window().setSize(new Dimension(1920, 1200))
            driver
        }
    }

    geckoTablet {
        driver = {
            def driver = createGeckoDriverInstance(webDriverExec)
            driver.manage().window().setSize(new Dimension(1024, 768))
            driver
        }
    }
}

private def createGeckoDriverInstance(String webDriverExec) {
    System.setProperty("webdriver.gecko.driver", webDriverExec)
    FirefoxOptions options = new FirefoxOptions()
    //options.setHeadless(true)
    options.setLogLevel(FirefoxDriverLogLevel.ERROR)
    driverInstance = new FirefoxDriver(options)
    driverInstance
}

private def createChromeDriverInstance(String webDriverExec) {
    System.setProperty("webdriver.chrome.driver", webDriverExec)
    driverInstance = new ChromeDriver()
    driverInstance
}

private BrowserWebDriverContainer addFirefoxContainerToNetwork(String networkId){
    Network tcNet = createNetwork(networkId)

    FirefoxOptions options = new FirefoxOptions()
    options.setHeadless(true)
    BrowserWebDriverContainer webdriverContainer = new BrowserWebDriverContainer<>()
            .withCapabilities(options)
            .withNetwork(tcNet)

    return webdriverContainer
}

private BrowserWebDriverContainer addChromeContainerToNetwork(String networkId){
    Network tcNet = createNetwork(networkId)

    ChromeOptions options = new ChromeOptions()
    options.setHeadless(true)
    BrowserWebDriverContainer webdriverContainer = new BrowserWebDriverContainer<>()
            .withCapabilities(options)
            .withNetwork(tcNet)

    return webdriverContainer
}

private String findNetworkIdForName(String name) {
    def client = DockerClientFactory.instance().client()
    def rv = client.inspectNetworkCmd().withNetworkId(name).exec().id
    return rv
}

private createNetwork(networkId) {
    Network tcNet = new Network() {

        String getId() {
            return networkId
        }

        void close() throws Exception {}

        Statement apply(Statement base, Description description) {
            return null
        }
    }
    return tcNet
}

The plugin set the following system properties for the test:

webdriverExec

Executable name for local drivers from the extension configuration.

container.network

Network for the test containers framework.

geb.build.baseUrl

The url will be calculated from the base configuration of the web server image. If the container framework is used, the internal network name is used.

Extension 'gebConfiguration'

Properties

Property Type Default value Description

gebEnvironment

Property<String>

"firefoxContainer"

Name of the configured in the Geb configuration file GebConfig.groovy.

localDriver

NamedDomainObjectContainer<GebLocalDriver>

Container with local driver configurations.

Object GebLocalDriver

Properties

Property Type Default value Description

osPackages

NamedDomainObjectContainer<GebDriverDownload>

Container with a configuration to download the necessary driver download.

Object GebDriverDownload

Properties

Property Type Default value Description

url

Property<String>

Container with a configuration to download the necessary driver download.

archiveType

Property<String>

Container with a configuration to download the necessary driver download.

webDriverExecName

Property<String>

Container with a configuration to download the necessary driver download.

Tasks

Task name Class Description

gebTest

Test
GebTest

Starts the Geb Test form the gebTest source set.

downloadDriver

GebDriverDownload

Downloads and unpack the configured local driver if necessary.

Configuration properties file and Image Properties

It is possible to switch to a local driver for development purposes.

Task Property Key Property Value

gebTest

geb.local.driver

The name of the local driver.

geb.local.environment

The name of the local environment.

For container configuration

*

webserver.container.http.port

The exposed http port of the webserver. Default: 808

webserver.container.https.port

The exposed https port of the webserver. Default: 8443

For local configuration

*

intershop.local.hostname

The hostname or the IP of the local machine.

webserver.http.port

The exposed http port of the webserver.

webserver.https.port

The exposed https port of the webserver.

Intershop Commerce Management SolrCloud Plugin

If the project includes SolrCloud as a search engine, this plugin provides some necessary tasks for the management of search indexes. It uses the same configuration as the ICM Docker plugin.

Tasks

Task name Class Description

cleanUpSolr

CleanUpSolr

Removes all search configurations and collections with a specified prefix.

listSolr

ListSolr

List all search configurations and collections with a specified prefix.

rebuildSearchIndex

RebuildSolrSearchIndex

Starts an ICM job over the ICM Rest interface to rebuild all search indexes.

Configuration properties file and Image Properties

Task Property Key Property Value

cleanUpSolr
listSolr

solr.zooKeeperHostList

A list of all Zookeeper hosts with port and the Solr server prefix.
e.g. zookeeper1:2181,zookeeper2:2181,zookeeper3:2181/solr

solr.clusterIndexPrefix

A simple installation specific prefix for the Solr search configuration, e.g. the hostname.

rebuildSearchIndex

intershop.smc.admin.user.name

This is the ICM SMC admin user. Default: admin.

intershop.smc.admin.user.password

This is the password of the SMC admin user.

disable.ssl.verification

If no public SSL certificate is installed on the webserver, it is possible to disable the verification with the value true.

*

intershop.local.hostname

The hostname or the IP of the local machine.

webserver.http.port

The exposed http port of the webserver.

webserver.https.port

The exposed https port of the webserver.

Configuration properties file

For the configuration on a special local machine it is necessary to provide an Intershop licence file and a icm.properties file in file structure. It is possible to configure the location with environment properties. This is a minimum set of properties.

icm.properties

# database connection configuration
intershop.databaseType = mssql
intershop.jdbc.url = jdbc:sqlserver://host:1433;databaseName=dbname
intershop.jdbc.user = user
intershop.jdbc.password = password

# webserver configuration of the appserver
intershop.WebServerURL=http://host:8080
intershop.WebServerSecureURL=https://host:8443

# webserver configuration
webserver.http.port = 8080
webserver.https.port = 8443

# database container configuration
intershop.db.mssql.dbname = dbname

# server configuration
intershop.servletEngine.connector.port = 7743

# local host configuration
# this is not always 'localhost'.
intershop.local.hostname = 192.168.2.205

# solr configuration
solr.zooKeeperHostList = jengsolr1.intershop.de:2181;jengsolr2.intershop.de:2181;jengsolr3.intershop.de:2181/solr8
solr.clusterIndexPrefix = devhost

intershop.smc.admin.user.name = admin
intershop.smc.admin.user.password = password

# disable the ssl verification of the webserver
disable.ssl.verification = true

# geb.local.environment = chromePC
# geb.local.driver = chromeDriver

# Readiness probe during startAS-task
# number of seconds between requests to http://<hostname>:<port>/status/ReadinessProbe (optional, default=30)
#intershop.as.readinessProbe.interval = 30
# max. number of seconds between start of probing and finally given up assuming that the start failed
# (optional, default=6000)
#intershop.as.readinessProbe.timeout = 30

Contribute

See here for details.

License

Copyright 2014-2020 Intershop Communications.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.