This cookbook describes in full detail how to create the required CI infrastructure. It provides detailed examples based on Jenkins as CI server and Subversion for version control. In addition, the cookbook also describes how to set up the required users and permissions.
This cookbook describes the setup and configuration of the base processes in a Continuous Integration Environment (CI).
Note
This cookbook requires Intershop Gradle tools version 2.11. Previous versions of this document show how to deal with:
This document replaces Cookbook - Setup of CI Infrastructure (valid to Gradle Tools 2.7).
Since Intershop delivers Maven artifacts, it is necessary to reconfigure the existing infrastructure. For more detailed information, refer to the section Cookbook - Setup of CI Infrastructure | Migration.
There are changes outside the Gradle tools that affect CI setup components. Therefore, a new version of the CI setup Gradle plugin was created. Refer to the corresponding notes for this new version in the document.
Intershop Gradle Tools and this document make no assumptions which artifact repository server, continuous integration server (CI server), or version control system (VCS) to use. This cookbook provides examples for using Sonatype Nexus, Jenkins, Subversion (SVN), and git.
Note
The recipes in this cookbook are made for a specific ICM version in combination with specific Intershop Gradle Tools.
Since bootstrap of Intershop Gradle Tools defines your project's directory structure and different versions of Intershop Gradle Tools differ regarding their plugins, ensure to use a valid combination of ICM and Intershop Gradle Tools.
For detailed version dependency information refer to Reference - CI Dependencies of Intershop Commerce Management.
For more detailed information on which plugins are available/deprecated for which Intershop Gradle Tools version refer to:
Below is the overview of all necessary components:
Note
For build, demonstration, and integration systems it is necessary to have a database (Oracle, Microsoft SQL Server). Microsoft SQL Servers are supported since ICM 7.10. On such machines it is also necessary to have an installed JDK.
Refer to System Requirements Sheet of your Intershop version for the recommended versions of Oracle Database, Oracle Client, and JDK installations.
The order of the recipes describes the way to set up a CI environment with all the necessary components. Some recipes can be executed in parallel or may be executed multiple times.
Phrase | Meaning |
---|---|
Version Control System (VCS) | Also known as source control, source code management systems (SCM), or revision control systems (RCS). VCS is a mechanism for keeping multiple versions of your files, so that when you modify a file you can still access the previous revisions. |
Artifact Repository | Place, where build and package software components are located. Provide a common interface to a dependency management system. |
Code Analysis | Process to analyze source code to calculate metrics, find bugs, etc. |
Continuous Delivery Pipeline | Sometimes called Deployment Pipeline, describes the stages, which code artifacts runs through source to production system. |
System Component | A software package of different code artifacts and files, that have to be deployed together. |
System Component Set | Is a container for system components, that needs to be build and branched together. |
Assembly | An assembly references one or more system components residing in the same or a configured artifact repository in order to deploy or deliver them together. |
Build Process | Compiles and packages files and code artifacts from a source project to deployable artifacts. |
Publish Process | The process which transfers the deployable artifacts to a configured artifact repository. |
Assembly Process | This process combines several system components to an assembly. |
Deployment Process | This process extracts files and code artifacts from an artifact repository and applies the configuration. |
Project Gradle Distribution | This is a customized Gradle distribution with the preconfigured artifact repositories and Gradle plugins. |
Gradle Plugin | A Gradle plugin packages up reusable pieces of build logic, which can be used across many different projects and builds. |
Project Gradle Plugin | This is a Gradle plugin which contains special corporate respectively project settings. |
Corporate Plugin | The term is used as a synonym for Project Gradle Plugin. |
Gradle Extension Object | Java Bean compliant class holding configurations for Gradle plugins. |
Gradle Wrapper | The Gradle Wrapper is the preferred way of starting a Gradle build. The wrapper is a batch script on Windows, and a shell script for other operating systems. When you start a Gradle build via the wrapper, Gradle will be automatically downloaded and used to run the build. See for more information The Gradle Wrapper in the Gradle documentation (2.11, 2.7, 2.3, 2.0, 1.8) |
Intershop Cluster | A number of hosts of different types serving an Intershop 7. |
Cluster Node | One separately deployable part of an Intershop cluster. A host can run multiple nodes of one Intershop cluster. |
Standardizing And Administering Your Enterprise Build Environment
This section gives an overview of what has changed compared to the previous document. With this new version of the Intershop Gradle Tools, Intershop did some changes in the setup of the infrastructure.
The bootstrap package was replaced with a publicly available template.
The corporate plugin configuration was removed and the corporate plugin was replaced with the public available plugin (repoconfig-gradle-plugin). Therefore it is necessary to reconfigure the existing infrastructure. Follow the steps described in recipe Configure Artifact Repository Server, to provide the needed repositories.
As Intershop 7.6 and later contains Maven artifacts, it is necessary to reconfigure the existing infrastructure. Follow the steps described in recipe Configure Artifact Repository Server, to provide the needed repositories.
There is a new CI setup version which comes with changes for a project setup. Generate these files and merge them into existing projects that should run on Intershop Commerce Management 7.6 or later. To get the generated files, follow recipe Create Sources From Intershop Templates. Follow the special migration steps.
Finally, the CI build plan configuration needs to be adapted as well. Please see recipe Set up CI Build For Project Artifacts.
Please mind migration steps documented in Public Release Notes - Gradle Tools - Version 2.11. Intershop recommends to use the latest version of the provided Gradle tools.
The artifact repository server stores artifacts. Artifacts are uploaded by the build server and downloaded by development environments, the build server and demo/production deployments. The build engineer resp. developer should set up and configure this server at the beginning of a project. So, which artifact repository servers are available and which configuration is required to run the Intershop build, assembly and deployment tools?
The following artifact repository servers are available and work with the Intershop continuous delivery tools:
Example
See the discussion for an example using Sonatype Nexus.
There are scripts for an automatic setup and configuration on GitHub.
Please verify the preconditions on the machine!
Note
The file ishrepo_repository.json must be adapted with the correct account ID, user name, and password.
Choose an artifact repository server and perform the following steps:
A repository server can hold multiple repositories. Each repository is reachable via a URL of the form <repository base URI>/<repository ID>, e.g., http://nexus/repositories/releases.
Create/configure the following repositories:
ID | Usage | Comment |
---|---|---|
jcenter | For Maven artifacts available from Bintray JCenter. (Proxy for https://jcenter.bintray.com) | These are artifact proxies to repositories in the internet, which cache all already retrieved artifacts. Please check the detailed configuration below. |
central | For Maven artifacts available from Maven Central. (Proxy for https://repo1.maven.org/maven2/) | |
ishrepo | For binary artifacts provided by Intershop. (Proxy for https://repository.intershop.de/) Please have a look at your contract page in the Intershop KB area for more information. | |
distributions | Repository for Gradle distributions. | |
releases | For corporate/ project releases. | |
snapshots | For all artifacts from snapshot builds. This is the only repository that should allow overwriting of existing artifacts with the same name and version. | |
components | This repository combines releases, jcenter, central, ishreleases (if present), and ishrepo into one group. | This is a repository group. Please check the detailed configuration below. |
Note
As of March 31, 2021, JCenter no longer provides new artifacts and goes into read-only state. Therefore Gradle deprecated the jCenter repository configuration and will remove this in the next major version. For this reason, Intershop moves to Maven Central for new Maven artifacts.
What is needed for the future? Make sure to add the proxy repository configuration for Maven Central (https://repo1.maven.org/maven2/) to your Artifact Repository Server in parallel with the JCenter configuration.
ishreleases
ishreleases is the predecessor to the proxy-based ishrepo and was used to host Intershop releases that were not delivered via Intershop's public repository. You do not need to create this repository when working only with Intershop releases that are delivered via public repository (e.g., Intershop Commerce Suite 7.9).
For some repository server software it is recommended to store Maven and Ivy artifacts in different repositories. This is a suggestion for this special kind of configuration.
ID | Usage | Comment |
---|---|---|
jcenter | For Maven artifacts available from Bintray JCenter (Proxy for https://jcenter.bintray.com) | These are artifact proxies to repositories in the internet that cache all artifacts that have already been retrieved. |
central | For Maven artifacts available from Maven Central (Proxy for https://repo1.maven.org/maven2/) | |
distributions | Repository for Gradle distributions | This is a Maven repository. |
ivy-local-releases | For corporate/ project releases of Ivy artifacts | Replaces releases configuration in this special kind of configuration. |
mvn-local-releases | For corporate/ project releases of Maven artifacts | |
ivy-intershop | For Ivy binary artifacts provided by Intershop. This is a proxy repository for https://repository.intershop.de/ivy-releases | Replaces ishrepo configuration in this special kind of configuration. |
mvn-intershop | For Maven binary artifacts provided by Intershop. This is a proxy repository for https://repository.intershop.de/mvn-releases | |
ivy-releases | This repository combines local Ivy releases (ivy-local-releases), Intershop Ivy releases (ivy-intershop) into one group. | These are group or virtual repositories. It replaces components configuration in this special kind of configuration. |
mvn-releases | This repository unites local Maven releases (mvn-local-releases), Intershop Maven (mvn-intershop) releases and JCenter in one group. | |
ivy-local-snapshots | For all artifacts from snapshot builds of Ivy artifacts | Please check the configuration of your repository for the handling of snapshots. It replaces snapshots configuration in this special kind of configuration. |
mvn-local-snapshots | For all artifacts from snapshot builds of Maven artifacts |
Download and install Sonatype Nexus:
URL | http://www.sonatype.org/ |
Download URL | http://www.sonatype.org/downloads/nexus-latest-bundle.zip |
Install documentation | https://support.sonatype.com/forums/22202613-Getting-Started |
This is the overview of available repositories in an installation before any changes:
The following repositories are necessary for all build and deployment processes:
Name | ID | Repository Type | Remote Storage Location | Format | Remarks |
---|---|---|---|---|---|
JCenter | jcenter | Proxy | https://jcenter.bintray.com/ | Maven2 | These are artifact proxies to repositories on the internet that cache all artifacts that have already been retrieved. |
Central | central | Proxy | https://repo1.maven.org/maven2/ | Maven2 | |
Intershop | ishrepo | Proxy | https://repository.intershop.de/releases | Maven2 | See Set up the Intershop Proxy below for details on how to get your contract-id and authorization information. |
Intershop Ivy | ivy-intershop | Proxy | https://repository.intershop.de/ivy-releases | Ivy | |
Intershop Maven | mvn-intershop | Proxy | https://repository.intershop.de/mvn-releases | Maven2 |
If you need additional remote repositories, all these repositories should be configured in one group. This makes it easier to configure this kind of repository in the Gradle configuration, because all different repositories are usable via one URL. These repositories provide third party artifacts from public Maven repositories. The repository server needs internet access.
The Intershop Proxy Repository in your repository provides artifacts according to your contract with Intershop. So you need to log in to the Intershop Knowledge Base and retrieve your credential tokens from your contract details. You need to check the Authentication (optional) box and provide your credential tokens (user and password).
Note
Login failed for repository.intershop.de
Although Intershop's public repository server shows a login screen when viewed in a web browser, those credentials do not entitle you to log in to the Artifactory UI. A login attempt yields the following error message:
Username or Password Are Incorrect.
This is entirely intentional by design. Your credentials are suitable only for resolving artifacts using a proxy repository.
Note
Possible pitfall when attempting to access files via this proxy repository - if the following message appears:404 - Automatic routing filter rejected remote request for path https://repository.intershop.de/releases/com.intershop.public.source/a_responsive/<version>/zips/a_responsive-zip-src-<version>.zip from M2Repository(id=ishrepo)
Apply the following workaround.
Switch to the tab Routing and make sure Discovery is unchecked.
Note
In case of Nexus 3 usage you need to define layout policy PERMISSIVE to avoid repository download issues.
Note
In case the error message 404 - Automatic routing filter rejected remote request
persists, please verify the configuration of the Nexus -> Views/Repositories -> Routing and adapt or delete the existing rules.
Create and configure the following repositories as hosted:
Name | ID | Repository Type | Repository Policy | Deployment Policy | Usage |
---|---|---|---|---|---|
Distributions | distributions | hosted | Release | Disable Redeploy | for project Gradle distribution |
Releases | releases | hosted | Release | Disable Redeploy | for corporate / project releases |
Snapshots | snapshots | hosted | Snapshot | Allow Redeploy | for all artifacts from snapshot builds |
The following repository forms a repository group of different repositories. There are hosted repositories as well as the Intershop proxy repository in there. Create it according to the following table:
Name | ID | Repository Type | Format | Repository Names |
---|---|---|---|---|
Components | components | group | Maven2 | Releases, Intershop, JCenter, Central |
Once you created the new repository group, switch to the Configuration tab an move the needed repository from Available Repositories to Ordered Group Repositories.
Note
The order of the assigned repositories is very important.
Components Configuration
Note
Older releases of Intershop were imported to the Intershop Releases repository. If you need this for migration projects or for other use cases, it is necessary to add this repository also to the group Components. Please add this repository to the end of the list.
In the example we use the default admin user with the default password.
To create a deploy user:
The format of all hosted and proxy repositories is always Maven 2.
Note
It is necessary to configure these repositories in your artifact repository installation. After the configuration the following URLs are available.
Name | URL |
---|---|
Central | http://<Hostname:Port>/nexus/content/repositories/central |
JCenter | http://<Hostname:Port>/nexus/content/repositories/jcenter |
Intershop | http://<Hostname:Port>/nexus/content/repositories/ishrepo |
Distributions | http://<Hostname:Port>/nexus/content/repositories/distributions |
Releases | http://<Hostname:Port>/nexus/content/repositories/releases |
Components | http://<Hostname:Port>/nexus/content/groups/components |
Snapshots | http://<Hostname:Port>/nexus/content/repositories/snapshots |
The following repository is only needed for customers with older versions (7.5 and older). It is not needed for new customers. | |
Intershop Releases | http://<Hostname:Port>/nexus/content/repositories/ishreleases |
The resulting repository overview should look like this:
For the automatic execution of all build processes and the automatic installation of a new build in an integration environment it is required to have a special CI server.
How can an administrator set up this kind of server?
This is an example list of CI servers:
The listed CI servers always support remote processes, so there are different options for the execution on the server (the CI-host) or on a remote-agent (a connected client-host).
These are the extremes of all options:
Example
See the discussion for an example using Jenkins.
Hardware requirements for server processes
Software requirements for server processes
Database
Choose a CI server and perform the following steps:
Note
The CI server must support the type of your VCS. There are also corresponding plugins for special use cases of interacting with artifact repositories.
(optional)
Gradle uses a directory for caches and it is also possible to store additional configuration files in this directory. This directory can be set with the environment variable GRADLE_USER_HOME or with an additional parameter (See Gradle Command Line). The build and assembly process provided by Intershop uses this directory for a special publishing configuration on the CI server. Therefore it is necessary to provide a directory where the CI server process can read and write files. The owner of this directory should be the CI server user.
Make that path available as environment variable BASE_GRADLE_USER_HOME
to your CI builds.
Download and Install Jenkins:
URL | http://jenkins-ci.org/ |
Download URL | http://mirrors.jenkins-ci.org/ |
Install documentation | https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins |
You may follow the instructions from https://wiki.jenkins-ci.org/display/JENKINS/Use+Jenkins, resp. https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins.
After the server is started, you should change the admin password. Furthermore it is necessary to activate the following set of plugins:
Plugin | Description |
---|---|
All Changes Plugin | Shows all changes which influenced the builds of a project.
|
Build Environment Plugin* | This plugin shows information about the environment of a build and gives the option to compare the environments of two builds. |
Config File Provider Plugin* | This plugin allows the user to copy various similar configuration files to all build nodes. It also adds the ability to edit those files through the Jenkins UI. |
Dashboard View | The CI server should provide the possibility for different views of the build plans. This plugin contributes a new view implementation that provides a dashboard / portal-like view for Jenkins. |
Email-ext plugin | The CI server should be able to send e-mails, when an error has occurred in a build. This plugin extends Jenkins built in email notification functionality by giving you more control. It provides customization of 3 areas.
|
Environment Injector Plugin* | For configurations it is necessary to specify some environment variables. These settings must be isolated for a specific job. This plugin makes it possible to have an isolated environment for your jobs. |
Environment File Plugin | This plugin enables the user to set environment variables via a file. The file's format must be the standard Java property file. |
Git Parameter Plugin | This plugin allows you to choose between Git tags or sha1 of your SCM repository so Git Plugin installed is required. |
* The plugins marked with a star are mandatory for the following documentation.
It is necessary to add / change the following configuration settings:
Add global password configuration for deployment user (see Recipe: Configure Artifact Repository Server > User, Roles and Permissions)
Add password.
Name | REPO_USER_NAME | REPO_USER_PASSWD |
---|---|---|
Password | e.g., admin | e.g., admin123 |
Add password.
Name | SCM_USERNAME | SCM_PASSWORD |
---|---|---|
Password | e.g., username | e.g., password |
For a project setup or development environment setup it is necessary to have scripts, configuration files and also some basic source artifacts. The sources for the following artifacts must be generated from provided templates.
How can a developer or administrator create the source artifacts from the provided Intershop template?
Meet the minimum system requirements.
See Recipe: Configure Artifact Repository Server.
Check your active Java version:
>java -version java version "1.8.0_77" Java(TM) SE Runtime Environment (build 1.8.0_77-b03) Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
It is possible to download older version of the Oracle JDK from the Oracle website. There are scripts for an automatic setup on GitHub. If you want use this JDK installation also for the development with Intershop Commerce Management, it is necessary to add the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files from the Oracle website as well.
Download the latest version of the bootstrap package for the CI setup via your proxy.
$ wget https://github.com/IntershopCommunicationsAG/intershop-cisetup-template/archive/master.zip
(new-object System.Net.WebClient).DownloadFile('https://github.com/IntershopCommunicationsAG/intershop-cisetup-template/archive/master.zip', '<target dir>\master.zip')
It is also possible to create an own clone of the Git repository, see https://github.com/IntershopCommunicationsAG/intershop-cisetup-template.git.
Unzip the the contents or clone the Git repository to a directory of your choice, eg. intershop-cisetup-template.
unzip master.zip -d <target directory> cd <target directory>/intershop-cisetup-template-master mv * .. cd .. rm -rf intershop-cisetup-template-master
or
git clone https://github.com/IntershopCommunicationsAG/intershop-cisetup-template.git <target directory>
//TODO
. Go through these lines and provide the necessary information.Run the following command inside the intershop-ci-setup directory to generate all source artifacts:
Note
It is important to specify the JAVA_HOME before you start the command.
gradlew intershopCISetupAll
./gradlew intershopCISetupAll
See the discussion for a directory tree of the generated sources. You may also generate (or regenerate) only some of the source artifacts by running dedicated Gradle tasks, see discussion.
To download from Oracle Maven repository with the provided build script, register your OTN account for the usage of Oracle's Maven repository (https://www.oracle.com/webapps/maven/register/license.html).
Info
During the build of the component, the driver libraries are downloaded from Oracle's Maven repository. The files are cached in the build directory.
Add all generated sources to your VCS.
It is recommended to add them in a way that the different source artifacts can be branched independently. How to do this depends on the VCS.
Also add the intershop-ci-setup directory to your VCS for later regeneration of sources.
See discussion for example commands if you use SVN as VCS.
corporateName
): Specify a name that identifies your company/department. If you use the same CI environment for multiple projects, these can stay the same across projects.projectName
): Specify names that identify your project.setupDirectory
.repoBaseURL
.By default all sources are generated into subdirectories of the setupDirectory
. You may also configure independent output directories for different types of source artifacts. See the directories
section of the build.gradle file and the following examples.
plugins { id 'com.intershop.gradle.cisetup' version '2.1.0' } IntershopCISetup { directories { setupDirectory = '/home/developer/intershop-ci/sources' devOpsDir = "${setupDirectory}/devops" projectsDir = "${setupDirectory}/projects" } }
plugins { id 'com.intershop.gradle.cisetup' version '2.1.0' } IntershopCISetup { directories { setupDirectory = 'C:/Users/developer/intershop-ci/sources' devOpsDir = "${setupDirectory}/devops" projectsDir = "${setupDirectory}/projects" } }
The build.gradle file comes with default IDs for all important repositories. For changes see the repository
section of the build.gradle file.
The repository
section allows to adjust the version of your corporate distribution in property distributionVersion
.
It also allows to configure a different URL. So your corporate distribution can be downloaded by the Gradle wrapper in property distributionURL
. This way you can place your corporate distribution on any web server you want.
The versions
section configures which versions of the deployment launcher (special component of the Intershop Gradle tools) and third party components should be used. Please check always support sites of Intershop for updates.
The section intershopProject
defines only the name of the project.
Running gradlew tasks
shows all available tasks:
:tasks ------------------------------------------------------------ All tasks runnable from root project ------------------------------------------------------------ Build Setup tasks ----------------- ... Help tasks ---------- ... Intershop CI Source tasks ------------------------- createCorporateDistribution - Creates a structure of a corporate distribution package project. createDeploymentConfig - Creates a structure of a deployment configuration. createOracleComponentSet - Creates a special component set for publishing Oracle JDBC drivers createProject - Creates a structure of a project configuration. intershopCISetupAll - Create all necessary source artefacts
The resulting sources (assuming default output directories) look like this:
sources |-- devops | |-- ci_server ---------------------------------------- ci server configuration | | `-- host_configs | | `-- ciserverhost | | `-- environment.properties | |-- deployments | | `-- corporateshop ------------------------------------ Project for deploying the corporateshop, including a preconfigured settings.gradle | | |-- gradle | | | `-- wrapper | | | |-- gradle-wrapper.jar | | | `-- gradle-wrapper.properties | | |-- gradlew | | |-- gradlew.bat | | `-- settings.gradle | `-- gradle | `-- corporate-distribution ---------------------------- corporate gradle distribution package project | |-- build.gradle | |-- gradle | | `-- wrapper | | |-- gradle-wrapper.jar | | `-- gradle-wrapper.properties | |-- gradle.properties | |-- gradlew | |-- gradlew.bat | `-- src | `-- init.d | `-- intershop-init.gradle `-- projects |-- corporateshop ---------------------------------------- gradle multiproject, entry point of all component projects, related to the corporate shop | |-- gradle | | `-- wrapper | | |-- gradle-wrapper.jar | | `-- gradle-wrapper.properties | |-- gradle_environment.bat | `-- gradle_environment.sh `-- oracleDriver ---------------------------------------- special component set for publishing Oracle JDBC drivers `-- 3rd_oracle |-- build | `-- oracleLibs | `-- jars |-- build.gradle |-- gradle | `-- wrapper | |-- gradle-wrapper.jar | `-- gradle-wrapper.properties |-- gradlew |-- gradlew.bat |-- init.gradle |-- publish.bat |-- publish.sh `-- settings.gradle
The following table shows which task generates which source artifacts. Multiple projects may share the same CI environment. Some source artifacts are global to the CI environment (corporate artifacts), others are project specific (project artifacts).
Line | Generated by | Project or corporate artifact | Used in | Description |
---|---|---|---|---|
03-15 | createDeploymentConfig | project | Configuration template for running a deployment
| |
16-28 | createCorporateDistribution | corporate | Setup CI Build For Corporate Artifacts | See Concept - Gradle Build Tools |
30-36 | createProject | project | See: | |
37-52 | createOracleComponentSet | corporate | Setup CI Build For Corporate Artifacts | For legal reasons Intershop cannot deliver the Oracle JDBC drivers. This component set contains scripts to package Oracle JDBC drivers as component. Once published to the corporate repository, the Oracle JDBC drivers can be handled like any other component. |
The build script of the corporate distribution is preconfigured with a special Intershop Release plugin, see https://github.com/IntershopCommunicationsAG/gradle-release-plugins. This project provides different publishing plugins. The templates contain an inactive Artifactory publishing configuration and an active simple publish configuration.
If you want use the Artifactory publishing configuration, activate this plugin and deactivate the other plugin.
If you use Intershops new Version Recommender Gradle Plugin (https://github.com/IntershopCommunicationsAG/version-recommender-gradle-plugin), it is not necessary to do any additional code changes.
Please check your build gradle file for apply plugin: 'com.intershop.gradle.versionrecommender'
. If this plugin is applied, the sources for the distribution can be used as they are.
The old Intershop versioning plugin must be applied to all projects. Therefore it is located in the init Grade file of the distribution.
Please adapt the file '<sources>/devops/gradle/corporate-distribution/src/init.d/intershop-init.gradle'
as follows:
initscript { + // only used for secured repositories + String repoUser = System.properties['repoUser'] ?: System.getenv('REPO_USER') + String repoUserPasswd = System.properties['repoUserPasswd'] ?: System.getenv('REPO_USER_PASSWD') + repositories { + // add repository configuration for proxy configuration of Intershop public repository + ivy { + url '<URL of repository with Intershop artifacts (ID: ishrepo)>' + layout('pattern') { + ivy '[organisation]/[module]/[revision]/[type]s/ivy-[revision].xml' + artifact '[organisation]/[module]/[revision]/[ext]s/[artifact]-[type](-[classifier])-[revision].[ext]' + } + // only used for secured repositories + if(repoUser && repoUserPasswd) { + credentials { + username repoUser + password repoUserPasswd + } + } + } } dependencies { + classpath 'com.intershop.build.gradle:versioning:2.11.6' corporateName = '<name from configuration>' } + // apply old versioning plugin to all sub projects + allprojects { + // Versioning plugin + project.plugins.apply com.intershop.build.gradle.plugins.VersioningPlugin + }
If you use SVN as your VCS you may use the following commands to add your intershop-ci-setup directory and the generated sources to it.
This example assumes that:
setupDirectory
in intershop-cisetup-template /build.gradle) is /home/developer/intershop-ci/sources and you use the default output directories structure.Perform the following steps:
Create the following file for a list of common SVN ignores (assumed location is /home/developer/ignore.txt):
build .gradle bin target
Add your intershop-cisetup-template directory by executing:
cd /home/developer/intershop-ci # Create SVN structure svn mkdir --parents http://ciserver/svn/intershop/devops/intershop-cisetup-template -m "create path for template project" svn mkdir --parents http://ciserver/svn/intershop/devops/intershop-cisetup-template/branches -m "create branches folder" svn mkdir --parents http://ciserver/svn/intershop/devops/intershop-cisetup-template/tags -m "create tags folder" # Import sources to SVN svn import intershop-cisetup-template http://ciserver/svn/intershop/devops/intershop-cisetup-template/trunk -m "add intershop-ci-setup configuration" # Make your local folder a working copy svn co --force http://ciserver/svn/intershop/devops/intershop-cisetup-template/trunk intershop-cisetup-template svn revert -R intershop-ci-setup # Add ignore properties (see ignore.txt) and executable bit for gradle svn propset svn:ignore -F /home/developer/ignore.txt intershop-ci-setup-template svn propset svn:executable on intershop-ci-setup-template/gradlew* svn commit intershop-cisetup-template -m "add svn ignore and executable bit"
Add your corporate distribution by executing:
cd /home/developer/intershop-ci/sources/devops/gradle # Create SVN structure svn mkdir --parents http://ciserver/svn/intershop/devops/gradle -m "create path for Gradle projects" svn mkdir --parents http://ciserver/svn/intershop/devops/gradle/corporate-distribution/branches -m "create svn structure" svn mkdir --parents http://ciserver/svn/intershop/devops/gradle/corporate-distribution/tags -m "create svn structure" # Import sources to SVN svn import corporate-distribution http://ciserver/svn/intershop/devops/gradle/corporate-distribution/trunk -m "add corporate distribution" # Make your local folder a working copy svn co --force http://ciserver/svn/intershop/devops/gradle/corporate-distribution/trunk corporate-distribution svn revert -R corporate-distribution # Add ignore properties (see ignore.txt) svn propset svn:ignore -F /home/developer/ignore.txt corporate-distribution svn propset svn:executable on corporate-distribution/gradlew* svn commit corporate-distribution -m "add svn ignore and executable bit"
Add the project artifacts by executing (assuming project name is 'corp_project'):
cd /home/developer/intershop-ci/sources/corporateshop # Create SVN structure svn mkdir --parents http://ciserver/svn/intershop/projects/corporateshop -m "create path for project" svn mkdir --parents http://ciserver/svn/intershop/projects/corporateshop/branches -m "create svn structure" svn mkdir --parents http://ciserver/svn/intershop/projects/corporateshop/tags -m "create svn structure" # Import sources to SVN svn import corporateshop http://ciserver/svn/intershop/projects/corporateshop/trunk -m "add project" # Make your local folder a working copy svn co --force http://ciserver/svn/intershop/projects/corporateshop/trunk corporateshop svn revert -R corporateshop # Add ignore properties (see ignore.txt) svn propset svn:ignore -F /home/developer/ignore.txt corporateshop svn propset svn:executable on corporateshop/gradlew* svn commit corporateshop -m "add svn ignore and executable bit"
Add the Oracle JDBC Drivers Component Set by executing:
cd /home/developer/intershop-ci/sources/projects/oracleDriver # Create SVN structure svn mkdir --parents http://ciserver/svn/intershop/projects/3rd_oracle -m "create path for project oracle driver" svn mkdir --parents http://ciserver/svn/intershop/projects/3rd_oracle/branches -m "create svn structure" svn mkdir --parents http://ciserver/svn/intershop/projects/3rd_oracle/tags -m "create svn structure" # Import sources to SVN svn import 3rd_oracle http://ciserver/svn/intershop/projects/p_oracle/trunk -m "add Oracle JDBC driver project" # Make your local folder a working copy svn co --force http://ciserver/svn/intershop/projects/3rd_oracle/trunk . svn revert -R . # Add ignore properties (see ignore.txt) svn propset svn:ignore -F /home/developer/ignore.txt . svn propset svn:executable on gradlew* svn commit . -m "add svn ignore and executable bit"
Add demo deployment scripts (assuming project
Name
is corporateshop) by executing:
cd /home/developer/intershop-ci/sources/devops/deployments # Create SVN structure svn mkdir --parents http://ciserver/svn/intershop/devops/deployments -m "create path for deployment projects" svn mkdir --parents http://ciserver/svn/intershop/devops/deployments/corporateshop/branches -m "create svn structure" svn mkdir --parents http://ciserver/svn/intershop/devops/deployments/corporateshop/tags -m "create svn structure" # Import sources to SVN svn import corp_project http://ciserver/svn/intershop/devops/deployments/corporateshop/trunk -m "add deployment configuration" # Make your local folder a working copy svn co --force http://ciserver/svn/intershop/devops/deployments/corporateshop/trunk corporateshop svn revert -R corporateshop # Add ignore properties (see ignore.txt) svn propset svn:ignore -F /home/developer/ignore.txt corporateshop svn propset svn:executable on corporateshop/gradlew* svn commit corporateshop-m "add svn ignore and executable bit"
Add CI server host configuration by executing:
cd /home/developer/intershop-ci/sources/devops/ci_server # Create SVN structure svn mkdir --parents http://ciserver/svn/intershop/devops/ci_server/host_configs -m "create path for ci_server host_configs files and directories" svn mkdir --parents http://ciserver/svn/intershop/devops/ci_server/host_configs/branches -m "create svn structure" svn mkdir --parents http://ciserver/svn/intershop/devops/ci_server/host_configs/tags -m "create svn structure" # Import sources to SVN svn import host_configs http://ciserver/svn/intershop/devops/ci_server/host_configs/trunk -m "add host specific configuration for ci assembly process" # Make your local folder a working copy svn co --force http://ciserver/svn/intershop/devops/ci_server/host_configs/trunk host_configs svn revert -R host_configs # Add ignore properties (see ignore.txt) svn propset svn:ignore -F /home/developer/ignore.txt host_configs svn commit host_configs -m "add svn ignore"
If you use Git as your VCS you may use the following commands to add your intershop-ci-setup directory and the generated sources to it.
This example assumes that:
setupDirectory
in intershop-cisetup-template /build.gradle) is /home/developer/intershop-ci/sources and you use the default output directories structure.The following Git-Repositories are necessary:
Perform the following steps:
Create the following file for a list of common ignores (assumed location is /home/developer/.gitignore):
# IntelliJ project files .idea *.iml out gen *.bak *.log # Eclipse project files **/bin/ **/.settings/ **/.classpath **/.project # editor backup files **~ # Gradle Files **/build/ **/.gradle # Intershop build directories **/target/ # Ignore Gradle GUI config gradle-app.setting # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar
Add your intershop-cisetup-template directory by executing:
cd /home/developer/intershop-ci/intershop-cisetup-template cp /home/developer/.gitignore . git init git remote add origin git@gitserver:user/intershop-cisetup-template.git # or git remote set-url origin git@gitserver:user/intershop-cisetup-template.git git add . git update-index --chmod=+x gradlew git update-index --chmod=+x *.sh git commit git push -u origin master
Add your corporate distribution by executing:
cd /home/developer/intershop-ci/sources/devops/gradle/corporate-distribution cp /home/developer/.gitignore . git init git remote add origin git@gitserver:user/corporate-distribution.git git add . git commit git push -u origin master
Add the project artifacts by executing (assuming project name is corporateshop):
cd /home/developer/intershop-ci/sources/projects/corporateshop cp /home/developer/.gitignore . git init git remote add origin git@gitserver:user/corporateshop.git git add . git update-index --chmod=+x gradlew git update-index --chmod=+x *.sh git commit git push -u origin master
Add the Oracle JDBC Drivers Component Set by executing:
cd /home/developer/intershop-ci/sources/projects/oracleDriver/3rd_oracle cp /home/developer/.gitignore . git init git remote add origin git@gitserver:user/3rd_oracle.git git add . git update-index --chmod=+x gradlew git update-index --chmod=+x *.sh git commit git push -u origin master
Add demo deployment scripts (assuming projectName
is corporateshop) by executing:
cd /home/developer/intershop-ci/sources/devops/deployments/corporateshop cp /home/developer/.gitignore . git init git remote add origin git@gitserver:user/deployment-corporateshop.git git add . git update-index --chmod=+x gradlew git update-index --chmod=+x *.sh git commit git push -u origin master
Add CI server host configuration by executing:
cd /home/developer/intershop-ci/sources/devops/ci_server/host_configs cp /home/developer/.gitignore . git init git remote add origin git@gitserver:user/ci_server-host_configs.git git add . git update-index --chmod=+x gradlew git update-index --chmod=+x *.sh git commit git push -u origin master
Note
All recent versions use the SMC Version Plugin. That means, it is necessary to tell the versioning system whenever a new RELEASE is to be built. Otherwise, always the word SNAPSHOT is added whenever a new version is published, for example
http://nexus:8081/nexus/content/repositories/releases/gradle-dist/ish/2.0.0-SNAPSHOT/ish-2.0.0-20200618.073037-1.zip
In order to publish a new release simply add a RELEASE_ tag using git:
git tag RELEASE_2.0.1
after the
git commit
The result will be
http://nexus:8081/nexus/content/repositories/releases/gradle-dist/ish/2.0.1/ish-2.0.1.zip
Starting with Intershop Commerce Management Suite 7.6 (B2C,
B2X) the delivered assemblies no longer include cartridges that define the storefront applications and do not provide the storefront functionality, meaning the view layer with the content model. Instead, Intershop provides the Responsive Starter Store. This includes the storefront parts as a source project that can be used as a blue print to set up customer projects.
After creating the project source structure from the Intershop templates it is necessary to fill the project with the specific artifacts, especially those that make up the storefront. The Responsive Starter Store is a good starting point, that provides the functionality, code artifacts and demo content of a standard responsive storefront.
How can a build engineer or developer set up a project based on the Responsive Starter Store?
Note
License
Please make sure to comply with Glyphicons Free license terms (CC BY 3.0) or get pro license.
See the following recipes:
Note
The following listings contain diff-style where "<DIFF>" leads the listing title.
This describes changes on files where "-String=original line of code;
" represents the original line of code that should be replaced with "+String=replaced line of code
'".
See the following sections for details.
Note
Newer versions of the responsive starter store
Find the Responsive Starter Store version and download links for a corresponding Intershop Commerce Management version in the Reference - CI Dependencies of Intershop Commerce Management.
Responsive Starter Store version 3.1.4 for Intershop Commerce Management 7.8:
Download the Responsive Starter Store multi project (a_responsive
).
http://<your-reposerver:port>/nexus/content/repositories/ishrepo/com.intershop.public.source/a_responsive/3.1.4/zips/a_responsive-zip-src-3.1.4.zip
Responsive Starter Store version 4.0.0 for Intershop Commerce Management 7.9
Download the Responsive Starter Store multi project (a_responsive
).
http://<your-reposerver:port>/nexus/content/repositories/ishrepo/com.intershop.public.source/a_responsive/4.0.0/zips/a_responsive-zip-src-4.0.0.zip
Responsive Starter Store version 32.2.4 for Intershop Commerce Management 7.10
Download the Responsive Starter Store multi project (a_responsive
).
http://<your-reposerver:port>/nexus/content/repositories/ishrepo/com.intershop.public.source/a_responsive/32.2.4/zips/a_responsive-zip-src-32.2.4.zip
Content Overview of the Responsive Starter Store multi project:
a_responsive |-- app_sf_responsive |-- app_sf_responsive_b2b |-- app_sf_responsive_b2b_test |-- app_sf_responsive_b2c |-- app_sf_responsive_cm |-- app_sf_responsive_costcenter |-- app_sf_responsive_smb |-- app_sf_responsive_test |-- as_responsive |-- as_responsive_b2b |-- demo_responsive |-- demo_responsive_b2b |-- demo_responsive_catalog |-- demo_responsive_content |-- demo_responsive_ocst |-- demo_responsive_search |-- dev_storefront |-- gradle |-- inspired-b2c |-- inspired-b2x |-- microservices |-- .ivyIcm-b2c.version |-- .ivyIcm-b2x.version |-- build.gradle |-- gradle.properties |-- gradlew |-- gradlew.bat `-- settings.gradle | responsive starter store base storefront cartridge additional B2B functionality cartridge automatic tests for B2B functionality base storefront cartridge base storefront cartridge additional B2B functionality cartridge base storefront cartridge automatic tests for base functionality base storefront cartridge additional B2B functionality cartridge demo content cartridge additional B2B demo content cartridge demo content cartridge demo content cartridge demo content cartridge demo content cartridge development cartridge B2C demo assembly B2X demo assembly micro-services scheduling and recurring orders version file for ICM b2c (Available with ICM 7.9) version file for ICM b2x (Available with ICM 7.9) |
Place the content into the working copy of your project folder (that was generated via CI bootstrap before). Rest assured that there are no conflicting files in your projects folder that otherwise need to be overwritten.
Long path names on Windows
After copying the contents of the a_responsive
Gradle multi-project set into your project folder some files need to be changed to fit your projects configuration.
Replace a_responsive
with your projects name in the following files
// define root project name -rootProject.name = 'a_responsive' +rootProject.name = 'corporateshop'
Replace the com.intershop.responsive
group with your projects group in the following file:
description 'Components Responsive Starter Store Applications' -group = 'com.intershop.responsive' +group = 'com.company.corporateshop' subprojects { - group = 'com.intershop.responsive' + group = 'com.company.corporateshop'
Adapt the release configuration of the project.
// ci configuration - /** - * Intershop release configuration - * requires - * - Sonatype Nexus Pro with a configured staging configuration - * - Atlassian Jira - * and additional environment variables. - * Furthermore an applied SCMVersion plugin is mandatory. - * See https://github.com/IntershopCommunicationsAG/gradle-release-plugins. - **/ - apply plugin: 'com.intershop.gradle.nexuspublish-configuration' - apply plugin: 'com.intershop.gradle.artifactorypublish-configuration' /** * Simple Release configuration * requires only a Maven compatible repository and * additional environment variables. * See also https://github.com/IntershopCommunicationsAG/gradle-release-plugins. **/ - // apply plugin: 'com.intershop.gradle.simplepublish-configuration' + apply plugin: 'com.intershop.gradle.simplepublish-configuration' - /** - * This plugin will create a source package of the build. - * It is possible to use this e.g. for the creation of an ESCROW package. - * _This plugin is optional._ - * See https://github.com/IntershopCommunicationsAG/gradle-release-plugins - **/ - apply plugin: 'com.intershop.gradle.escrow-plugin' - escrow { - sourceGroup = 'com.intershop.public.source' - exclude '*/target' - exclude '**/gradle/wrapper/gradle-wrapper.properties' - } description 'Components Responsive Starter Store Applications' group = 'com.intershop.responsive' assert System.properties['java.version'].startsWith('1.8') - artifactory { - publish { - // for ivy publications - repository { - maven = false - } - // list of publication names - defaults { - publications('ivy', 'ivyEscrow') - } - } - }
Intershop Commerce Management 7.8
Change the Intershop Commerce Management version in the following file:
# dependency versions -version.com.intershop.assembly.commerce_management_b2x = 7.X.0.0 +version.com.intershop.assembly.commerce_management_b2x = 7.X.X.X -version.com.intershop.assembly.commerce_management_b2c = 7.X.X.X
If you need only Intershop Commerce Management B2C use b2c
instead of b2x
:
# dependency versions -version.com.intershop.assembly.commerce_management_b2x = 7.X.0.0 -version.com.intershop.assembly.commerce_management_b2c = 7.X.X.X +version.com.intershop.assembly.commerce_management_b2c = 7.X.X.X
Remove not needed sub projects.
Do not skip this step! You really need to delete these folders, otherwise you will run into exceptions.
Assembly Type | Storefront Cartridges | Demo/Init Cartridges | Assembly |
---|---|---|---|
B2C | app_sf_responsive app_sf_responsive_cm app_sf_responsive_b2c app_sf_responsive_smb as_responsive | demo_responsive demo_responsive_catalog demo_responsive_content demo_responsive_search demo_responsive_ocst | inspired-b2c |
B2X | B2C Storefront Cartridges +
app_sf_responsive_b2b app_sf_responsive_costcenter as_responsive_b2b | B2C Demo/Init Cartridges +demo_responsive_b2b | inspired-b2x |
The table gives an overview of the needed cartridges for the different assembly types.
Rename the folder of the assembly sub project 'inspired-b2x'
or 'inspired_b2c'
to your preferred name, e.g., assembly_corporateshop. This name is used for the deployment of the project.
Adapt build configuration for the used assembly
If a B2C assembly will be created:
assert System.properties['java.version'].startsWith('1.8') - def assemblyProjects = [ project(':inspired-b2c'), project(':inspired-b2x') ] + def assemblyProjects = [ project(':assembly_corporateshop') ]
If a B2X assembly will be created:
assert System.properties['java.version'].startsWith('1.8') - def assemblyProjects = [ project(':inspired-b2c'), project(':inspired-b2x') ] + def assemblyProjects = [ project(':assembly_corporateshop') ]
This configuration does only exists in version 3.x (ICM 7.8).
buildDir = new File(projectDir, 'target') - if(name == 'inspired-b2x') { - versioning { - useVersionsFrom 'com.intershop.assembly:commerce_management_b2x' - } - } - if(name == 'inspired-b2c') { + if(name == 'assembly_corporateshop') { versioning { useVersionsFrom 'com.intershop.assembly:commerce_management_b2x' } }
The Responsive Starter Store provides a set of demo cartridges that can be kept as starting point for the projects initialization cartridges or they can be removed completely.
Cartridge | Description |
---|---|
demo_responsive | Demo organization structure for inSPIRED with inTRONICS, inTRONICS Business and Myers |
demo_responsive_catalog | Catalogs with categories and products for the inSPIRED organization |
demo_responsive_content | CMS demo content (including campaigns and promotions) for the inSPIRED organization |
demo_responsive_search | Search demo configuration |
demo_responsive_ocst | Additional demo content of the OCST (Omni-channel Services Toolset, a.k.a. Contact Center) |
demo_responsive_b2b | B2B specific content for the inTRONICS Business channel |
In case they are used as init cartridges it is probably useful to rename the cartridges from "demo_...
" to "init_...
" or some other project naming scheme.
The renaming needs to be done for the cartridges folder name of the cartridge. The display name and description of the cartridge can be renamed in the build.gradle.
The Responsive Starter Store provides a sub-project microservice, which contains the microservices scheduling and recurring order.
Database for microservices
It's mandatory for production system to replace the Derby Database. Therefore the build.gradle of the microservice sub-project has to be adapted
For Oracle it is necessary to configure the correct database driver. If you have this driver in an other group, please adapt the configuration.
dependencies { /** driver for derby */ - runtime 'org.apache.derby:derby:10.12.1.1' /** driver for oracle */ /** this configuration uses the prepared oracle drivers **/ /** see 'Cookbook - Setup of CI Infrastructure', 7.2.5 Process for Building the Oracle JDBC Drivers Component **/ + runtime 'com.oracle.jdbc:ojdbc7:12.1.0.2.0.0' }
During the build of same cartridges CSS files will be generated with a Less compiler. These files must be generated to staticfiles/cartridge/static/default/css. Therefore it is necessary to extend the ignore configuration for these cartridges.
Cartridge with less compiler configuration |
---|
app_sf_responsive |
app_sf_responsive_b2b |
app_sf_responsive_smb |
It is possible to add svn:global-ignores
for the project directory:
theme.css theme.css.map
or add svn:ignore
to <cartridge name>/staticfiles/cartridge/static/default/css:
theme.css theme.css.map
Extend .gitignore of the root project:
# IntelliJ project files .idea *.iml out gen *.bak *.log # Eclipse project files **/bin/ **/.settings/ **/.classpath **/.project # editor backup files **~ # Gradle Files **/build/ **/.gradle # Intershop build directories **/target/ # Ignore Gradle GUI config gradle-app.setting # generated css app_sf_responsive*/staticfiles/cartridge/static/default/css/themes.css app_sf_responsive*/staticfiles/cartridge/static/default/css/themes.css.map app_sf_responsive*/staticfiles/cartridge/static/default/css/ # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar
After the changes it is necessary to commit the changes to the used VCS and transfer the files to the remote server.
As mentioned earlier, the demo cartridges of the Responsive Starter Store can be used as blue print for the projects initialization cartridges. For that they should be renamed and fitted to your projects needs.
Regarding the storefront cartridges of the Responsive Starter Store (app_sf_responsive, app_sf_responsive_cm, ...
) there are several options on how you can use and customize them in your projects. Those options are described below.
In any case it might be necessary to not only adapt the app_sf_responsive cartridges but also the application type definitions of as_responsive. If additional project cartridges are added they need to be added to the application type definition too.
This is the above described approach of copying the relevant storefront cartridges of the Responsive Starter Store to your projects.
Any customization can be done within additional project cartridges, with the possibilities overloading and overwriting provides. This is pretty much the same as before, except for the fact that also the Responsive Starter Store storefront cartridges are part of the project cartridges set.
This fact, that the Responsive Starter Store storefront cartridges are part of your projects sources, leads to the second customization option. It is now possible to make any customization directly in the cartridges that were provided by Intershop since they are now project cartridges. You have pretty much the same control over these sources as an Intershop developer has when developing the Responsive Starter Store. Any parts can be changed or removed or added within the cartridges of the Responsive Starter Store. This gives you for example full control over the provided CMS content model, making it possible to simply add new call parameters where needed or removing not wanted components without the need of using the overwrites mechanism.
Using the Responsive Starter Store storefront cartridges as they are is probably the simplest approach. And in case the customization is done within additional project cartridges this is probably the easiest approach for later migrations to new Responsive Starter Store versions too.
In any case newer versions of the Responsive Starter Store cartridges are not getting updated automatically but will be provided as sources too and it is up to the project to decide if and how they will update their currently used Responsive Starter Store cartridges. Less customization in those cartridges will probably make the update/migration easier.
The Responsive Starter Store is intended to be a blue print for a storefront project. The provided cartridges can be used the way they are regarding their naming and their content or they can be customized in any way wanted.
In case you want to create several independent application types that are initially based on the Responsive Starter Store or if you want to create your own storefront cartridge set based on the Responsive Starter Store but with your own naming conventions, you have to copy and rename the app_sf_responsive cartridges to transform them them into your own cartridges.
For this you basically have to search for all references to app_sf_responsive and alike in the Responsive Starter Store cartridges and replace all with your own cartridge naming. This goes for references in the content model files (*.pagelet2), in pipelines, in ISML templates and configuration files.
Also the CMS import files located in sites folder of demo_responsive_content need to be adapted to the new naming.
After this everything should work as before but with the new naming.
In case you want to use or create your own storefront cartridge set that is totally different from the Responsive Starter Store you can also remove the app_sf_responsive cartridges completely from your project. In that case you might only use the configuration files of the Responsive Starter Store but not the cartridges to set up your project.
You would build your storefront only on the basic storefront functionality that is provided by the Commerce Management assembly you are using. Basically this gives you only the storefront functionality of the sld_ch_sf_base cartridge. The whole storefront view layer would need to be provided by your own cartridges.
Internally, Intershop uses an release process with staging for releases, so that unused milestone builds can be easily dropped. For reporting purposes all issues will be extended with the solved version during the build process. Furthermore the version of internal Intershop projects is calculated from used source repository (see https://github.com/IntershopCommunicationsAG/scmversion-gradle-plugin.) This plugin is required by the release plugin com.intershop.gradle.nexuspublish-configuration. It is also possible to use a version in a property file. In this case the configuration for the com.intershop.gradle.scmversion plugin can be removed.
During the build of same cartridges CSS files will be generated with a less compiler. It is necessary, that these files must be generated to staticfiles/cartridge/static/default/css. Therefore it is necessary to extend the ignore configuration for these directories.
Multiple projects may share the same CI environment. Some artifacts are required once for the CI environment and independently of projects (corporate artifacts).
Which steps are necessary to provide these artifacts for all other processes?
See the following recipes:
See the following sections for details.
Example
See the discussion for an example using Jenkins and SVN.
Provide host-specific configuration for deployments during assembly build:
Set up an automated process for building the corporate distribution. Configure the process to:
Execute the following commands:
cd corporate-distribution ./gradlew publish
cd corporate-distribution gradlew publish
This command provides a local published repository. The version is calculated from the used version control system and the available tags. For more details about versioning see https://github.com/IntershopCommunicationsAG/scmversion-gradle-plugin.
For all available parameters for publishing in a CI environment see Simple Publish Configuration Plugin in the readme of https://github.com/IntershopCommunicationsAG/gradle-release-plugins.
gradlew publish -PrunOnCI=true -PsnapshotURL=<URL for snapshots> -PreleaseURL=<URL for distribution releases> -PrepoUserName=<user with deploy permissions> -PrepoUserPasswd=<user password>
Make sure, that the sources are stored in a VCS!
This project uses the same configuration and parameters like the main shop project, see Recipe - Setup CI Build For Project Artifacts.
Set up an automated process for building the Oracle JDBC drivers component. Configure the process to:
Check out the sources of the component set from the VCS (<sources>/projects/oracleDriver/3rd_oracle) to the folder 3rd_oracle.
Note
It is possible to download the necessary files from the Oracle Maven repository. Therefore the OTN credentials are necessary:
Before you can use the credentials to download artifacts from this Oracle Maven repository, it is required to activate your account for this repository.
Execute the following commands:
cd 3rd_oracle export OTN_USER=<OTN user name> export OTN_PASSWD=<OTN user password> ./gradlew publish -PrepoUserName=<deployment user> -PrepoUserPasswd=<deployment user password> -PreleaseURL=<URL for release publishing>
cd 3rd_oracle set OTN_USER=<OTN user name> set OTN_PASSWD=<OTN user password> gradlew publish -PrepoUserName=<deployment user> -PrepoUserPasswd=<deployment user password> -PreleaseURL=<URL for release publishing>
It is also possible to specify environment variables for the parameter:
Parameter | Environment Variable |
---|---|
repoUserName | REPO_USER_NAME |
repoUserPasswd | REPO_USER_PASSWD |
releaseURL | RELEASEURL |
Before rebuilding the corporate distribution always increase the version number (located in <sources>/devops/gradle/corporate-distribution/gradle.properties). After rebuilding, change the version number in the wrapper configuration (gradle-wrapper.properties) of all your projects.
Before rebuilding the Oracle JDBC Drivers component set always increase the version or build number (located in <sources>/projects/oracleDriver/p_oracle/gradle.properties).
This example assumes that:
Create a new build item Corporate Distribution:
Parameter | Value | Description |
---|---|---|
Item name | corporate-distribution | The item name is also used for the directory path. Do not use spaces in this configuration. |
Build type | Build a free-style software project | |
Advanced Project Options | ||
- Display Name | Corporate Distribution | This is used for the item name on the web frontend |
Description | Creates a corporate distribution for the main project | |
Subversion | ||
General | ||
This project is parameterized | [selected] | |
Add Parameter | List Subversion tags (and more) | |
- Repository URL | http://ciserver/svn/intershop/devops/gradle/corporate-distribution/tags | Tags URL of the project project. |
- Credentials | Username / Password | |
- Tags filter | RELEASE_\d+\.\d+\.\d+-?(\S+)? | It is necessary to specify an other filter, if the prefix of the Gradle SCM Versioning plugin configuration is different. |
- Default value | [empty] | |
- Maximum tags to display | 3 | This is only an example. |
- Sort newest first | [selected] | |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/devops/gradle/corporate-distribution/tags/$TAGNAME | URL of the corporate distribution project |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | corporate-distribution | This is the target path in the workspace directory for the the Subversion checkout. |
- Check-out Strategy | Use 'svn upate' as much as possible | It is also possible to checkout always a new copy. |
Git | ||
General | ||
This project is parameterized | [selected] | |
Add Parameter | 'Git Parameter' | |
- Name | TAGNAME | |
- Description | Git tag name | optional |
- Parameter Type | Tag | |
- Advanced (Button) | [selected] | |
- Branch | [empty] | Used only if listing revisions. |
- Branch filter | [empty] | Optional; if release from a special branch will be build |
- Tag filter | RELEASE_* | |
- Sort mode | NONE | |
- Default Value | [empty] | |
- Selected value | TOP | |
- Quick filter | [not selected] | |
Source Code Management | Git | |
- Repository URL | https://<Git Server with path>/corporate-distribution.git | URL of the corporate distribution project |
- Branches to build | */master | |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Advanced (Button) | [selected] | |
- Branches to build | ${TAGNAME} | |
- Additional behaviors | 'Check out to a sub-directory' | |
Local subdirectory for repo | corporate-distribution | |
Build Triggers | [no selection] | |
Build Environment | ||
Inject passwords to the build as environment variables | [selected] | |
- - Properties Content | RUNONCI=true RELEASEURL= http://server:8081/nexus/content/repositories/distributions | |
- Global passwords | [selected] | Global configured password will be used. |
Build | Execute Shell / Execute Windows batch command | On a Linux server use Execute Shell. On Windows, it is necessary to select Execute Windows batch command. |
- Command (Linux) | Publish corporate distribution cd corporate-distribution ./gradlew publish -s | Before the build runs the old build should be deleted. Therefore, the target clean is also called.REPO_USER_NAME and REPO_USER_PASSWD are specified as global password. See setup CI Server example. |
- Command (Windows) | Publish corporate distribution cd corporate-distribution gradlew publish -s |
... :downloadGradle UP-TO-DATE :customGradleDistribution :generateDescriptorFileForIvyPublication :publishIvyPublicationToIvy Distribution RepositoryRepository Upload http://server:8081/nexus/content/repositories/distributions/gradle-dist/corporate_gradle_2.11/2.0.0/corporate_gradle_2.11-2.0.0-bin.zip Upload http://server:8081/nexus/content/repositories/distributions/gradle-dist/corporate_gradle_2.11/2.0.0/ivy.xml :publish BUILD SUCCESSFUL Total time: 6.927 secs This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.11/userguide/gradle_daemon.html Finished: SUCCESS
Corporate distribution in the artifact repository if using Nexus:
Create a new build item Oracle JDBC Driver component set:
Parameter | Value | Description |
---|---|---|
Item name | 3rd_oracle | The item name is also used for the directory path. Do not use spaces in this configuration. |
Advanced Project Options | ||
- Display Name | Oracle JDBC Driver component | This is used for the item name on the web frontend |
Build type | Build a free-style software project | |
Description | Create Oracle JDBC Driver component set | |
Subversion | ||
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/projects/oracleDriver/trunk/p_oracle | URL of the Oracle driver project |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | 3rd_oracle | This is the target path in the workspace directory for the the Subversion checkout. |
Git | ||
Source Code Management | Git | |
- Repository URL | https://<Git Server with path>/3rd_oracle.git | URL of the Oracle driver project |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Additional behaviors | 'Check out to a sub-directory' | |
Local subdirectory for repo | 3rd_oracle | |
Build Triggers | Poll SCM | |
- Schedule | H/15 * * * * | The build is triggered manually only. Before the build can be restarted, the module must be deleted from the artifact repository. |
Build Environment | ||
- Inject passwords to the build as environment variables | [selected] | Password will be defined for the environment |
- - Properties Content | RELEASEURL=http://server:8081/nexus/content/repositories/releases | |
- Global passwords | [selected] | Global configured password will be used |
- Job passwords | [selected] | Optional. Only necessary if the jar files must be downloaded. |
OTN_USER / <Username> | ||
OTN_PASSWD / <Userpassword> | ||
Build | Execute Shell / Execute Windows batch command | On a Linux server use Execute Shell. On Windows it is necessary to select Execute Windows batch command. |
- Command (Linux) | Publish release of p_oracle cd 3rd_oracle ./gradlew publish -s | Before the build runs the old build should be deleted. Therefore the target REPO_USER_NAME and REPO_USER_PASSWD were specified as global passwords. If artifacts must be downloaded from the Oracle Maven repository (see Process for Building the Oracle JDBC Drivers Component) it is necessary to declare OTN_USER and OTN_PASSWD as job passwords. The build script is generated with a default release URL from the build configuration (see Recipe - Create Sources From Intershop Templates). It is possible to define a release repository with an environment variable RELEASEREPO or a Java environment variable 'releaseRepo'. |
- Command (Windows) | Publish release of p_oracle cd 3rd_oracle gradlew publish -s |
... + cd 3rd_oracle + sh ./gradlew publish -s Defaults for 'test.corporatename' are used! The local artifacts are stored in /var/lib/jenkins/.gradle/.localRepo! :ojdbc7Download Invalid cookie header: "Set-Cookie: IntradocAuth=Basic; expires=Tue, 08 Aug 2017 16:15:48 GMT; path=/". Invalid 'expires' attribute: Tue, 08 Aug 2017 16:15:48 GMT Download https://www.oracle.com/content/secure/maven/content/com/oracle/jdbc/ojdbc7/12.1.0.2/ojdbc7-12.1.0.2.jar :onsDownload Invalid cookie header: "Set-Cookie: IntradocAuth=Basic; expires=Tue, 08 Aug 2017 16:15:53 GMT; path=/". Invalid 'expires' attribute: Tue, 08 Aug 2017 16:15:53 GMT Download https://www.oracle.com/content/secure/maven/content/com/oracle/jdbc/ons/12.1.0.2/ons-12.1.0.2.jar :ucpDownload Invalid cookie header: "Set-Cookie: IntradocAuth=Basic; expires=Tue, 08 Aug 2017 16:15:56 GMT; path=/". Invalid 'expires' attribute: Tue, 08 Aug 2017 16:15:56 GMT Download https://www.oracle.com/content/secure/maven/content/com/oracle/jdbc/ucp/12.1.0.2/ucp-12.1.0.2.jar :generateDescriptorFileForIvyPublication :publishIvyPublicationToIvyLocalRepository :publishIvyPublicationToIvyRepository Upload http://server:8081/nexus/content/repositories/releases/com.intershop/3rd_oracle/12.1.0.2.0.0/jars/ojdbc7-jar-12.1.0.2.0.0.jar Upload http://server:8081/nexus/content/repositories/releases/com.intershop/3rd_oracle/12.1.0.2.0.0/jars/ons-jar-12.1.0.2.0.0.jar Upload http://server:8081/nexus/content/repositories/releases/com.intershop/3rd_oracle/12.1.0.2.0.0/jars/ucp-jar-12.1.0.2.0.0.jar Upload http://server:8081/nexus/content/repositories/releases/com.intershop/3rd_oracle/12.1.0.2.0.0/ivys/ivy-12.1.0.2.0.0.xml :generatePomFileForMavenOJDBCPublication :publishMavenOJDBCPublicationToMavenLocalRepositoryCould not find metadata com.oracle.jdbc:ojdbc7/maven-metadata.xml in remote (file:/var/lib/jenkins/.gradle/.localRepo/) :generatePomFileForMavenONSPublication :publishMavenONSPublicationToMavenLocalRepositoryCould not find metadata com.oracle.jdbc:ons/maven-metadata.xml in remote (file:/var/lib/jenkins/.gradle/.localRepo/) :generatePomFileForMavenUCPPublication :publishMavenUCPPublicationToMavenLocalRepositoryCould not find metadata com.oracle.jdbc:ucp/maven-metadata.xml in remote (file:/var/lib/jenkins/.gradle/.localRepo/) :publish BUILD SUCCESSFUL Total time: 18.328 secs This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.11/userguide/gradle_daemon.html Finished: SUCCESS
Oracle JDBC Driver component set in the artifact repository if using Nexus:
After changes on the code base it is a good practice to run an integration build with all automatic tests to provide fast feedback for the developer team. Furthermore, it is necessary to check the impact of the changes on the initialization of the database.
How can an administrator or developer set up a continuous integration process for all project artifacts?
See the following recipes:
Example
See the discussion for an example using Jenkins.
Set up an automated process for a snapshot build of the specific Gradle multi project. Configure the process to:
Execute the following commands for a snapshot release:
export JAVA_HOME=<directory of JDK 1.8> export ENVIRONMENT_PROPS=<workspace directory>/host_configs/<name of executing host>/environment.properties cd <project name> ./gradlew clean dbinit check publish -PrunOnCI=true -PsnapshotURL=http://<url to nexus>/snapshots \ -PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS} --refresh-dependencies -s
set JAVA_HOME=<directory of JDK 1.8> set ENVIRONMENT_PROPS=<workspace directory>\host_configs\<name of executing host>\environment.properties cd <project name> gradlew clean dbinit check publish -PrunOnCI=true -PsnapshotURL=http://<url to nexus>/snapshots ^ -PbuildEnvironmentProperties="%ENVIRONMENT_PROPS%" -PtestEnvironmentProperties="%ENVIRONMENT_PROPS%" --refresh-dependencies -s
This process should be triggered automatically upon detecting changes in the VCS. This build uses also snapshot repositories for the build. The parameter enableSnapshots
is used by the Gradle plugin repoconfig-gradle-plugin (see https://github.com/IntershopCommunicationsAG/repoconfig-gradle-plugin).
If the Gradle SCM Versioning plugin is used, a build of a tag will always create a release. Without this plugin and a static specified version number it is possible to set the project property SNAPSHOT_RELEASE
to true so that a snapshot version will be created.
Set up an automated process for a release build of component set and assembly. Configure the process to:
Execute the following commands:
export JAVA_HOME=<directory of JDK 1.8> export ENVIRONMENT_PROPS=<workspace directory>/host_configs/<name of executing host>/environment.properties cd <project name> ./gradlew clean dbinit check publish -PreleaseWithDump=true -PrunOnCI=true -PreleaseURL=http://<url to nexus>/releases \ -PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS} --refresh-dependencies -s
set JAVA_HOME=<directory of JDK 1.8> set ENVIRONMENT_PROPS=<workspace directory>\host_configs\<name of executing host>\environment.properties cd <project name> gradlew clean dbinit check publish -PreleaseWithDump=true -PrunOnCI=true -PreleaseURL=http://<url to nexus>/releases ^ -PbuildEnvironmentProperties="%ENVIRONMENT_PROPS%" -PtestEnvironmentProperties="%ENVIRONMENT_PROPS%" --refresh-dependencies -s
If you run the build configuration with the Gradle SCM Versioning plugin, the process should be triggered manually or the build job must be configured only for tags.
Intershop provides a public Gradle plugin com.intershop.gradle.scmversion for the version configuration. This plugin calculates the version from the VCS and supports Subversion and Git. For more information see https://github.com/IntershopCommunicationsAG/scmversion-gradle-plugin.
It is also possible to specify a static version in the gradle.properties. For this use case it is necessary to add the project property snapshotRelease
or the environment property SNAPSHOT_RELEASE
to the command-line for the build of a snapshot.
For a fast developer feedback we suggest to use snapshot builds.
The result of these build steps represents a temporary status. It is not possible to deploy this on a server for further testing (see section Release Build below).
The feedback time after changes depends on the performance of the build machine, the database, and the amount of data (products, catalogs, customer) for the database initialization.
For the snapshot process it is possible to publish the artifacts to a local file based repository like a developer, but this makes it impossible to distribute processes over different machines.
It is also possible to use only the release process and instead of this to run the release process more often. In this case more artifacts will be published to the artifact repository and a clean up process is necessary.
The release build runs manually on request. If the SCM version plugin is used, it can also run after the creation of a release tag automatically. All project artifacts of this release use the same version. This kind of build can be used for the installation on the integration machine or for long running manual tests.
It is possible to run a temporary installation based on the snapshot build, but it is not possible to reproduce this build result. The result of a release build is reproducible. For the storage of this build information, the init.script contains a task writeBuildInformation
. This information can be used for hand over to the next processes or for build documentation. It is also possible to extend this script.
For more information see https://github.com/IntershopCommunicationsAG/gradle-release-plugins.
Publish parameters can be provided as project properties or as environment variables.
This example assumes that:
Parameter | Value |
---|---|
Name | environment.properties |
Comment | environment setting for deploying a test server during the build on 'machine' |
Content |
# ID of the platform to deploy on (must match the actual OS/distribution for the tests to be successful) # ID of the deployed server instance # Set environment for your deployment: production, test, development ... webAdapterSharedMemoryKey = 0x2001 |
There is no possibility to use this file from the VCS with the Config File Provider Plugin. Furthermore it is not so easy to checkout files from the Git provider in two different sub directories.
Create a new build item Project Snapshot:
Parameter | Value | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Item name | corporateshop | The item name is also used for the directory path. Do not use spaces in this configuration. | ||||||||||
Build type | Build a free-style software project | |||||||||||
Advanced Project Options | ||||||||||||
- Display Name | corporateshop - Snapshot Builds | This is used for the item name on the web front end. | ||||||||||
Description | Create a snapshot build of the project "corporateshop" | |||||||||||
Subversion | ||||||||||||
Source Code Management | Subversion | |||||||||||
- Repository URL | http://ciserver/svn/intershop/projects/corporateshop/trunk | URL of the project | ||||||||||
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. | ||||||||||
- Local module directory | corporateshop | This is the target path in the workspace directory for the the Subversion checkout. | ||||||||||
Git | ||||||||||||
Source Code Management | Git | |||||||||||
- Repository URL | https://gitserver/<path>/corporateshop.git | |||||||||||
- Credentials | Username / Password | |||||||||||
- Additional Behaviours | Check out to a sub-directory | |||||||||||
Local subdirectory for repo | corporateshop | |||||||||||
Build Triggers | Poll SCM | |||||||||||
- Schedule | H/5 * * * * | The job will check the VCS for changes every 5 minutes. | ||||||||||
Build Environment | ||||||||||||
- Inject environment variables to the build process | [selected] | |||||||||||
- - Properties Content | RUNONCI=true SNAPSHOTURL=http://server:8081/nexus/content/repositories/snapshots | |||||||||||
- Inject passwords to the build as environment variables | [selected] | |||||||||||
-- Global passwords | [selected] | Global configured password will be used. | ||||||||||
Build | ||||||||||||
- Provide Configuration files |
| |||||||||||
- Command (Linux) Execute Shell | Publish snapshot of component set export JAVA_HOME=/usr/java/jdk1.8.0 cd corporateshop ./gradlew clean dbinit check publish \ --refresh-dependencies \ -PbuildEnvironmentProperties="${ENVIRONMENT_PROPS}" \ -PtestEnvironmentProperties="${ENVIRONMENT_PROPS}" -s | Change to the project folder. REPO_USER_NAME and REPO_USER_PASSWD are specified as global password. | ||||||||||
- Command (Windows) Execute Windows batch | Publish snapshot of component set set JAVA_HOME=c:/<path to JDK 1.8.0> cd corporateshop gradlew clean dbinit check publish ^ --refresh-dependencies ^ -PbuildEnvironmentProperties="${ENVIRONMENT_PROPS}" ^ -PtestEnvironmentProperties="${ENVIRONMENT_PROPS}" -s |
Defaults for 'test.corporatename' are used! The local artifacts are stored in /var/lib/jenkins/.gradle/.localRepo! Parallel execution with configuration on demand is an incubating feature. All tasks will be executed on a CI build environment. It is not possible to identify the correct version. The default value 3.0.0 will be u ... :assembly_corporateshop:remoteTest :assembly_corporateshop:check :assembly_corporateshop:build :assembly_corporateshop:generateSampleSettingsGradle :assembly_corporateshop:packSamples :assembly_corporateshop:publishBuildAssemblyPublicationToIntershopIvyCIRepository SKIPPED :assembly_corporateshop:publishBuildAssemblyPublicationToIvyLocalRepository SKIPPED :assembly_corporateshop:publishBuildAssemblyPublicationToTestRepository SKIPPED :assembly_corporateshop:publishIvyPublicationToBuildRepository SKIPPED :assembly_corporateshop:publishIvyPublicationToIntershopIvyCIRepository Upload http://server:8081/nexus/content/repositories/snapshots/com.company.corporateshop/assembly_corporateshop/3.0.0-SNAPSHOT/gradles/deploy-deploy-gradle-3.0.0-SNAPSHOT.gradle Upload http://server:8081/nexus/content/repositories/snapshots/com.company.corporateshop/assembly_corporateshop/3.0.0-SNAPSHOT/gradles/deploy-settings-deploy-settings-gradle-3.0.0-SNAPSHOT.gradle Upload http://server:8081/nexus/content/repositories/snapshots/com.company.corporateshop/assembly_corporateshop/3.0.0-SNAPSHOT/ivys/ivy-3.0.0-SNAPSHOT.xml :assembly_corporateshop:publishIvyPublicationToIvyLocalRepository :assembly_corporateshop:publishIvyPublicationToTestRepository SKIPPED :assembly_corporateshop:publishTestAssemblyPublicationToBuildRepository SKIPPED :assembly_corporateshop:publishTestAssemblyPublicationToIntershopIvyCIRepository SKIPPED :assembly_corporateshop:publishTestAssemblyPublicationToIvyLocalRepository SKIPPED :assembly_corporateshop:publishTestAssemblyPublicationToTestRepository :assembly_corporateshop:publish BUILD SUCCESSFUL Total time: 1 hrs 4 mins 29.677 secs This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.11/userguide/gradle_daemon.html Finished: SUCCESS
Jenkins overview page:
For a better overview of the existing projects in Jenkins separate tabs Project Builds and Corporate Builds were created. The duration of the assembly build depends on the performance of the build machine and the database.
This is an example for a parameterized build. It expects always a created tag in the VCS.
Note
The used Git Parameter Plugin needs a cloned repository in the work space. Therefore it is necessary to configure first the project without parameters and without a build step. After the first run, the work space is created and a clone of the specified repository is available.
Create a new build item Release corporateshop_release:
Parameter | Value | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Item name | corporateshop_release | The item name is also used for the directory path. Do not use spaces in this configuration. | ||||||||||
Build type | Build a free-style software project | |||||||||||
Advanced Project Options | ||||||||||||
- Display Name | corporateshop - Release Builds | This is used for the item name on the web front end. | ||||||||||
Description | Create the release of all artifacts of the "corporateshop" project. | |||||||||||
Subversion | ||||||||||||
General | ||||||||||||
This project is parameterized | [selected] | |||||||||||
Add Parameter | List Subversion tags (and more) | |||||||||||
- Name | TAGNAME | |||||||||||
- Repository URL | http://ciserver/svn/intershop/projects/corporateshop/tags | Tags URL of the project project. | ||||||||||
- Credentials | Username / Password | |||||||||||
- Tags filter | RELEASE_\d+\.\d+\.\d+-?(\S+)? | It is necessary to specify an other filter, if the prefix of the Gradle SCM Versioning plugin configuration is different. | ||||||||||
- Default value | [empty] | |||||||||||
- Maximum tags to display | 3 | This is only an example. | ||||||||||
- Sort newest first | [selected] | |||||||||||
Source Code Management | Subversion | |||||||||||
- Repository URL | http://ciserver/svn/intershop/projects/corporateshop/tags/$TAGNAME | URL of the project project. | ||||||||||
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. | ||||||||||
- Local module directory | corporateshop | This is the target path in the workspace directory for the the Subversion checkout. | ||||||||||
Git | ||||||||||||
General | ||||||||||||
This project is parameterized | [selected] | |||||||||||
Add Parameter | 'Git Parameter' | |||||||||||
- Name | TAGNAME | |||||||||||
- Description | Git tag name | optional | ||||||||||
- Parameter Type | Tag | |||||||||||
- Advanced (Button) | [selected] | |||||||||||
- Branch | [empty] | Used only if listing revisions. | ||||||||||
- Branch filter | [empty] | Optional, used if a release from a special branch will be build. | ||||||||||
- Tag filter | RELEASE_* | |||||||||||
- Sort mode | NONE | |||||||||||
- Default Value | [empty] | |||||||||||
- Selected value | TOP | |||||||||||
- Quick filter | [not selected] | |||||||||||
Source Code Management | Git | |||||||||||
- Repository URL | https://gitserver/<path>/corporateshop.git | URL of the project assembly | ||||||||||
- Credentials | Username / Password | Select user and password. | ||||||||||
- Advanced (Button) | [selected] | |||||||||||
- Branches to build | ${TAGNAME} | |||||||||||
- Additional Behaviours | Check out to a sub-directory | |||||||||||
Local subdirectory for repo | corporateshop | |||||||||||
Build Triggers | [not selected] | |||||||||||
Build Environment | ||||||||||||
- Inject environment variables to the build process | [selected] | |||||||||||
- - Properties Content | RUNONCI=true RELEASEURL= http://server:8081/nexus/content/repositories/releases | |||||||||||
- Inject passwords to the build as environment variables | [selected] | |||||||||||
-- Global passwords | [selected] | Global configured password will be used. | ||||||||||
Build | ||||||||||||
- Provide Configuration files |
| |||||||||||
- Command (Linux) Execute Shell | Publish release build of component set export JAVA_HOME=/usr/java/jdk1.8.0 cd corporateshop ./gradlew clean dbinit check publish \ -PreleaseWithDump=true --refresh-dependencies \ -PbuildEnvironmentProperties="${ENVIRONMENT_PROPS}" \ -PtestEnvironmentProperties="${ENVIRONMENT_PROPS}" -s | Change to the project folder. REPO_USER_NAME and REPO_USER_PASSWD are specified as global password. | ||||||||||
- Command (Windows) Execute Windows batch | Publish release build of component set set JAVA_HOME=c:/<path to JDK 1.8.0> cd corporateshop gradlew clean dbinit check publish ^ -PreleaseWithDump=true --refresh-dependencies ^ -PbuildEnvironmentProperties="${ENVIRONMENT_PROPS}" ^ -PtestEnvironmentProperties="${ENVIRONMENT_PROPS}" -s |
For the creation of a build select Build with Parameters. In the following dialog it is possible to specify the tag name.
... + sh ./gradlew clean dbinit check publish --refresh-dependencies -PreleaseWithDump=true -PbuildEnvironmentProperties=/var/lib/jenkins/workspace/corporateshop_release@tmp/config340512709915159000tmp -PtestEnvironmentProperties=/var/lib/jenkins/workspace/corporateshop_release@tmp/config340512709915159000tmp -s Defaults for 'test.corporatename' are used! The local artifacts are stored in /var/lib/jenkins/.gradle/.localRepo! Parallel execution with configuration on demand is an incubating feature. All tasks will be executed on a CI build environment. Buildinfo task will be executed on a CI build environment for corporateshop. Buildinfo task will be executed on a CI build environment for app_sf_responsive. The included ResourceListPlugin is deprecated! Please apply the new plugin com.intershop.gradle.cartridge-resourcelist (https://github.com/IntershopCommunicationsAG/resourcelist-gradle-plugin) Buildinfo task will be executed on a CI build environment for app_sf_responsive_b2b ... :demo_responsive_search:build :dev_storefront:isml :dev_storefront:assemble :dev_storefront:check UP-TO-DATE :dev_storefront:build :publish UP-TO-DATE :app_sf_responsive_b2b:publishIvyPublicationToIntershopIvyCIRepository Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/app_sf_responsive_b2b/3.1.0/zips/app_sf_responsive_b2b-share-3.1.0.zip Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/app_sf_responsive_b2b/3.1.0/jars/app_sf_responsive_b2b-jar-3.1.0.jar Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/app_sf_responsive_b2b/3.1.0/zips/app_sf_responsive_b2b-cartridge-3.1.0.zip Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/app_sf_responsive_b2b/3.1.0/ivys/ivy-3.1.0.xml :app_sf_responsive_b2b:publishIvyPublicationToIvyLocalRepository :app_sf_responsive_b2b:publish ... :assembly_corporateshop:deployServer Execute 'deploy' Initialization script '/var/lib/jenkins/workspace/corporateshop_release/corporateshop/build/build-repo/build-repository.gradle': line 20 Defaults for test.corporatename are used for inject repositories! Defaults for 'test.corporatename' are used! The local artifacts are stored in /var/lib/jenkins/.gradle/.localRepo! SID-based database configuration is deprecated, prefer to use service name instead No usage of well-known ports detected. HTTPd binary will be run by jenkins. :3rd_ant:deployDirectories UP-TO-DATE :3rd_apache:deployDirectories :3rd_oracle:deployDirectories ... :assembly_corporateshop:build :assembly_corporateshop:generateSampleSettingsGradle :assembly_corporateshop:packSamples :assembly_corporateshop:publishBuildAssemblyPublicationToIntershopIvyCIRepository SKIPPED :assembly_corporateshop:publishBuildAssemblyPublicationToIvyLocalRepository SKIPPED :assembly_corporateshop:publishBuildAssemblyPublicationToTestRepository SKIPPED :assembly_corporateshop:packBranding :assembly_corporateshop:packEncryptionConfig :assembly_corporateshop:publishIvyPublicationToBuildRepository SKIPPED :assembly_corporateshop:publishIvyPublicationToIntershopIvyCIRepository Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/assembly_corporateshop/3.1.0/dmps/database-dump-dump-3.1.0.dmp Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/assembly_corporateshop/3.1.0/zips/encryption-config-encryption-config-3.1.0.zip Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/assembly_corporateshop/3.1.0/zips/branding-share-3.1.0.zip Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/assembly_corporateshop/3.1.0/gradles/deploy-deploy-gradle-3.1.0.gradle Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/assembly_corporateshop/3.1.0/gradles/deploy-settings-deploy-settings-gradle-3.1.0.gradle Upload http://server:8081/nexus/content/repositories/releases/com.company.corporateshop/assembly_corporateshop/3.1.0/ivys/ivy-3.1.0.xml :assembly_corporateshop:publishIvyPublicationToIvyLocalRepository :assembly_corporateshop:publishIvyPublicationToTestRepository SKIPPED :assembly_corporateshop:publishTestAssemblyPublicationToBuildRepository SKIPPED :assembly_corporateshop:publishTestAssemblyPublicationToIntershopIvyCIRepository SKIPPED :assembly_corporateshop:publishTestAssemblyPublicationToIvyLocalRepository SKIPPED :assembly_corporateshop:publishTestAssemblyPublicationToTestRepository :assembly_corporateshop:publish BUILD SUCCESSFUL Total time: 1 hrs 6 mins 54.656 secs This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.11/userguide/gradle_daemon.html Finished: SUCCESS
Release artifacts are stored in the repository:
That is the final Jenkins overview page:
If the repository is accessible over the public internet, it is necessary to configure the security of the repository.
Once you have configured the basic repository, the following configuration for the repository is required.
Add the target privileges.
Name | Description | Repository | Repository Target |
---|---|---|---|
Distributions | Target Privilege Distributions | Distributions (Repo) | All (Maven 2) |
Components | Target Privilege Components | Components (Group) | All (Maven 2) |
Releases | Target Privilege Releases | Releases (Repo) | All (Maven 2) |
Intershop | Target Privilege Intershop Releases | Intershop (Repo) | All (Maven 2) |
Snapshots | Target Privilege Snapshots | Snapshots (Repo) | All (Maven 2) |
Central | Target Privilege Central | Central (Repo) | All (Maven 2) |
JCenter | Target Privilege JCenter | JCenter (Repo) | All (Maven 2) |
Add the role configuration and finish this configuration with Save.
Role ID | Name | Role/Privilege Management |
---|---|---|
maven2-distributions-read | Role: Distributions (read) | Distributions - (read) Distributions - (view) |
maven2-components-read | Role: Components (read) | Components - (read) Components - (view) |
maven2-snapshots-read | Role: Snapshots (read) | Snapshots - (read) Snapshots - (view) |
maven2-central-read | Role: Central (read) | Central - (read) Central - (view) |
maven2-jcenter-read | Role: JCenter (read) | JCenter - (read) JCenter - (view) |
maven2-projectbuilds-full | Role: Projectbuilds (full) | Releases - (create) Releases - (delete) Releases - (read) Releases - (update) Releases - (view) Snapshots - (create) Snapshots - (delete) Snapshots - (read) Snapshots - (update) Snapshots - (view) |
maven2-ishrepo-full | Role: Intershop (read) | Intershop - (read) Intershop - (view) |
Add the role configuration for a project developer and finish this configuration with Save.
Role ID | Name | Role/Privilege Management |
---|---|---|
nexus-project-developer | Project Developer | Nexus Developer Role Role: Distributions (read) Role: Components (read) Role: Maven all (read) Role: Snapshots (read) Role: Central (read) |
Instead of separate roles for the repositories, it also possible to use Repo: All Maven2 Repositories (View) and Repo: All Maven2 Repositories (Read).
Add the role configuration for a project deployment user and finish this configuration with Save.
Role ID | Name | Role/Privilege Management |
---|---|---|
nexus-project-deployment | Project Deployment User | Nexus Deployment Role |
The role Project Developer is used to ensure that Project Deployment Users have the same repositories available as developers.
Add a role for a special deployment user.
For special artifacts, such as Intershop releases or Gradle artifacts (distribution, plugins), it is possible to create a special deployment user.
Add the role configuration for a special deployment user and finish this configuration with Save.
Role ID | Name | Role/Privilege Management |
---|---|---|
nexus-intershop-deployment | Intershop Deployment User | Nexus Deployment Role Role: Gradle (full) Role: Intershop Releases (full) |
Specify the configuration and finish the configuration with Save.
Property | Value |
---|---|
User ID (Login) | corp_deployment |
<admin account of this user> | |
Status | Active |
Password | <password for all processes> |
Role Management | Intershop Deployment User |
Specify the configuration and finish the configuration with Save.
Property | Value |
---|---|
User ID (Login) | prj_deployment |
<admin account of this user> | |
Status | Active |
Password | <password for all processes> |
Role Management | Project Deployment User |
Specify the configuration and finish the configuration with Save.
Property | Value |
---|---|
User ID (Login) | <developer account login> |
<email of the user> | |
Status | Active |
Password | <password> |
Role Management | Project Developer |
It is necessary to extend the local gradle.properties or the environment settings with the necessary credentials.
Build and Deployment on CI Server
Process | |
---|---|
| For this task it is necessary to use the deployment user for corporate artifacts. User name and password is part of the command line. Example gradlew clean publish -PrepoUserName=corp_deployment -PrepoUserPasswd=<passwd> |
| The result of the build will be published to the releases repository. Therefore, it is necessary to use the project deployment user. Example cd p_oracle set OTN_USER=<OTN user name> set OTN_PASSWD=<OTN user password> gradlew publish -PrepoUserName=prj_deployment -PrepoUserPasswd=<password> -PreleaseURL=<URL for release publishing> |
| The result of the build will be published to the releases or snapshots repository. Therefore, it is necessary to use the project deployment user. But this process needs also read access to other repositories. Example // this configuration is necessary for the read access as well for publishing export REPO_USER_NAME=prj_deployment export REPO_USER_PASSWD=<deploy user password> // Project properties will be used for the write access export JAVA_HOME=<directory of JDK 1.8> set ENVIRONMENT_PROPS=<workspace directory>\host_configs\<name of executing host>\environment.properties cd <project name> gradlew clean check publish startWebserver startNodemanager remoteTest -PreleaseWithDump=true -PrunOnCI=true ^ -PreleaseURL=http://<url to nexus>/releases -PbuildEnvironmentProperties="%ENVIRONMENT_PROPS%" ^ -PtestEnvironmentProperties="%ENVIRONMENT_PROPS%" --refresh-dependencies -s |
Build and Deployment on Development Machine
The developer can also specify the user name and password on the command line or as an environment variable. But this is not really user friendly.
It is possible to add the login credentials in the gradle.properties of the Gradle user home.
systemProp.repoUserName = <developer account login> systemProp.repoUserPasswd = <developer account password>
User names and passwords are sent to the repository server for authentication. For security reasons, the transport should be secured. Therefore, it is necessary to configure HTTPS for the server communication. It is recommended to use a certificate created by a certification authority. For private certificates, it is necessary to import them in the key-store of the used JDK. This must be done on all machines that have access to the repository -- developer, build, test and production machines also.
User names and passwords of users must be stored as plain text on the developer machine as well as on the build machine. This login and password can be used also for logging in to the repository server directly. So it is also possible to change the password this way.
Sonatype also provides a professional version of Nexus with costs. This version can use special tokens for the build and deployment access to the repository. It is not possible to log in to the server with these credentials.
If the connection between the repository server on the development side and the production environment is bad or there is an additional development or test team, it is necessary to set up a proxy repository chain.
How can an administrator set up a second repository?
See the following recipes:
Follow the installation steps in Recipe - Configure Artifact Repository Server except the configuration of the proxy repository to Intershop (ishrepo
).
Create a proxy repository to the repositories ishrepo
and releases
.
Name | ID | Repository Type | Remote Storage Location | Format | Remarks |
---|---|---|---|---|---|
Intershop Repository on A | ishrepoproxy | Proxy | http[s]://<hostname of A>/nexus/content/repositories/releases | Maven2 | Depending on the security configuration it is necessary to configure the authentication for the connection. |
Releases Repository on A | releasesproxy | Proxy | http[s]://< hostname of A>/nexus/content/repositories/ishrepo | Maven2 |
"A" is the placeholder for the name of the location of the first repository server.
The following repository forms a repository group of different repositories. There are hosted repositories as well as the proxy repositories there. Create it according to the following table:
Name | ID | Repository Type | Format | Repository IDs |
---|---|---|---|---|
Components | components | group | Maven2 | Releases, Intershop Repository on A , Releases Repository on A , JCenter, Central |
Once you created the new repository group, switch to the configuration tab an move the needed repository from Available Repositories to Ordered Group Repositories.
Note
The order of the assigned repositories is very important.
Run the following command:
./gradlew createCorporateDistribution createDeploymentConfig
Store the sources of deployments/ corporateshop
and gradle/ corporate-distribution
in a version control system.
For more detailed information see Recipe - Create Sources From Intershop Templates.
Execute the command:
gradlew clean publish -DREPO_USER_NAME=<deploy user login> -DREPO_USER_PASSWD=<deploy user password>
For more information see Recipe: Set up CI Build for Corporate Artifacts.
The corporate distribution is used in the deployment configuration. It is a standard Gradle distribution with included repository configurations. Therefore it is necessary to have an own corporate distribution for the environment of the new proxy repository.
If you want to extend the delivery from the location "A", it is necessary to set up an own CI environment. In this case you have to create more template sources and a setup of a CI server is necessary.