Document Properties
Kbid
258Y77
Last Modified
15-Mar-2024
Added to KB
22-Jul-2014
Public Access
Everyone
Status
Online
Doc Type
Cookbooks
Product
Gradle Tools
Cookbook - Setup of CI Infrastructure (valid to GradleTools 2.1)

Introduction

This document describes the setup and configuration of the base processes in a CI environment. 

Note

This cookbook requires Intershop Gradle tools version 2.0.

How deal with the Intershop Gradle tools 1.x for a previous Intershop version is described here: Cookbook - Setup of CI Infrastructure (valid to GradleTools 1.1).

For version 2.3 of the Intershop Gradle tools, please refer to Cookbook - Setup of CI Infrastructure (valid to Gradle Tools 2.3).

For version 2.7 of the Intershop Gradle tools, please refer to Cookbook - Setup of CI Infrastructure (valid to Gradle Tools 2.7).

The Intershop Gradle tools and this document make no strong assumptions about, which artifact repository server, continuous integration server (CI server) or version control system (VCS) are used. This cookbook contains examples for using Sonatype Nexus, Jenkins and Subversion (SVN).

Note

The recipes in this cookbook are made for a specific ICM version in combination with specific Intershop Gradle Tools.

Since the bootstrap of the Intershop Gradle Tools defines your project's directory structure and different versions of the Intershop Gradle Tools differ regarding their plugins you have to 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:


This is an overview of all necessary components:

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.

  1. Prepare the necessary server for the process
    1. Artifact repository server (see recipe Configure Artifact Repository Server)
      This recipe describes the setup of an artifact repository based on Sonatype Nexus. 
    2. CI Server (see recipe Configure CI Server)
      This description is based on Jenkins.
    3. Version Control System
      All examples and descriptions are based on Apache Subversion. Intershop does not require any special configurations on this server.
  2. Import Intershop delivery (see recipe Import Intershop Delivery)
    Intershop provides their software packages in a file based repository. For further steps it is necessary to import them into a remote artifact repository. The import tool is also provided with the delivery.
  3. Generate Sources/Configuration (see recipe Create Sources From Intershop Templates)
    For the build processes of Intershop special source artifacts are necessary. Intershop provides the possibility to generate these sources from templates.
  4. Setup CI Process for Corporate Artifacts (see recipe Setup CI Build for Corporate Artifacts)
    This recipe describes how to build artifacts on the CI server only needed once per environment.
  5. Setup CI Process for Project Artifacts (see recipe Setup CI Build for Corporate Artifacts)
    This recipe describes how to build artifacts on the CI server needed separately for each project.
  6. Setup a developer environment (see recipe Setup Developer Environment in cookbook Gradle Developer Workflow)
    This document describes the setup steps on a developer machine. This can be done by the developer self, but it is also possible to provide VMs for the project developers.

Glossary

PhraseMeaning
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 AnalysisProcess to analyze source code to calculate metrics, find bugs, etc.
Continuous Delivery PipelineSometimes called Deployment Pipeline, describes the stages, which code artifacts runs through source to production system.
System ComponentA software package of different code artifacts and files, that have to be deployed together.
System Component SetIs a container for system components, that needs to be build and branched together.
AssemblyAn 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 ProcessCompiles and packages files and code artifacts from a source project to deployable artifacts.
Publish ProcessThe process which transfers the deployable artifacts to a configured artifact repository.
Assembly ProcessThis process combines several system components to an assembly.
Deployment ProcessThis process extracts files and code artifacts from an artifact repository and applies the configuration.
Project Gradle DistributionThis is a customized Gradle distribution with the preconfigured artifact repositories and Gradle plugins.
Gradle PluginA Gradle plugin packages up reusable pieces of build logic, which can be used across many different projects and builds.
Project Gradle PluginThis is a Gradle plugin which contains special corporate respectively project settings.
Corporate PluginThe term is used as a synonym for Project Gradle Plugin.
Gradle Extension ObjectJava Bean compliant class holding configurations for Gradle plugins.
Gradle WrapperThe 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 ClusterA number of hosts of different types serving an Intershop 7.
Cluster NodeOne separately deployable part of an Intershop cluster. A host can run multiple nodes of one Intershop cluster.

References

Recipe: Configure Artifact Repository Server

Problem

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.

Which artifact repository servers are available and which configuration is required to run the Intershop build, assembly and deployment tools?

Solution

Supported Servers

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.

Configuration Steps

Choose an artifact repository server and perform the following steps:

  1. Install a repository server according to the vendors documentation.
  2. 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:

    IDUsage
    centralFor Maven artifacts available from Maven Central. Ideally, this is set up as a proxy to Maven Central, that caches all already retrieved artifacts.
    distributionsRepository for Gradle distributions.
    gradleFor corporate/ project Gradle configuration.
    releasesFor corporate/ project releases.
    ishreleasesFor all artifacts released by Intershop.
    snapshotsFor all artifacts from snapshot builds. This is the only repository that should allow overwriting of existing artifacts with the same name and version.
  3. Configure permissions:
    1. All users should have read access to all repositories of the project (Intershop Releases, Releases, Gradle, Snapshots, Central and Distributions).
    2. At least one user must be granted with permissions to publish new artifacts. (In some repository servers publishing is called "deploying" instead.)

Discussion

Example Using Sonatype Nexus

Download and install Sonatype Nexus:

This is the overview of available repositories in an installation before any changes:

The following repositories are necessary for all build and deployment processes:

Proxy Repositories

NameIDRepostiory TypeRemote Storage Location
CentralcentralProxyhttp://repo1.maven.org/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 repositories 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!

Hosted Repositories

NameIDRepository TypeRepository PolicyDeployment PolicyUsage
DistributionsdistributionshostedReleaseDisable Redeployfor project Gradle distribution
GradlegradlehostedReleaseDisable Redeployfor project Gradle plugins
ReleasesreleaseshostedReleaseDisable Redeployfor corporate / project releases
Intershop ReleasesishreleaseshostedReleaseDisable Redeployfor all released artifacts of Intershop
SnapshotssnapshotshostedSnapshotAllow Redeployfor all artifacts from snapshot builds

User, Roles and Permissions

In our example we use the default admin user with the default password.

To create a deploy user:

  1. Create Role "Project Upload" with the following roles and privileges:
    Nexus Deployment Role, All Repositories (create, read, update, view), Artifact Download, Artifact Upload
  2. Create User "deploy" and assign the new role.

Summary

The format of all hosted and proxy repositories is always Maven 2. The ID is case sensitive, because this part of the URL.

It is necessary to configure these repositories in your artifact repository installation. After the configuration the following URLs are available:

NameURL
Centralhttp://<Hostname:Port>/nexus/content/repositories/central
Distributionshttp://<Hostname:Port>/nexus/content/repositories/distributions
Gradlehttp://<Hostname:Port>/nexus/content/repositories/gradle
Releaseshttp://<Hostname:Port>/nexus/content/repositories/releases
Intershop Releaseshttp://<Hostname:Port>/nexus/content/repositories/ishreleases
Snapshotshttp://<Hostname:Port>/nexus/content/repositories/snapshots

This is the overview page after the changes:

Recipe: Configure CI Server

Problem

For the automatic execution of all build process 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?

Solution

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:

  • Undistributed: All processes are running on one single machine.
  • Distributed: Component set builds, assembly builds, integration and the demo servers will be started on different bare metal machines or VMs.

Example

 See the discussion for an example using Jenkins.

Prerequisites

Hardware requirements for server processes

  • Each active build of a component set process needs approx 1GB RAM and one CPU.
  • An assembly build needs approx two CPUs and approx 3GB RAM.
  • A single INTERSHOP instance requires in minimum two CPUs and approx 4GB RAM.
  • The space on the hard disc depends on the size of the custom component set.

Software requirements for server processes

  • The hosts (server and remote-agent) are part of the CI Environment and need to perform build- and deployment-tasks. They must meet minimum software requirements.
  • Oracle JDK must be installed for Jenkins and all other processes (See also requirements of the used Intershop version)

Database

  • For each assembly build, integration and demo server a database schema is necessary. The sizes of the table spaces depends on the amount of the init data of the custom extension.

Steps

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.

  1. Install a CI server according to the vendors documentation.
  2. Configure permissions to the servers in the CI Infrastructure, that are:
    1. VCS read credentials – server needs read privilege
    2. Artifact repository credentials – the user with permission to publish new artifacts (see Recipe: Configure Artifact Repository Server > Configure permissions)

(optional)

  1. For long running processes and also for demo and integration test machines it is recommended to use external agents. It is also possible to use ssh scripts and commands for the access to external machines if the usage of agents is limited.
  2. For a faster analysis of some automatic build steps it is helpful to have a web front end for your VCS. The most CI servers provide a support for this kind of interfaces.
  3. Special tasks like assembly builds, the setup of the integration server and the demo servers should run on different bare metal machines or VMs.

Folder for Additional Build Directories

Gradle uses a directory for caches and it is also possible to store in this directory additional configuration files. 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 on the CI server this directory for a special publishing configuration. 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.

Discussion

Example using Jenkins

Download and Install Jenkins:

You may follow the instructions from https://wiki.jenkins-ci.org/display/JENKINS/Use+Jenkins.

Plugin Recommendations

After the server is started, you should change the admin password. Furthermore it is necessary to activate the following set of plugins:

Plugin
Description
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.

  • Triggers - Select the conditions that should cause an email notification to be sent.
  • Content - Specify the content of each triggered email's subject and body.  
  • Recipients - Specify who should receive an email when it is triggered.
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.

Build Environment PluginThis plugin shows information about the environment of a build and gives the option to compare the environments of two builds.
All Changes Plugin

Shows all changes which influenced the builds of a project.

  • Shows changes by dependent builds (via fingerprinting)
  • Shows changes by subprojects added via a BuildStep from the parameterized-trigger-plugin
EnvInject 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.

Configuration Hints

It is necessary to add / change the following configuration settings:

  1. JDK
    1. Login with an admin account.
    2. Select Manage Jenkins.
    3. Select Configure System.
    4. Adapt the JDK configuration.
  2. Subversion (or SCM - Source Code Management)
    1. Select the preferred Subversion version.
  3. E-mail Notification and Extended E-mail Notification
    1.  Set SMTP server:
    2. Add default recipients:
  4. Add global property:

    VariableValue Linux
    BASE_GRADLE_USER_HOME/opt/intershop/build
  5. Add global password for deployment user (see Recipe: Configure Artifact Repository Server > User, Roles and Permissions)

    1. Go to Manage Jenkins | Configure Systems.
    2. Select Global Passwords | Add.
    3. Add password.

      NameDEPLOY_USER_PASSWORD
      Passworde.g., admin123

Recipe: Import Intershop Delivery

Problem

Intershop delivers a file system based repository of Intershop 7, Intershop 7 services (e.g., payment) and extensions (e.g., Contact Center). These repositories must be imported in one central remote artifact repository. This remote repository can be used in all phases of the project.

How can I import an Intershop delivery package as an administrator in my own remote repository?

Solution

Prerequisites

See the following recipe:

Steps

  1. Unzip delivery package in a temporary directory on a workstation.

    Example unzip commands
    // delivery of the main package
    unzip Intershop-7.5.0.0.20140801200015.zip -d <temporary path>
    // delivery of a payment service
    unzip paypal-2.3.1.0.20140625191501.zip -d <temporary path>
  2. Open import.properties in the root directory of the unpacked delivery in an editor. Set the property target.repo.url to <repository base URI>/ishreleases.

    Example of import.properties
    # import properties of Intershop artifacts
    # These are the settings for the target repository.
    #
    # URL of the repository for Intershop releases
    # example:
    # 	target.repo.url = http://hostname:port/nexus/content/repositories/ishreleases
    
    target.repo.url = http://<artifactrepository-server>/nexus/content/repositories/ishreleases
  3. Run import in the root directory of the unpacked delivery:

    Windows
     import.bat <Deploy User Login> <Deploy User Password>
    Linux
     ./import.sh <Deploy User Login> <Deploy User Password>

    See the discussion for possible issues and their solutions.

  4. Check contents of the repository with ID ishreleases at your repository server. You should be able to see at least subdirectories called com.intershop, com.intershop.assembly and com.intershop.build.

    Example screenshot when using Sonatype Nexus as artifact repository server:

Discussion

Alternative Import Commands

The import.bat/import.sh scripts are just wrapper scripts around Gradle. You may also directly execute the following commands in the root directory of the delivery:

Windows
gradlew importRepo -PRepoUserLogin=<Deploy User Login> -PRepoUserPasswd=<Deploy User Password>
Linux
./gradlew.sh importRepo -PRepoUserLogin=<Deploy User Login> -PRepoUserPasswd=<Deploy User Password>

Possible Issues

You may encounter the following issues when running the import:

  1. The artifact repository is not reachable. The output looks similar to the following:

    ...
    * What went wrong:
    Execution failed for task ':publishCom.intershop.3rd_apache.2.4.9.1.20140704133742PublicationToIvyRepository'.
    > Failed to publish publication 'com.intershop.3rd_apache.2.4.9.1.20140704133742' to repository 'ivy'
       > org.apache.http.conn.HttpHostConnectException: Connection to http://ciserver refused
    ...

    To resolve this issue: Check the target.repo.url property in the import.properties file.

  2. Authentication is not correct. The output looks similar to the following:

    * What went wrong:
    Execution failed for task ':publishCom.intershop.3rd_apache.2.4.9.1.20140704133742PublicationToIvyRepository'.
    > Failed to publish publication 'com.intershop.3rd_apache.2.4.9.1.20140704133742' to repository 'ivy'
       > java.io.IOException: Could not PUT 'http://ciserver/nexus/content/repositories/ishreleases/...'. Received status code 401 from server: Unauthorized

    To resolve this issue: Check your parameters for the authentication (user name/password) as well the permissions granted to the user in the artifact repository.

Known Deliveries

This step is always necessary if you get a delivery package from Intershop.

The following packages are known:

  • Main product Intershop and updates
  • Intershop services and extension
  • Intershop custom fixes

Multiple Artifact Repository Servers

If you have different repository servers in your environment, it is possible to configure the Intershop release repository as a proxy repository, because artifacts will only be added if Intershop released a new package.

Recipe: Create Sources From Intershop Templates

Problem

For a project 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 provide Intershop template?

Solution

Prerequisites

Meet the minimum system requirements

See the following recipes:

Steps

  1. Check your active Java version:

    >java -version
    java version "1.7.0_60"
    Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
    Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
  2. Download the latest version of the bootstrap package for the CI setup from your repository. It is located at <repository base URL>/ishreleases/com.intershop.build/intershop-ci-bootstrap/<version>/zips/intershop-ci-setup-zip-<version>.zip. Also see the discussion for how to find this file when using Nexus as artifact repository server.

  3. Unzip the the contents to a directory of your choice.

    Example for unzipping (Linux)
    mkdir intershop-ci
    unzip intershop-ci-setup-zip-1.0.0.0.*.zip -d intershop-ci
  4. Open the build.gradle file in the intershop-ci-setup subdirectory in an editor. This file configures the generation of artifacts.
  5. The file contains lines marked with //TODO. Go through these lines and provide the necessary information. Also see the discussion for required and optional adjustments of the build.gradle.
  6. Run the following command inside the intershop-ci-setup directory to generate all source artifacts:

    Run generation of all sources (Windows)
    gradlew intershopCISetupAll createHotFixImport
    Run generation of all sources (Linux)
    ./gradlew intershopCISetupAll createHotFixImport

    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.

  7. Add jar files to the prepared Oracle JDBC  Driver component set:
    1. Download file ojdbc6.jar from the Oracle web (http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html), agreeing to license conditions.
    2. Download file ucp.jar from (http://www.oracle.com/technetwork/database/enterprise-edition/downloads/ucp-112010-099129.html), agreeing to license conditions.
    3. Copy files to <setupDirectory>/componentsets/p_oracle/3rd_oracle/staticfiles/cartridge/lib.

  8. 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 your VCS.

Discussion

Finding CI Bootstrap Package on Nexus

When using the Nexus as artifact repository, find the CI bootstrap package at http://<hostname>:<port>/nexus/content/repositories/ishreleases/com.intershop.build/intershop-ci-bootstrap

On the web frontend:

Required Adjustments of build.gradle

  1. Corporate names: Specify names that identify your company/department. If you the same CI environment for multiple projects, these can stay the same across projects.
    1. Technical corporate name: Specify a reverse DNS name for your company/department in property corporateName.
    2. Corporate display name: Provide a human readable name for your company/department in property corporateDisplayName.
    3. Copyright owner: Provide a legal name of your company serving to be used in Copyright notices in property productCopyrightOwner.
  2. Project names: Specify names that identify your project.
    1. Technical project name: Specify a technical identifier for your project in property projectName.
    2. Project display name: Specify a human readable name of your project in property projectDisplayName.
  3. Output directory: Specify a directory to generate sources into in the property setupDirectory.

  4. Repository base URL: Specify the repository base URL of your artifact repository server in property repoBaseURL.

  5. Intershop Releases Repository: Provide the URL to the ishreleases repository on the marked line in the buildscript section.

Optional Adjustments of build.gradle

Output Directories

 By default all sources are generated into subdirectories of the setupDirectory. You may also optionally configure the output directories independently for different types of source artifacts. See the directories section of the build.gradle file and the following examples.

Example for adjusting output directories (Linux)
apply plugin: 'ci-setup'
IntershopCISetup {
	directories {
		setupDirectory = '/home/developer/intershop-ci/sources'
		devOpsDir = '/home/developer/devops-resources'
	
		componentSetsDir = "${setupDirectory}/componentsets"
		assembliesDir = "${setupDirectory}/assemblies"
	}
}
Example for adjusting output directories (Windows)
apply plugin: 'ci-setup'
IntershopCISetup {
	directories {
		setupDirectory = 'C:/Users/developer/intershop-ci/sources'
		devOpsDir = 'C:/Users/developer/intershop-ci/devops-resources'
	
		componentSetsDir = "${setupDirectory}/componentsets"
		assembliesDir = "${setupDirectory}/assemblies"
	}
}

Repositories

The build.gradle file comes with default IDs for all important repositories. It is possible to rename them and optionally add new ones. See the repository section of the build.gradle file.

Documentation assumes default repository IDs

Use the ability to rename repositories with care. The configured IDs will be taken into account for all generated sources. This documentation however assumes the default IDs, especially for the ishreleases repository.

Corporate Distribution

The repository section allows you to adjust the version of your corporate distribution in property distributionVersion.

It also allows you to configure a different URL at which your corporate distribution should be downloaded from by the Gradle wrapper in property distributionURL. This way you can place your corporate distribution on any web server you want.

Versions

The versions section configures which versions of Intershop 7, the Gradle Tools and third party components should be used. By default the latest available version of Intershop 7 available in your repository is used. You may specify different versions available in your repository.

Component Set and Assembly

The sections assembly and componentSet define names and versions of component set and assembly. Most properties have sensible default values based on projectName and corporateName, but you may change them. You may also adjust the initial version numbers.

The component set also contains an example component. You may adjust name and description.

Overview of Tasks and Output

Running gradlew tasks shows all available tasks:

:tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
...
CI Server Setup tasks
---------------------
ciSetup - Create all source artefacts of a CI server setup

Corporate Configuration tasks
-----------------------------
corporateSetup - Create all source artefacts of the corporate configuration
createCorporateConfiguration - Creates a structure of the 'CorporateConfiguration' plugin.
createCorporateDistribution - Creates a structure of a corporate distribution package project.
createOracleComponentSet - Creates a special component set for publishing Oracle JDBC drivers

Intershop Hotfix support tasks
------------------------------
createHotFixExport - Create sources for the Intershop hotfix export support
createHotFixImport - Create sources for the Intershop hotfix import support

Intershop CI Source tasks
-------------------------
intershopCISetupAll - Create all necessary source artefacts

Project Setup tasks
-------------------
createAssembly - Creates a structure of an assembly.
createComponentSet - Creates a structure of a componentset.
createDeploymentConfig - Creates a structure of a deployment configuration.
createDeveloperHome - Creates a structure of developer configuration files.
projectSetup - Create all source artefacts of a project setup
...

The resulting sources (assuming default output directories) look like this:

Generated Sources
sources
├── assemblies
│   └── corporate_assembly
│       ├── build.gradle
│       ├── development.properties
│       ├── gradle
│       │   └── ...
│       ├── gradle.properties
│       ├── gradlew
│       ├── gradlew.bat
│       └── settings.gradle
├── componentsets
│   ├── corp_componentset
│   │   ├── build.gradle
│   │   ├── cartridge_example
│   │   │   ├── build.gradle
│   │   │   └── staticfiles
│   │   │       ├── cartridge
│   │   │       │   └── ...
│   │   │       └── share
│   │   │           └── ...
│   │   ├── gradle
│   │   │   └── ...
│   │   ├── gradle.properties
│   │   ├── gradlew
│   │   ├── gradlew.bat
│   │   └── settings.gradle
│   └── p_oracle
│       ├── 3rd_oracle
│       │   ├── build.gradle
│       │   └── staticfiles
│       │       └── ...  
│       ├── build.gradle
│       ├── gradle
│       │   └── ...
│       ├── gradle.properties
│       ├── gradlew
│       ├── gradlew.bat
│       ├── init.gradle
│       └── settings.gradle
└── devops
    ├── ci_server
    │   ├── host_configs
    │   │   └── ciserver
    │   │       └── environment.properties
    │   └── user_home
    │       ├── gradle.properties
    │       └── init.gradle
    ├── deployments
    │   └── corporatewebshop
    │       ├── gradle
    │       │   └── ...
    │       ├── gradlew
    │       ├── gradlew.bat
    │       └── settings.gradle
    ├── developer
    │   └── corporatewebshop
    │       ├── gradle_environment.bat
    │       └── gradle_environment.sh
    ├── gradle
    │   ├── corporate-distribution
    │   │   ├── build.gradle
    │   │   ├── gradle
    │   │   │   └── ...
    │   │   ├── gradle.properties
    │   │   ├── gradlew
    │   │   ├── gradlew.bat
    │   │   └── src
    │   │       └── init.d
    │   │           └── intershop-init.gradle
    │   └── corporate-plugins
    │       ├── build.gradle
    │       ├── corporate-configuration
    │       │   └── src
    │       │       └── main
    │       │           └── resources
    │       │               └── configuration
    │       │                   └── corporate.properties
    │       ├── gradle
    │       │   └── ...
    │       ├── gradle.properties
    │       ├── gradlew
    │       ├── gradlew.bat
    │       └── settings.gradle
    └── hotfix
        └── import
            ├── build.gradle
            ├── gradle
            │   └── ...
            ├── gradle.properties
            ├── gradlew
            ├── gradlew.bat
            └── init.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).

LineGenerated byProject or corporate artifactUsed inDescription
2-11createAssemblyprojectSetup CI Build For Project ArtifactsSee Concept - Continuous Delivery Tools, Concept - Gradle Assembly Tools
13-27createComponentSetprojectSetup CI Build For Project ArtifactsSee Concept - Continuous Delivery Tools, Concept - Gradle Build Tools
28-40createOracleComponentSetcorporateSetup CI Build For Corporate ArtifactsFor 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.
42-48ciSetupcorporateSetup CI Build For Corporate Artifacts, Setup CI Build For Project ArtifactsConfiguration specific to running the CI builds (snapshot + release) including host-specific configuration
50-55createDeploymentConfigproject Configuration template for running a deployment outside of the CI and development environment, e.g., for demo, integration tests and production
57-59createDeveloperHomeprojectSetup CI Build For Project Artifacts, Cookbook - Gradle Developer Workflow (valid to Gradle Tools 2.7)Configuration for development environments for a certain project (in a certain branch etc)
61-70createCorporateDistributioncorporateSetup CI Build For Corporate ArtifactsSee Concept - Gradle Build Tools
71-84createCorporateConfigurationcorporate

Setup CI Build For Corporate Artifacts

See Concept - Gradle Build Tools
85-93createHotFixImportcorporateCookbook - Hotfix RecipesTool for importing hotfixes from a zip-file to the repository server.

Examples If Using SVN As VCS

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:

  • You work on Linux (Windows commands are similar).
  • The intershop-ci-setup directory is located at /home/developer/intershop-ci/intershop-ci-setup.
  • Your SVN root is http://ciserver/svn/intershop.
  • Your output directory (property setupDirectory in intershop-ci-setup/build.gradle) is /home/developer/intershop-ci/sources and you use the default output directories structure.

Perform the following steps:

  1. Create the following file for a list of common SVN ignores (assumed location is /home/developer/ignore.txt):

    /home/developer/ignore.txt
    build
    .gradle
    bin
    target
  2. Add your intershop-ci-setup directory by executing:

    SVN command
    cd /home/developer/intershop-ci
    
    # Create SVN structure
    svn mkdir --parents http://ciserver/svn/intershop/devops/intershop-ci-setup -m "create path for template project" 
    svn mkdir --parents http://ciserver/svn/intershop/devops/intershop-ci-setup/branches -m "create branches folder"
    svn mkdir --parents http://ciserver/svn/intershop/devops/intershop-ci-setup/tags -m "create tags folder"
     
    # Import sources to SVN
    svn import intershop-ci-setup http://ciserver/svn/intershop/devops/intershop-ci-setup/trunk -m "add intershop-ci-setup configuration"
     
    # Make your local folder a working copy
    svn co --force http://ciserver/svn/intershop/devops/intershop-ci-setup/trunk intershop-ci-setup
    svn revert -R intershop-ci-setup
     
    # Add ignore properties (see ignore.txt)
    svn propset svn:ignore -F /home/developer/ignore.txt intershop-ci-setup
    svn commit intershop-ci-setup -m "add svn ignore"
  3. Add your corporate plugin configuration and corporate distribution by executing:

    SVN Commands
    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"
    svn mkdir --parents http://ciserver/svn/intershop/devops/gradle/corporate-plugins/branches -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/devops/gradle/corporate-plugins/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"
    svn import corporate-plugins http://ciserver/svn/intershop/devops/gradle/corporate-plugins/trunk -m "add multiproject corporate-plugins"
     
    # Make your local folder a working copy
    svn co --force http://ciserver/svn/intershop/devops/gradle/corporate-plugins/trunk corporate-plugins
    svn revert -R corporate-plugins
    
    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-plugins
    svn commit corporate-plugins -m "add svn ignore"
     
    svn propset svn:ignore -F /home/developer/ignore.txt corporate-distribution
    svn commit corporate-distribution -m "add svn ignore"
  4. Add the component set of the project by executing (assuming componentSetName is 'corp_componentset'):

    SVN Commands
    cd /home/developer/intershop-ci/sources/componentsets
    
    # Create SVN structure
    svn mkdir --parents http://ciserver/svn/intershop/componentsets -m "create path for system component sets"
    svn mkdir --parents http://ciserver/svn/intershop/componentsets/corp_componentset/branches -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/componentsets/corp_componentset/tags -m "create svn structure"
    
    # Import sources to SVN
    svn import corp_componentset http://ciserver/svn/intershop/componentsets/corp_componentset/trunk -m "add component set"
    
    # Make your local folder a working copy
    svn co --force http://ciserver/svn/intershop/componentsets/corp_componentset/trunk corp_componentset
    svn revert -R corp_componentset 
    
    # Add ignore properties (see ignore.txt) 
    svn propset svn:ignore -F /home/developer/ignore.txt corp_componentset
    svn commit corp_componentset -m "add svn ignore"
    
  5. Add the assembly of the project (assuming assemblyName is 'corporate_assembly') by executing:

    SVN Commands
    cd /home/developer/intershop-ci/sources/assemblies
    
    # Create SVN structure
    svn mkdir --parents http://ciserver/svn/intershop/assemblies -m "create path for assemblies"
    svn mkdir --parents http://ciserver/svn/intershop/assemblies/corporate_assembly/branches -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/assemblies/corporate_assembly/tags -m "create svn structure"
    
    # Import sources to SVN
    svn import corporate_assembly http://ciserver/svn/intershop/assemblies/corporate_assembly/trunk -m "add assembly"
    
    # Make your local folder a working copy
    svn co --force http://ciserver/svn/intershop/assemblies/corporate_assembly/trunk corporate_assembly
    svn revert -R corporate_assembly
    
    # Add ignore properties (see ignore.txt) 
    svn propset svn:ignore -F /home/developer/ignore.txt corporate_assembly
    svn commit corporate_assembly -m "add svn ignore" 
  6. Add the Oracle JDBC Drivers Component Set by executing:

    SVN Commands
    cd /home/developer/intershop-ci/sources/componentsets
    
    # Create SVN structure
    svn mkdir --parents http://ciserver/svn/intershop/componentsets -m "create path for system component sets"
    svn mkdir --parents http://ciserver/svn/intershop/componentsets/p_oracle/branches -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/componentsets/p_oracle/tags -m "create svn structure"
    
    # Import sources to SVN
    svn import p_oracle http://ciserver/svn/intershop/componentsets/p_oracle/trunk -m "add Oracle JDBC driver component set"
    
    # Make your local folder a working copy
    svn co --force http://ciserver/svn/intershop/componentsets/p_oracle/trunk p_oracle
    svn revert -R p_oracle
    
    # Add ignore properties (see ignore.txt)
    svn propset svn:ignore -F /home/developer/ignore.txt p_oracle
    svn commit p_oracle -m "add svn ignore"
  7. Add developer scripts (assuming projectName is 'corporatewebshop') by executing:

    SVN Commands
    cd /home/developer/intershop-ci/sources/devops/developer
    
    # Create SVN structure
    svn mkdir --parents http://ciserver/svn/intershop/devops/developer -m "create path for developer configurations"
    svn mkdir --parents http://ciserver/svn/intershop/devops/developer/corporatewebshop/branches -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/devops/developer/corporatewebshop/tags -m "create svn structure"
    
    # Import sources to SVN
    svn import corporatewebshop http://ciserver/svn/intershop/devops/developer/corporatewebshop/trunk -m "add developer configuration"
    
    # Make your local folder a working copy
    svn co --force http://ciserver/svn/intershop/devops/developer/corporatewebshop/trunk corporatewebshop
    svn revert -R corporatewebshop
    
    # Add ignore properties (see ignore.txt)
    svn propset svn:ignore -F /home/developer/ignore.txt corporatewebshop
    svn commit corporatewebshop -m "add svn ignore"
    
  8. Add demo deployment scripts (assuming projectName is 'corporatewebshop') by executing:

    SVN Commands
    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/corporatewebshop/branches -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/devops/deployments/corporatewebshop/tags -m "create svn structure"
     
    # Import sources to SVN
    svn import corporatewebshop http://ciserver/svn/intershop/devops/deployments/corporatewebshop/trunk -m "add deployment configuration"
     
    # Make your local folder a working copy
    svn co --force http://ciserver/svn/intershop/devops/deployments/corporatewebshop/trunk corporatewebshop
    svn revert -R corporatewebshop
    
    # Add ignore properties (see ignore.txt)
    svn propset svn:ignore -F /home/developer/ignore.txt corporatewebshop
    svn commit corporatewebshop -m "add svn ignore"
    
  9. Add CI server user home scripts and host configuration by executing:

    SVN Commands
    cd /home/developer/intershop-ci/sources/devops/ci_server
    
    # Create SVN structure
    svn mkdir --parents http://ciserver/svn/intershop/devops/ci_server/user_home -m "create path for ci_server user home files and directories" 
    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/trunk -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/devops/ci_server/user_home/branches -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/devops/ci_server/user_home/trunk -m "create svn structure"
    
    # Import sources to SVN
    svn import user_home http://ciserver/svn/intershop/devops/ci_server/user_home/trunk -m "add GRADLE user home configuration for ci build processes"
    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/user_home/trunk user_home
    svn revert -R user_home
    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 user_home
    svn commit user_home -m "add svn ignore" 
    svn propset svn:ignore -F /home/developer/ignore.txt host_configs
    svn commit host_configs -m "add svn ignore"
  10. Add hotfix import tool by executing:

    SVN Commands
    cd /home/developer/intershop-ci/sources/devops/hotfix
    
    # Create SVN structure
    svn mkdir --parents http://ciserver/svn/intershop/devops/hotfix/import -m "create path for hotfix import tools" 
    svn mkdir --parents http://ciserver/svn/intershop/devops/hotfix/import/trunk -m "create svn structure"
    svn mkdir --parents http://ciserver/svn/intershop/devops/hotfix/import/branches -m "create svn structure"
    
    # Import sources to SVN
    svn import import http://ciserver/svn/intershop/devops/hotfix/import/trunk -m "add hotfix tools"
    
    # Make your local folder a working copy
    svn co --force http://ciserver/svn/intershop/devops/hotfix/import/trunk import
    svn revert -R import
    
    # Add ignore properties (see ignore.txt)
    svn propset svn:ignore -F /home/developer/ignore.txt import
    svn commit import -m "add svn ignore" 
    



Recipe: Setup CI Build for Corporate Artifacts

Problem

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?

References

Solution

Prerequisites

See the following recipes:

Steps

  1. Provide host-specific configuration for deployments during assembly build.
  2. Set up the following automated processes on your CI Server:
    1. Process for building the corporate distribution
    2. Process for building the corporate plugin configuration
    3. Process for managing Gradle user home
    4. Process for building the Oracle JDBC Drivers Component Set
  3. Trigger the processes a first time in the order they were set up, so the gradle user home is prepared and artifacts are uploaded to your artifact repository server.

See the following sections for details.

Example

 See the discussion for an example using Jenkins and SVN.

Provide Host-specific Configuration

Provide host-specific configuration for deployments during assembly build:

  1. Checkout the host configuration (<sources>/devops/ci_server/host_configs/<hostname>) from your VCS.
  2. Adjust the environment.properties file.
    Depending on the operating system it is necessary to specify the user settings in this file. Furthermore, it is necessary to define the database connection parameter and used ports and interfaces.
  3. Commit the changes to your VCS.
  4. Duplicate the folder <hostname> for each remote-CI agent and repeat the three steps above.

Process for Building Corporate Distribution

Set up an automated process for building the corporate distribution. Configure the process to:

  1. Check out the sources of the corporate distribution from your VCS ( <sources>/devops/gradle/corporate-distribution ) to the folder corporate-distribution.
  2. Execute the following commands:

    Publish corporate distribution (Linux)
    cd corporate-distribution
    ./gradlew clean publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>
    Publish corporate distribution (Windows)
    cd corporate-distribution
    gradlew clean publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>

    This process should be triggered only manually (e.g., not automatically by polling the VCS), see discussion.

Process for Building Corporate Plugin Configuration

Set up an automated process for building the corporate plugin configuration. Configure the process to:

  1. Check out the sources of the corporate plugin configuration from your VCS (<sources>/devops/gradle/corporate-plugins) to the folder corporate-plugins.
  2. Execute the following commands: 

    Publish corporate plugin configuration (Linux)
    cd corporate-plugins
    ./gradlew clean publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>
    Publish corporate plugin configuration (Windows)
    cd corporate-plugins
    gradlew clean publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>

    This process should be triggered automatically upon detecting changes in the VCS.

Process for Managing Gradle User Home

Set up an automated process for managing a Gradle user home (see discussion on why this is necessary). Configure the process to:

  1. Check out the sources of the Gradle user home from your VCS (<sources>/devops/ci_server/user_home) to the folder user_home.
  2. Copy the folder user_home to <BASE_GRADLE_USER_HOME>/gradle_user_home. See discussion for a script that does this without disturbing processes using the Gradle user home at the same time.
    This process should be triggered periodically (once every night) independent of changes.

Process for Building the Oracle JDBC Drivers Component Set

Set up an automated process for building the Oracle JDBC drivers component set. Configure the process to:

  1. Check out the sources of the component set from your VCS (<sources>/componentsets/p_oracle) to the folder p_oracle.
  2. Execute the following commands:

    Publish release of p_oracle (Linux)
    cd p_oracle
    ./gradlew clean publish -I init.gradle -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>

    This process should be triggered only manually (e.g., not automatically by polling the VCS), see discussion.

Discussion

Gradle User Home

The build processes on the CI server need a GRADLE_USER_HOME with a configuration for publishing to a remote repository (see Publishing to a Remote Repository in Cookbook - Gradle Build Tools). Intershop provides a template of the necessary files for publishing to a remote repository: init.gradle and gradle.properties. These files are located in <sources>/devops/ci_server/user_home.

The CI job will copy these files to a directory on the machine outside CI standard directories, so that all other processes can use this directory for the GRADLE_USER_HOME. Gradle uses this directory also for caching of artifacts. There is no automatic deletion functionality for this kind of caches. Therefore, it is necessary to run periodically an automatic clean up process.

Example Script For Automated Process Managing the Gradle User Home

The following scripts replaces the contents of <BASE_GRADLE_USER_HOME>/gradle_user_home by the contents of the folder user_home. Processes holding handles to <BASE_GRADLE_USER_HOME>/gradle_user_home will keep using the same directory.

Replace <build number> by a number provided by the CI server that grows in subsequent executions of the automated process. (Jenkins and Bamboo offer a variable ${BUILD_NUMBER} for that purpose.)

Create gradle user home/Purge old ones (Linux)
export HOMEDIR=${BASE_GRADLE_USER_HOME}/gradle_user_home
mkdir ${HOMEDIR}_<build number>
cp user_home/* ${HOMEDIR}_<build number>
if [ -d ${HOMEDIR} ]; then
	mv ${HOMEDIR} ${HOMEDIR}_before_<build number>\
    && mv ${HOMEDIR}_<build number> ${HOMEDIR}\
	&& rm -rf ${HOMEDIR}_before_<build number>
else 
	mv ${HOMEDIR}_<build number> ${HOMEDIR} 
fi
LineDescription
1Create variable for the directory.
BASE_GRADLE_USER_HOME is a global variable. See "Directory for Additional Build Directories" in Recipe - Configure CI Server.
2Create a new directory
3Copy files from source directory to new directory
5 - 7The old home directory will be replaced with the new one. If this step finished successfully, the old directory will be removed.
9Runs only if there is a home directory before.

Rebuilding  Corporate Artifacts

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 so it is used.

Changes in the corporate plugin configuration are effective 24h hours after rebuilding at latest (this is Gradles default cache timeout). You can also force it by passing --refresh-dependencies to gradlew when starting the Gradle process accessing the configuration.

Before rebuilding the Oracle JDBC Drivers component set always increase the version or build number (located in <sources>/componentsets/p_oracle/gradle.properties).

Example Using Jenkins and SVN

This example assumes that:

  • You work on Linux (Windows commands are similar).
  • Your SVN root is http://ciserver/svn/intershop.
  • You use the default output directories structure.

Build Item For Corporate Distribution

Create a new build item Corporate Distribution:

ParameterValueDescription
Item namecorporate-distributionThe item name is also used for the directory path. Do not use spaces in this configuration
Build typeBuild a free-style software project 
Advanced Project Options  
Display NameCorporate DistributionThis is used for the item name on the web front end
DescriptionCreates a corporate distribution for the main project 
Source Code ManagementSubversion 
Repository URLhttp://ciserver/svn/intershop/devops/gradle/corporate-distribution/trunkURL of the corporate distribution project
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directorycorporate-distributionThis is the target path in the workspace directory for the the Subversion checkout.
- Repository browserCollabnetType of a repository browser
- - URLhttp://ciserver/viewvc/intershop/devops/gradle/corporate-distribution/trunkURL for the repository browser of this project
Build Triggers[no selection] 
Build Environment  
- Global passwords[selected]Global configured password will be used
BuildExecute ShellThis is an example on a Linux server. On Windows it is necessary to select Execute Windows batch command.
Command

cd corporate-distribution
./gradlew clean publish -PRepoUserLogin=<deploy-user-login> -PRepoUserPasswd=$DEPLOY_USER_PASSWORD

Before the build runs the old build should be deleted, therefore, the target clean is also called.
Username and password of the repository deploy user must be specified with the project properties RepoUserLogin and RepoUserPasswd.
DEPLOY_USER_PASSWORD was specified as global password.
Jenkins build log
...
:clean UP-TO-DATE
:downloadGradle
:customGradleDistribution
:generateDescriptorFileForIvyPublication
:publishIvyPublicationToIvy Distribution RepositoryRepository
Upload http://ciserver/nexus/content/repositories/distributions/gradle-dist/corporate_gradle_1.8/1.0.0.0/corporate_gradle_1.8-1.0.0.0-bin.zip
Upload http://ciserver/nexus/content/repositories/distributions/gradle-dist/corporate_gradle_1.8/1.0.0.0/corporate_gradle_1.8-1.0.0.0-bin.zip.sha1
Upload http://ciserver/nexus/content/repositories/distributions/gradle-dist/corporate_gradle_1.8/1.0.0.0/ivy.xml
Upload http://ciserver/nexus/content/repositories/distributions/gradle-dist/corporate_gradle_1.8/1.0.0.0/ivy.xml.sha1
:publish

BUILD SUCCESSFUL

Total time: 18.544 secs
Finished: SUCCESS

Corporate distribution in the artifact repository if using Nexus:

Build Item For Corporate Plugin Configuration

Create a new build item Corporate Plugin Configuration:

ParameterValueDescription
Item namecorporate-pluginsThe item name is also used for the directory path. Do not use spaces in this configuration
Build typeBuild a free-style software project 
Advanced Project Options  
Display NameCorporate Plugin ConfigurationThis is used for the item name on the web front end
DescriptionCreates a corporate plugin configuration for the main project 
Source Code ManagementSubversion 
Repository URLhttp://ciserver/svn/intershop/devops/gradle/corporate-plugins/trunkURL of the corporate distribution project
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directorycorporate-pluginsThis is the target path in the workspace directory for the the Subversion checkout.
- Repository browserCollabnetType of a repository browser
- - URLhttp://ciserver/viewvc/intershop/devops/gradle/corporate-plugins/trunkURL for the repository browser of this project
Build Triggers[no selection] 
Build Environment  
- Global passwords[selected]Global configured password will be used
BuildExecute ShellThis is an example on a Linux server. On Windows it is necessary to select Execute Windows batch command.
Command

cd corporate-plugins
./gradlew clean publish -PRepoUserLogin=<deploy-user-login> -PRepoUserPasswd=$DEPLOY_USER_PASSWORD

Before the build runs the old build should be deleted, therefore, the target clean is also called.
Username and password of the repository deploy user must be specified with the project properties RepoUserLogin and RepoUserPasswd.
DEPLOY_USER_PASSWORD was specified as global password.

Log output
...
:corporate-configuration:clean UP-TO-DATE
:corporate-configuration:generateDescriptorFileForIvyPublication
:corporate-configuration:compileJava UP-TO-DATE
:corporate-configuration:compileGroovy UP-TO-DATE
:corporate-configuration:processResources
:corporate-configuration:classes

:corporate-configuration:jar

:corporate-configuration:publishIvyPublicationToIvyRepository

Upload http://ciserver/nexus/content/repositories/gradle/com.intershop.build.gradle/corporate-configuration/1.0.0.0.20140702141143/jars/corporate-configuration-jar-1.0.0.0.20140702141143.jar
Upload http://ciserver/nexus/content/repositories/gradle/com.intershop.build.gradle/corporate-configuration/1.0.0.0.20140702141143/jars/corporate-configuration-jar-1.0.0.0.20140702141143.jar.sha1
Upload http://ciserver/nexus/content/repositories/gradle/com.intershop.build.gradle/corporate-configuration/1.0.0.0.20140702141143/ivys/ivy-1.0.0.0.20140702141143.xml
Upload http://ciserver/nexus/content/repositories/gradle/com.intershop.build.gradle/corporate-configuration/1.0.0.0.20140702141143/ivys/ivy-1.0.0.0.20140702141143.xml.sha1
:corporate-configuration:publish

BUILD SUCCESSFUL

Total time: 11.662 secs

Finished: SUCCESS

Corporate plugin configuration in the artifact repository if using Nexus:

Build Item For Gradle User Home

Create a new build item Gradle User Home:

ParameterValueDescription
Item namegradle_user_homeThe item name is also used for the directory path. Do not use spaces in this configuration
Build typeBuild a free-style software project 
Prepare an environment for the run[selected] 
Keep Jenkins Environment Variables[selected] 
Keep Jenkins Build Variables[selected] 
Advanced Project Options  
Display NameGRADLE_USER_HOMEThis is used for the item name on the web front end
DescriptionCreates/Updates GRADLE_USER_HOME folder 
Source Code ManagementSubversion 
Repository URLhttp://ciserver/svn/intershop/devops/ci_server/user_home/trunkURL of the CI server home configuration files.
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directoryuser_homeThis is the target path in the workspace directory for the the Subversion checkout.
- Repository browserCollabnetType of a repository browser
- - URLhttp://ciserver/viewvc/intershop/devops/ci_server/user_home/trunkURL for the repository browser of this project
Build TriggersBuild periodically 
- ScheduleH 3 * * 2-6The job will run every night from Tuesday to Saturday
BuildExecute ShellThis is an example on a Linux server. On Windows it is necessary to select Execute Windows batch command.

Command 

export HOMEDIR=${BASE_GRADLE_USER_HOME}/gradle_user_home
mkdir ${HOMEDIR}_${BUILD_NUMBER}
cp user_home/* ${HOMEDIR}_${BUILD_NUMBER}
if [ -d ${HOMEDIR} ]; then
	mv ${HOMEDIR} ${HOMEDIR}_before_${BUILD_NUMBER}\
    && mv ${HOMEDIR}_${BUILD_NUMBER} ${HOMEDIR}\
	&& rm -rf ${HOMEDIR}_before_${BUILD_NUMBER}
else 
	mv ${HOMEDIR}_${BUILD_NUMBER} ${HOMEDIR} 
fi

Build Item For Oracle JDBC Driver Component Set

Create a new build item Oracle JDBC Driver component set:

ParameterValueDescription
Item namep_oracleThe item name is also used for the directory path. Do not use spaces in this configuration
Advanced Project Options  
Display NameOracle JDBC Driver component setThis is used for the item name on the web front end
Build typeBuild a free-style software project 
DescriptionCreate Oracle JDBC Driver component set 
Source Code ManagementSubversion 
Repository URLhttp://ciserver/svn/intershop/componentsets/p_oracle/trunkURL of the corporate distribution project
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directoryp_oracleThis is the target path in the workspace directory for the the Subversion checkout.
- Repository browserCollabnetType of a repository browser
- - URLhttp://ciserver/viewvc/intershop/ componentsets/p_oracle/trunkURL for the repository browser of this project
Build TriggersPoll SCM 
- ScheduleH/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
-- Global passwords[selected]Global configured password will be used
BuildExecute ShellThis is an example on a Linux server. On Windows it is necessary to select Execute Windows batch command.
Command

export GRADLE_USER_HOME=${WORKSPACE}/gradle_user_home
cd p_oracle

./gradlew clean publish -I init.gradle -PRepoUserLogin=<deploy-user-login> -PRepoUserPasswd=$DEPLOY_USER_PASSWORD

Before the build runs the old build should be deleted, therefore the target clean is also called.
Username and password of the repository deploy user must be specified with the project properties RepoUserLogin and RepoUserPasswd. It is also possible to run this command manually.

DEPLOY_USER_PASSWORD was specified as global password.

Log output
...
:3rd_oracle:clean
:3rd_oracle:zipShare UP-TO-DATE
:3rd_oracle:generateDescriptorFileForIvyPublication

:3rd_oracle:publishIvyPublicationToReleasesRepository

Upload http://ciserver/nexus/content/repositories/releases/com.intershop/3rd_oracle/11.2.0.3.0.2/jars/ucp-jar-11.2.0.3.0.2.jar
Upload http://ciserver/nexus/content/repositories/releases/com.intershop/3rd_oracle/11.2.0.3.0.2/jars/ucp-jar-11.2.0.3.0.2.jar.sha1
Upload http://ciserver/nexus/content/repositories/releases/com.intershop/3rd_oracle/11.2.0.3.0.2/jars/ojdbc6-jar-11.2.0.3.0.2.jar

Upload http://ciserver/nexus/content/repositories/releases/com.intershop/3rd_oracle/11.2.0.3.0.2/jars/ojdbc6-jar-11.2.0.3.0.2.jar.sha1
Upload http://ciserver/nexus/content/repositories/releases/com.intershop/3rd_oracle/11.2.0.3.0.2/ivys/ivy-11.2.0.3.0.2.xml
Upload http://ciserver/nexus/content/repositories/releases/com.intershop/3rd_oracle/11.2.0.3.0.2/ivys/ivy-11.2.0.3.0.2.xml.sha1
:3rd_oracle:publish
:generateDescriptorFileForIvyPublication
Download http://ciserver/nexus/content/repositories/releases/com.intershop/3rd_oracle/11.2.0.3.0.2/ivys/ivy-11.2.0.3.0.2.xml

:publishIvyPublicationToReleasesRepository
Upload http://ciserver/nexus/content/repositories/releases/com.intershop.set/p_oracle/11.2.0.3.0.2/ivys/ivy-11.2.0.3.0.2.xml
Upload http://ciserver/nexus/content/repositories/releases/com.intershop.set/p_oracle/11.2.0.3.0.2/ivys/ivy-11.2.0.3.0.2.xml.sha1
:publish

BUILD SUCCESSFUL


Total time: 13.974 secs

Finished: SUCCESS

Oracle JDBC Driver component set in the artifact repository if using Nexus:

Jenkins Overview With All Build Items

Recipe: Setup CI Build for Project Artifacts

Problem

After changes on the code base it is a good practice to run an integration build with all automatic tests to give the developer team a feedback as fast as possible. Furthermore, it is necessary to check the impact of the changes on the initialization of the database.

How can a administrator or developer set up a continuous integration process for all project artifacts? 

Solution

Prerequisites

See the following recipes:

Steps

  1. Set up the following automated processes on your CI Server:
    1. Process for building a snapshot of the component set.
    2. Process for building a snapshot of the assembly.
    3. Process for building a release of the component set and assembly.
  2. Trigger the processes a first time in the order they were set up, so the Gradle user home is prepared and artifacts are uploaded to your artifact repository server.

Example

See the discussion for an example using Jenkins and SVN.

Process for Building a Snapshot of the Component Set

Set up up an automated process for a snapshot build of the component set. Configure the process to:

  1. Check out the sources of the component set from your VCS (<sources>/componentsets/<component set name>) to the folder <component set name>.
  2. Execute the following commands:

    Publish snapshot of component set (Linux)
    export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home
    cd <component set name>
    ./gradlew build publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>

    This process should be triggered automatically upon detecting changes in the VCS.

Process for Building a Snapshot of the Assembly

Set up an automated process for a snapshot build of the assembly. Configure the process to:

  1. Check out the sources of the assembly set from your VCS (<sources>/assemblies/<assembly name>) to the folder <assembly name>.
  2. Check out the host configuration (<sources>/devops/ci_server/host_configs/) into the folder host_configs.
  3. Execute the following commands:

    Publish snapshot of assembly (Linux)
    export COMPONENT_SET=<organization of component set>.<name of component set>
    export COMPONENT_SET_VERSION=<version of component set without build number/snapshot suffix>
    export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home
    export ENVIRONMENT_PROPS=<workspace directory>/host_configs/<name of executing host>/environment.properties
    
    cd <assembly name>
    ./gradlew build publish -PreleaseWithDump=true -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password> \
    -PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS}

    This process should be triggered automatically upon detecting changes in the VCS.

Process for Building a Release of the Component Set and Assembly

Set up an automated process for a release build of component set and assembly. Configure the process to:

  1. Check out the sources of the component set from your VCS (<sources>/componentsets/<component set name>) to the folder <component set name>.
  2. Check out the sources of the assembly set from your VCS (<sources>/assemblies/<assembly name>) to the folder <assembly name>.
  3. Check out the host configuration (<sources>/devops/ci_server/host_configs/) into the folder host_configs.
  4. Execute the following commands:

    Publish release of component set and assembly (Linux)
    export BUILD_NO=.`date +%Y%m%d%H%M%S`
    export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home
    export COMPONENT_SET=<organization of component set>.<name of component set>
    export COMPONENT_SET_VERSION=<version of component set without build number/snapshot suffix>
    export ENVIRONMENT_PROPS=<workspace directory>/host_configs/<name of executing host>/environment.properties
    export PUBLISH_STATUS=release
    
    cd <component set name>
    ./gradlew build publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>
      
    cd <assembly name>
    ./gradlew build publish -PreleaseWithDump=true -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password> \
    -PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS}

    This process should be triggered only manually (e.g., not automatically by polling the VCS).

Discussion

Assembly Builds

Long running processes with higher resource requirements (dbinit, dbmigrate)  should run on remote agents. That makes monitoring of this processes more efficient.

It is possible to disable the test of the database during the assembly build. To do so remove the parameter releaseWithDump from the script or change the value of this parameter to false. This reduces the time for the build, but the database initialization is not tested. Furthermore, the database export file will not be published and developers can not use this artifact for faster initialization of the database of their environment.

Snapshot Build

For a fast developer feedback we suggest to use snapshot builds. Project component set and assembly will be build in different steps.

  • The build of the component set ensures, that there are no compile errors and all JUnit tests were finished successfully after a code change. It takes some minutes (< 10 min).
  • The assembly build ensures, that the database initialization (dbinit) or database migration (dbmigrate) runs without any errors. The assembly build runs with a database initialization, therefore, it takes much more time than the build of the component set. The run time depends on the size of the database objects.

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.

Release Build 

The release build runs time triggered once per day or per week or on request. All project artifacts of this release should use the same version and build number. Cartridges, components and assembly 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 more 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.

Example Using Jenkins and SVN

This example assumes that:

  • You work on Linux (Windows commands are similar).
  • Your SVN root is http://ciserver/svn/intershop.
  • You use the default output directories structure.
  • The name of the component set is corp_componentset.
  • The name of the assembly is corporate_assembly.

Build Item for Snapshot of Component Set

Create a new build item Component set corp_componentset:

ParameterValueDescription
Item namecomponentset_webshopThe item name is also used for the directory path. Do not use spaces in this configuration.
Build typeBuild a free-style software project 
Prepare an environment for the run[selected] 
Keep Jenkins Environment Variables[selected] 
Keep Jenkins Build Variables[selected] 
Advanced Project Options  
Display NameComponent Set corp_componentsetThis is used for the item name on the web front end.
DescriptionCreate a snapshot build of the component set. 
Source Code ManagementSubversion 
Repository URL

http://ciserver/svn/intershop/componentsets/corp_componentset/trunk  

URL of the project component set
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directorycorp_componentsetThis is the target path in the workspace directory for the the Subversion checkout.
- Repository browserCollabnetType of a repository browser
- - URLhttp://ciserver/viewvc/intershop/componentsets/corp_componentset/trunkURL for the repository browser of this project
Build TriggersPoll SCM 
- ScheduleH/5 * * * *The job will check the VCS for changes every 5 minutes.
Build Environment  
Inject passwords to the build as environment variables[selected]Password will be defined for the environment.
-- Global passwords[selected]Global configured password will be used.
BuildExecute ShellThis is an example on a Linux server. On Windows it is necessary to select Execute Windows batch command.
- Command

export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home

cd corp_componentset
sh ./gradlew publish \
-PRepoUserLogin=<deploy-user-login> \
-PRepoUserPasswd=$DEPLOY_USER_PASSWORD

Provide the GRADLE_USER_HOME (Global property BASE_GRADLE_USER_HOME is used).

Change to the component set folder.
Run the publish target of the build with project parameter for deploy user and deploy user password.

Log output
Building in workspace /var/lib/jenkins/jobs/componentset_webshop/workspace
Updating http://ciserver/svn/intershop/componentsets/corp_componentset/trunk at revision '2014-07-16T16:04:20.333 +0200'
At revision 43
no change for http://ciserver/svn/intershop/componentsets/corp_componentset/trunk since the previous build
[workspace] $ /bin/sh -xe /tmp/hudson2340063613026622480.sh
+ export GRADLE_USER_HOME=/opt/intershop/build/gradle_user_home
+ GRADLE_USER_HOME=/opt/intershop/build/gradle_user_home
+ cd corp_componentset
+ sh ./gradlew publish -PRepoUserLogin=admin -PRepoUserPasswd=****
Downloading http://ciserver/nexus/content/repositories/distributions/gradle-dist/corporate_gradle_1.8/1.0.0.0/corporate_gradle_1.8-1.0.0.0-bin.zip
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Unzipping /opt/intershop/build/gradle_user_home/wrapper/dists/corporate_gradle_1.8-1.0.0.0-bin/4kqi2io27c0nscl7hdce2ddnqr/corporate_gradle_1.8-1.0.0.0-bin.zip to /opt/intershop/build/gradle_user_home/wrapper/dists/corporate_gradle_1.8-1.0.0.0-bin/4kqi2io27c0nscl7hdce2ddnqr
Set executable permissions for: /opt/intershop/build/gradle_user_home/wrapper/dists/corporate_gradle_1.8-1.0.0.0-bin/4kqi2io27c0nscl7hdce2ddnqr/gradle-1.8/bin/gradle
Download http://ciserver/nexus/content/repositories/gradle/com.intershop.build.gradle/corporate-configuration/1.0.0.0.20140712231610/ivys/ivy-1.0.0.0.20140712231610.xml

Download http://ciserver/nexus/content/repositories/ishreleases/com.intershop.build.gradle/corporate-plugin/1.2.0.0.20140711152402/ivys/ivy-1.2.0.0.20140711152402.xml
Download http://ciserver/nexus/content/repositories/ishreleases/com.intershop.build.gradle/versioning/1.2.0.0.20140711152402/ivys/ivy-1.2.0.0.20140711152402.xml
...
Download http://ciserver/nexus/content/repositories/ishreleases/com.intershop/sld_system_app/7.5.0.0.20140711190011/jars/sld_system_app-jar-7.5.0.0.20140711190011.jar
:exampleCartridge:compileJava UP-TO-DATE
:exampleCartridge:processResources UP-TO-DATE
:exampleCartridge:classes UP-TO-DATE
:exampleCartridge:isml2classMain
...
:exampleCartridge:publishIvyPublicationToSnapshotsRepository
Upload http://ciserver/nexus/content/repositories/snapshots/com.corporatename/exampleCartridge/1.0.0.0-SNAPSHOT/zips/exampleCartridge-cartridge-1.0.0.0-SNAPSHOT.zip
Upload http://ciserver/nexus/content/repositories/snapshots/com.corporatename/exampleCartridge/1.0.0.0-SNAPSHOT/zips/exampleCartridge-cartridge-1.0.0.0-SNAPSHOT.zip.sha1
Upload http://ciserver/nexus/content/repositories/snapshots/com.corporatename/exampleCartridge/1.0.0.0-SNAPSHOT/zips/exampleCartridge-share-1.0.0.0-SNAPSHOT.zip
Upload http://ciserver/nexus/content/repositories/snapshots/com.corporatename/exampleCartridge/1.0.0.0-SNAPSHOT/zips/exampleCartridge-share-1.0.0.0-SNAPSHOT.zip.sha1
Upload http://ciserver/nexus/content/repositories/snapshots/com.corporatename/exampleCartridge/1.0.0.0-SNAPSHOT/ivys/ivy-1.0.0.0-SNAPSHOT.xml
Upload http://ciserver/nexus/content/repositories/snapshots/com.corporatename/exampleCartridge/1.0.0.0-SNAPSHOT/ivys/ivy-1.0.0.0-SNAPSHOT.xml.sha1
:exampleCartridge:publish
:generateDescriptorFileForIvyPublication
Download http://ciserver/nexus/content/repositories/snapshots/com.corporatename/exampleCartridge/1.0.0.0-SNAPSHOT/ivys/ivy-1.0.0.0-SNAPSHOT.xml
:publishIvyPublicationToSnapshotsRepository
Upload http://ciserver/nexus/content/repositories/snapshots/com.corporatename.set/corp_componentset/1.0.0.0-SNAPSHOT/ivys/ivy-1.0.0.0-SNAPSHOT.xml

Upload http://ciserver/nexus/content/repositories/snapshots/com.corporatename.set/corp_componentset/1.0.0.0-SNAPSHOT/ivys/ivy-1.0.0.0-SNAPSHOT.xml.sha1
:publish

BUILD SUCCESSFUL

Total time: 49.762 secs
Finished: SUCCESS

The artifacts in the artifact repository:

Jenkins overview page:

For a better overview of the existing projects in Jenkins a separate tab Intershop Project was created.

Build Item for Snapshot of Assembly

Create a new build item Assembly corporate_assembly:

Parameter
Value
Description
Item nameassembly_webshopThe item name is also used for the directory path. Do not use spaces in this configuration.
Build typeBuild a free-style software project 
Prepare an environment for the run[selected] 
Keep Jenkins Environment Variables[selected] 
Keep Jenkins Build Variables[selected] 
- Properties Content

COMPONENT_SET=com.corporate.set.corp_componentset
COMPONENT_SET_VERSION=1.0.0.0

 
Advanced Project Options  
Display NameAssembly corporate_assemblyThis is used for the item name on the web front end.
DescriptionCreate a snapshot build of the assembly. 
Source Code ManagementSubversion 
Repository URLhttp://ciserver/svn/intershop/assemblies/corporate_assembly/trunkURL of the project assembly.
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directorycorporate_assemblyThis is the target path in the work space directory for the the Subversion checkout.
Repository URLhttp://ciserver/svn/intershop/devops/ci_server/host_configs/trunk 
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directoryhost_configsThis is the folder with names of hosts on which the assembly build can be executed.
- Repository browserCollabnet 
- - URLhttp://ciserver/viewvc/intershop 
Build TriggersPoll SCM 
- ScheduleH/5 * * * *The job will check the VCS for changes every 5 minutes.
Build Environment  
Inject passwords to the build as environment variables[selected]Password will be defined for the environment.
-- Global passwords[selected]Global configured password will be used.
BuildExecute ShellThis is an example on a Linux server. On Windows it is necessary to select Execute Windows batch command.

Command

Command
export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home
export ENVIRONMENT_PROPS="${WORKSPACE}/host_configs/ciserver/environment.properties"
 
# JENKINS-19222 (NODE_NAME is not defined on master)
if [ "${NODE_NAME}" != "master" -a "${NODE_NAME}" != "" ]
then
	export ENVIRONMENT_PROPS="${WORKSPACE}/host_configs/${NODE_NAME}/environment.properties"
fi
 
cd corporate_assembly
sh ./gradlew build publish -PreleaseWithDump=true -PRepoUserLogin=<deploy-user-login> -PRepoUserPasswd=$DEPLOY_USER_PASSWORD \
-PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS} 
LineComment
1Provide the GRADLE_USER_HOME (Global property BASE_GRADLE_USER_HOME is used).
2The default value of ENVIRONMENT_PROPS is set to the configuration of the build machine.
5If the process runs on a remote agent, the configuration should be changed.
10Change the working directory to the assembly folder.
11

Run gradle including the following tasks:

buildCreate and test all artifacts.

publish

Publish artifacts of the assembly to the repository. The database export will be also published.

The following project properties are defined:

-PreleaseWithDump=true
The database export will be published with the result of the project.
Therefore, a deployment and dbinit runs before.
-PRepoUserLogin=<deploy-user-login> 
-PRepoUserPasswd=$DEPLOY_USER_PASSWORD
User with password for the publishing on the artifact repository
-PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} 
-PtestEnvironmentProperties=${ENVIRONMENT_PROPS}
Settings for the deployment and database initialization
Log output
...
:packEncryptionConfig
:publishIvyPublicationToBuildRepository SKIPPED
:publishIvyPublicationToSnapshotsRepository

Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/dmps/database-dump-dump-1.0.0.0-SNAPSHOT.dmp

Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/dmps/database-dump-dump-1.0.0.0-SNAPSHOT.dmp.sha1
Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/zips/encryption-config-encryption-config-1.0.0.0-SNAPSHOT.zip
Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/zips/encryption-config-encryption-config-1.0.0.0-SNAPSHOT.zip.sha1
Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/gradles/deploy-deploy-gradle-1.0.0.0-SNAPSHOT.gradle
Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/gradles/deploy-deploy-gradle-1.0.0.0-SNAPSHOT.gradle.sha1
Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/gradles/deploy-settings-deploy-settings-gradle-1.0.0.0-SNAPSHOT.gradle
Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/gradles/deploy-settings-deploy-settings-gradle-1.0.0.0-SNAPSHOT.gradle.sha1
Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/ivys/ivy-1.0.0.0-SNAPSHOT.xml
Upload http://ciserver/nexus/content/repositories/snapshots/org.corporate.assembly/corporate_assembly/1.0.0.0-SNAPSHOT/ivys/ivy-1.0.0.0-SNAPSHOT.xml.sha1
:publishIvyPublicationToTestRepository SKIPPED
:publishTestAssemblyPublicationToBuildRepository SKIPPED
:publishTestAssemblyPublicationToSnapshotsRepository SKIPPED
:publish

BUILD SUCCESSFUL

Total time: 40 mins 2.232 secs

Finished: SUCCESS

The artifacts in the artifact repository:

Jenkins overview page:

For a better overview of the existing projects in Jenkins a separate tab Intershop Project was created. The duration of the assembly build depends on the performance of the build machine and the database.

Build Item for Release Build

Create a new build item Release webshop:

Parameter
Value
Description
Item namewebshop_releaseThe item name is also used for the directory path. Do not use spaces in this configuration.
Build typeBuild a free-style software project 
Prepare an environment for the run[selected] 
Keep Jenkins Environment Variables[selected] 
Keep Jenkins Build Variables[selected] 
- Properties Content

PUBLISH_STATUS=release

COMPONENT_SET=com.corporate.set.corp_componentset
COMPONENT_SET_VERSION=1.0.0.0

 
Advanced Project Options  
Display NameRelease "webshop"This is used for the item name on the web front end.
DescriptionCreate the release of all artifacts of the "webshop" project. 
Source Code ManagementSubversion 
Repository URL

http://ciserver/svn/intershop/componentsets/corp_componentset/trunk  

URL of the project component set.
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directorycorp_componentsetThis is the target path in the workspace directory for the the Subversion checkout.
Source Code ManagementSubversion 
Repository URLhttp://ciserver/svn/intershop/assemblies/corporate_assembly/trunkURL of the project assembly
- CredentialsUsername / PasswordSelect user and password.
Local module directorycorporate_assemblyThis is the target path in the workspace directory for the the Subversion checkout.
Repository URLhttp://ciserver/svn/intershop/devops/ci_server/host_configs/trunk 
- CredentialsUsername / PasswordSelect Add and configure this parameter in the dialog.
Local module directoryhost_configsThis is the folder with names of hosts on which the assembly build can be executed.
- Repository browserCollabnet 
- - URLhttp://ciserver/viewvc/intershop 
Build Triggers[empty] 
Build Environment  
Inject passwords to the build as environment variables[selected]Password will be defined for the environment.
-- Global passwords[selected]Global configured password will be used.

The following build steps must be configured:

Execute shell - Create build no
NEW_BUILD_NO=`date +%Y%m%d%H%M%S`
echo "BUILD_NO = .${NEW_BUILD_NO}" > ${WORKSPACE}/buildno.properties
Inject environment variables - Set build no for environment
Properties File Path${WORKSPACE}/buildno.properties
Execute shell - Publish project component set
export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home
cd corp_componentset
sh ./gradlew publish -PRepoUserLogin=<deploy-user-login> -PRepoUserPasswd=$DEPLOY_USER_PASSWORD
Execute shell - Publish project assembly
 export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home
export ENVIRONMENT_PROPS="${WORKSPACE}/host_configs/ciserver/environment.properties"
  
# JENKINS-19222 (NODE_NAME is not defined on master)
if [ "${NODE_NAME}" != "master" -a "${NODE_NAME}" != "" ]
then
    export ENVIRONMENT_PROPS="${WORKSPACE}/host_configs/${NODE_NAME}/environment.properties"
fi
  
cd corporate_assembly
sh ./gradlew build publish -PreleaseWithDump=true -PRepoUserLogin=<deploy-user-login> -PRepoUserPasswd=$DEPLOY_USER_PASSWORD \
-PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS}
Log output
...
:generateDescriptorFileForIvyPublication
:packEncryptionConfig
:publishIvyPublicationToBuildRepository SKIPPED
:publishIvyPublicationToReleasesRepository

Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/dmps/database-dump-dump-1.0.0.0.20140718182429.dmp
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/dmps/database-dump-dump-1.0.0.0.20140718182429.dmp.sha1
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/zips/encryption-config-encryption-config-1.0.0.0.20140718182429.zip
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/zips/encryption-config-encryption-config-1.0.0.0.20140718182429.zip.sha1
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/gradles/deploy-deploy-gradle-1.0.0.0.20140718182429.gradle
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/gradles/deploy-deploy-gradle-1.0.0.0.20140718182429.gradle.sha1
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/gradles/deploy-settings-deploy-settings-gradle-1.0.0.0.20140718182429.gradle
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/gradles/deploy-settings-deploy-settings-gradle-1.0.0.0.20140718182429.gradle.sha1
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/ivys/ivy-1.0.0.0.20140718182429.xml
Upload http://ciserver/nexus/content/repositories/releases/org.corporate.assembly/corporate_assembly/1.0.0.0.20140718182429/ivys/ivy-1.0.0.0.20140718182429.xml.sha1
:publishIvyPublicationToTestRepository SKIPPED
:publishTestAssemblyPublicationToBuildRepository SKIPPED
:publishTestAssemblyPublicationToReleasesRepository SKIPPED
:publish

BUILD SUCCESSFUL

Total time: 39 mins 54.281 secs

Finished: SUCCESS

The artifacts in the artifact repository:

That is the final Jenkins overview page:

Disclaimer
The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.
Home
Knowledge Base
Product Releases
Log on to continue
This Knowledge Base document is reserved for registered customers.
Log on with your Intershop Entra ID to continue.
Write an email to supportadmin@intershop.de if you experience login issues,
or if you want to register as customer.