This document describes the setup and configuration of the base processes in a Continuous Integration Environment (CI).
Note
This document is the predecessor of Cookbook - Setup of CI Infrastructure (valid to Gradle Tools 2.7) and is obsolete with Intershop 7.6 and GradleTools 2.7.0.
This cookbook requires Intershop Gradle tools version 2.3. Previous versions of this document show how to deal with the
The Intershop Gradle Tools and this document make no strong assumptions which artifact repository server, continuous integration server (CI server) or version control system (VCS) have to be used. This cookbook nonetheless provides examples for using Sonatype Nexus, Jenkins and Subversion (SVN).
This is an overview of all necessary components:
DVD-based delivery with Gradle Tools 2.3 or newer
If you are using an Intershop version with Gradle Tools 2.3 or newer, that is still delivered via DVD (like Intershop 7.5 starting with 7.5.2):
This concept allows for mixed operation, where you may either use an imported delivery, the public repository, or even both at the same time.
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.
DVD-based delivery with Gradle Tools 2.3 or newer
If you are using an Intershop version with Gradle Tools 2.3 or newer, that is still delivered via DVD (like Intershop 7.5 starting with 7.5.2), you have to import its artifacts into your repository between steps 1a and 2.
See the according recipe of the previous version of this Cookbook for details.
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
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.
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 |
---|---|
central | For Maven artifacts available from Maven Central. Ideally, this is set up as a proxy to Maven Central, that caches all already retrieved artifacts. |
distributions | Repository for Gradle distributions. |
gradle | For corporate/ project Gradle configuration. |
releases | For corporate/ project releases. |
ishreleases | For all artifacts released by Intershop. Note This is for backward compatibility only to provide artifacts for versions with DVD-based delivery. Newer versions only rely on ishrepo ! |
ishrepo | This is the proxy repository for the Intershop public repository (https://repo.intershop.de). Note If you are only using a DVD-based delivery of Intershop 7, you can leave out the configuration of this repository. |
components | This repository units gradle, releases, ishreleases and ishrepo in one group. |
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. |
Download and install Sonatype Nexus:
URL | http://www.sonatype.org/ |
Download URL | |
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 | Repostiory Type | Remote Storage Location | Remarks |
---|---|---|---|---|
Central | central | Proxy | http://repo1.maven.org/maven2/ | |
Intershop | ishrepo | Proxy | https://repo.intershop.de/content/repositories/<contract-id> | See Setup the Intershop Proxy below for details on how to get your contract-id and authorization information. |
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.
The Intershop Proxy Repository in your repository makes available the artifacts according to your contract with Intershop. So you need to log on to the Intershop Knowledge Base and retrieve your credential tokens as well as the contract-id from your contract details. The contract-id has to be appended to the proxy URL in Remote Storage Location textfield. Then you need to check the Authentication (optional) box and provide your credential tokens.
Note
Possible pitfall, when attempt to access files via this proxy repository. If the following message appears:404 - Automatic routing filter rejected remote request for path /com.intershop.build/intershop-ci-bootstrap/2.3.0.0/zips/intershop-ci-setup-zip-2.3.0.0.zip from M2Repository(id=ishrepo)
Apply the following workaround.
Switch to the tab Routing and make sure Discovery is unchecked.
The artifact download is now possible.
The following repositories must be created and configured as hosted repositories:
Name | ID | Repository Type | Repository Policy | Deployment Policy | Usage |
---|---|---|---|---|---|
Distributions | distributions | hosted | Release | Disable Redeploy | for project Gradle distribution |
Gradle | gradle | hosted | Release | Disable Redeploy | for project Gradle plugins |
Releases | releases | hosted | Release | Disable Redeploy | for corporate / project releases |
Intershop Releases | ishreleases | hosted | Release | Disable Redeploy | for all released artifacts of Intershop prior to 7.5.2 |
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 | Repository Names |
---|---|---|---|
Components | components | group | Gradle, Releases, Intershop Releases, Intershop |
Once you created the new repository group, switch to the configuration tab an move the needed repository from Available Repositories to Ordered Group Repositories:
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 |
Distributions | http://<Hostname:Port>/nexus/content/repositories/distributions |
Gradle | http://<Hostname:Port>/nexus/content/repositories/gradle |
Releases | http://<Hostname:Port>/nexus/content/repositories/releases |
Intershop Releases | http://<Hostname:Port>/nexus/content/repositories/ishreleases |
Intershop | http://<Hostname:Port>/nexus/content/repositories/ishrepo |
Components | http://<Hostname:Port>/nexus/content/groups/components |
Snapshots | http://<Hostname:Port>/nexus/content/repositories/snapshots |
The resulting repository overview should be something like this:
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?
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 | |
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, reps. 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 |
---|---|
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.
|
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 Plugin* | This 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.
|
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. |
The plugins marked with a star are mandatory for the following documentation.
It is necessary to add / change the following configuration settings:
Add global properties:
Variable | Value Linux |
---|---|
BASE_GRADLE_USER_HOME | /opt/intershop/build |
DEPLOY_USER_NAME | deploy |
Add global password for deployment user (see Recipe: Configure Artifact Repository Server > User, Roles and Permissions)
Add password.
Name | DEPLOY_USER_PASSWORD |
---|---|
Password | e.g., admin123 |
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 provided Intershop template?
Meet the minimum system requirements.
See the following recipe:
Check your active Java version:
>java -version java version "1.7.0_72" Java(TM) SE Runtime Environment (build 1.7.0_72-b14) Java HotSpot(TM) 64-Bit Server VM (build 14.72-b09, mixed mode)
Download the latest version of the bootstrap package for the CI setup via your proxy.
See the discussion below for details.
Unzip the the contents to a directory of your choice.
mkdir intershop-ci unzip intershop-ci-setup-zip-*.zip -d intershop-ci
//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:
gradlew intershopCISetupAll createHotFixImport
./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.
Copy files to <setupDirectory>/componentsets/p_oracle/3rd_oracle/staticfiles/cartridge/lib.
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.
Starting with Intershop 7.5.2.0 your own local repository server is running a proxy repository of the Intershop releases. Initially you need to fetch the CI Bootstrap Package manually to have it available in your repository and to have it available locally as well. To accomplish this, you can use wget
on your machine and call:
$ wget http://<your-reposerver>/nexus/content/repositories/ishrepo/com.intershop.build/intershop-ci-bootstrap/2.3.0.0/zips/intershop-ci-setup-zip-2.3.0.0.zip
This downloads the release through your previously defined proxy repository of the Intershop artifacts. Accordingly it will be also available in your repository. Alternatively, if you have X on your machine, you may just copy the URL shown above into your browser and fetch it this way. The URL above might differ from your repository configuration. On the default installation the repository base path (/nexus/content/repositories) contains the /nexus/ path, if you change it, change it here accordingly.
corporateName
.corporateDisplayName
.productCopyrightOwner
.projectName
.projectDisplayName
.Output directory: Specify a directory to generate sources into in the property setupDirectory
.
Repository base URL: Specify the repository base URL of your artifact repository server in property repoBaseURL
.
ishrepo
repository (your proxy repository) on the marked line in the buildscript
section. 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.
apply plugin: 'ci-setup' IntershopCISetup { directories { setupDirectory = '/home/developer/intershop-ci/sources' devOpsDir = '/home/developer/devops-resources' componentSetsDir = "${setupDirectory}/componentsets" assembliesDir = "${setupDirectory}/assemblies" } }
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" } }
The build.gradle file comes with default IDs for all important repositories. It is possible to rename them and 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 ishrepo
repository.
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 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.
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.
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:
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).
Line | Generated by | Project or corporate artifact | Used in | Description |
---|---|---|---|---|
2-11 | createAssembly | project | Setup CI Build For Project Artifacts | See Concept - Continuous Delivery Tools, Concept - Gradle Assembly Tools |
13-27 | createComponentSet | project | Setup CI Build For Project Artifacts | See Concept - Continuous Delivery Tools, Concept - Gradle Build Tools |
28-40 | 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. |
42-48 | ciSetup | corporate | Setup CI Build For Corporate Artifacts, Setup CI Build For Project Artifacts | Configuration specific to running the CI builds (snapshot + release) including host-specific configuration |
50-55 | createDeploymentConfig | project | Configuration template for running a deployment outside of the CI and development environment, e.g., for demo, integration tests and production | |
57-59 | createDeveloperHome | project | Setup 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-70 | createCorporateDistribution | corporate | Setup CI Build For Corporate Artifacts | See Concept - Gradle Build Tools |
71-84 | createCorporateConfiguration | corporate | See Concept - Gradle Build Tools | |
85-93 | createHotFixImport | corporate | Cookbook - Hotfix Recipes | Tool for importing hotfixes from a zip-file to the repository server. |
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-ci-setup/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-ci-setup directory by executing:
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"
Add your corporate plugin configuration and 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" 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"
Add the component set of the project by executing (assuming componentSetName
is 'corp_componentset'):
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"
Add the assembly of the project (assuming assemblyName
is 'corporate_assembly') by executing:
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"
Add the Oracle JDBC Drivers Component Set by executing:
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"
Add developer scripts (assuming projectName
is 'corporatewebshop') by executing:
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"
Add demo deployment scripts (assuming projectName
is 'corporatewebshop') 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/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"
Add CI server user home scripts and 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/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"
Add hotfix import tool by executing:
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"
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 sh ./gradlew clean publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>
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.
Set up an automated process for building the corporate plugin configuration. Configure the process to:
Execute the following commands:
cd corporate-plugins sh ./gradlew clean publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>
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.
Set up an automated process for managing a Gradle user home (see discussion on why this is necessary). Configure the process to:
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.
Set up an automated process for building the Oracle JDBC drivers component set. Configure the process to:
Execute the following commands:
cd p_oracle sh ./gradlew clean publish -I init.gradle -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>
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.
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 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.
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.)
export HOMEDIR=${BASE_GRADLE_USER_HOME}/gradle_user_home mkdir ${HOMEDIR}_<build number> cp ${WORKSPACE}/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
set HOMEDIR=%BASE_GRADLE_USER_HOME%\gradle_user_home mkdir "%HOMEDIR%_<build number>" copy "user_home" "%HOMEDIR%_<build number>" IF EXIST "%HOMEDIR%" ( move /Y "%HOMEDIR%" "%HOMEDIR%_before_<build number>" move /Y "%HOMEDIR%_<build number>" "%HOMEDIR%" rmdir /s /Q "%HOMEDIR%_before_<build number>" ) ELSE ( move /Y "%HOMEDIR%_<build number>" "%HOMEDIR%" )
Line | Description |
---|---|
1 | Create a variable for the directory. BASE_GRADLE_USER_HOME is a global variable. See "Directory for Additional Build Directories" in Recipe - Configure CI Server. |
2 | Create a new directory. |
3 | Copy the files from source directory to new directory. |
5 - 7 | The old home directory will be replaced with the new one. If this step finished successfully, the old directory will be removed. |
9 | Runs only if there is a home directory before. |
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.
Changes in the corporate plugin configuration are effective 24h hours after rebuilding at latest (this is Gradles default cache timeout). You can 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).
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 | |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/devops/gradle/corporate-distribution/trunk | 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. |
- Repository browser | Collabnet | Type of a repository browser |
- - URL | http://ciserver/viewvc/intershop/devops/gradle/corporate-distribution/trunk | URL for the repository browser of this project |
Build Triggers | [no selection] | |
Build Environment | ||
- 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 export GRADLE_USER_HOME=${WORKSPACE}/gradle_user_home cd corporate-distribution sh ./gradlew clean publish \ -PRepoUserLogin=$DEPLOY_USER_NAME \ -PRepoUserPasswd=$DEPLOY_USER_PASSWORD | Before the build runs the old build should be deleted. Therefore, the target DEPLOY_USER_PASSWORD was specified as global password. WORKSPACE is a environment-variable of Jenkins. |
- Command (Windows) | Publish corporate distribution set GRADLE_USER_HOME=%WORKSPACE%/gradle_user_home cd corporate-distribution gradlew clean publish ^ -PRepoUserLogin=%DEPLOY_USER_NAME% ^ -PRepoUserPasswd=%DEPLOY_USER_PASSWORD% |
... :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:
Create a new build item Corporate Plugin Configuration:
Parameter | Value | Description |
---|---|---|
Item name | corporate-plugins | 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 Plugin Configuration | This is used for the item name on the web frontend. |
Description | Creates a corporate plugin configuration for the main project | |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/devops/gradle/corporate-plugins/trunk | URL of the corporate distribution project |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | corporate-plugins | This is the target path in the workspace directory for the the Subversion checkout. |
- Repository browser | Collabnet | Type of a repository browser |
- - URL | http://ciserver/viewvc/intershop/devops/gradle/corporate-plugins/trunk | URL for the repository browser of this project |
Build Triggers | [no selection] | |
Build Environment | ||
- 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 plugin configuration export GRADLE_USER_HOME=${WORKSPACE}/gradle_user_home cd corporate-plugins sh ./gradlew clean publish \ -PRepoUserLogin=$DEPLOY_USER_NAME \ -PRepoUserPasswd=$DEPLOY_USER_PASSWORD | Before the build runs the old build should be deleted. Therefore, the target DEPLOY_USER_PASSWORD was specified as global password. DEPLOY_USER_NAME was specified as global property. WORKSPACE is a environment-variable of Jenkins. |
- Command (Windows) | Publish corporate plugin configuration set GRADLE_USER_HOME=%WORKSPACE%\gradle_user_home cd corporate-plugins gradlew clean publish ^ -PRepoUserLogin=%DEPLOY_USER_NAME% ^ -PRepoUserPasswd=%DEPLOY_USER_PASSWORD% |
... :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:
Create a new build item Gradle User Home:
Parameter | Value | Description |
---|---|---|
Item name | gradle_user_home | 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 | |
Prepare an environment for the run | [selected] | |
- Keep Jenkins Environment Variables | [selected] | |
- Keep Jenkins Build Variables | [selected] | |
Advanced Project Options | ||
- Display Name | GRADLE_USER_HOME | This is used for the item name on the web frontend. |
Description | Creates/Updates GRADLE_USER_HOME folder | |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/devops/ci_server/user_home/trunk | URL of the CI server home configuration files. |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | user_home | This is the target path in the workspace directory for the the Subversion checkout. |
- Repository browser | Collabnet | Type of a repository browser |
- - URL | http://ciserver/viewvc/intershop/devops/ci_server/user_home/trunk | URL for the repository browser of this project |
Build Triggers | Build periodically | |
- Schedule | H 3 * * 2-6 | The job will run every night from Tuesday to Saturday. |
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) | Create gradle user home/Purge old ones export HOMEDIR=${BASE_GRADLE_USER_HOME}/gradle_user_home mkdir ${HOMEDIR}_${BUILD_NUMBER} cp ${WORKSPACE}/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 | Creates the BUILD_NUMBER is a environment-variable of the Jenkins-item. WORKSPACE is a environment-variable of Jenkins. |
- Command (Windows) | Create gradle user home/Purge old ones set HOMEDIR=%BASE_GRADLE_USER_HOME%\gradle_user_home mkdir "%HOMEDIR%_%BUILD_NUMBER%" copy "%WORKSPACE%\user_home" "%HOMEDIR%_%BUILD_NUMBER%" IF EXIST "%HOMEDIR%" ( move /Y "%HOMEDIR%" "%HOMEDIR%_before_%BUILD_NUMBER%" move /Y "%HOMEDIR%_%BUILD_NUMBER%" "%HOMEDIR%" rmdir /s /Q "%HOMEDIR%_before_%BUILD_NUMBER%" ) ELSE ( move /Y "%HOMEDIR%_%BUILD_NUMBER%" "%HOMEDIR%" ) |
Create a new build item Oracle JDBC Driver component set:
Parameter | Value | Description |
---|---|---|
Item name | p_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 set | 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 | |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/componentsets/p_oracle/trunk | URL of the corporate distribution project |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | p_oracle | This is the target path in the workspace directory for the the Subversion checkout. |
- Repository browser | Collabnet | Type of a repository browser |
- - URL | http://ciserver/viewvc/intershop/ componentsets/p_oracle/trunk | URL for the repository browser of this project |
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. |
-- 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 release of p_oracle export GRADLE_USER_HOME=${WORKSPACE}/gradle_user_home cd p_oracle sh ./gradlew clean publish -I init.gradle \ -PRepoUserLogin=$DEPLOY_USER_NAME \ -PRepoUserPasswd=$DEPLOY_USER_PASSWORD | Before the build runs the old build should be deleted. Therefore the target DEPLOY_USER_PASSWORD was specified as global password. DEPLOY_USER_NAME was specified as global property. WORKSPACE is a environment-variable of Jenkins. |
- Command (Windows) | Publish release of p_oracle set GRADLE_USER_HOME=%WORKSPACE%/gradle_user_home cd p_oracle gradlew clean publish -I init.gradle ^ -PRepoUserLogin=%DEPLOY_USER_NAME% ^ -PRepoUserPasswd=%DEPLOY_USER_PASSWORD% |
... :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:
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?
See the following recipes:
Example
See the discussion for an example using Jenkins and SVN.
Set up up an automated process for a snapshot build of the component set. Configure the process to:
Execute the following commands:
export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home cd <component set name> sh ./gradlew build publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password>
set 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.
Set up an automated process for a snapshot build of the assembly. Configure the process to:
Execute the following commands:
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> sh ./gradlew build publish -PreleaseWithDump=true -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password> \ -PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS}
set COMPONENT_SET=<organization of component set>.<name of component set> set COMPONENT_SET_VERSION=<version of component set without build number/snapshot suffix> set GRADLE_USER_HOME=%BASE_GRADLE_USER_HOME%\gradle_user_home set 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.
Set up an automated process for a release build of component set and assembly. Configure the process to:
Execute the following commands:
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> sh ./gradlew build publish -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password> cd <assembly name> sh ./gradlew build publish -PreleaseWithDump=true -PRepoUserLogin=<deploy user login> -PRepoUserPasswd=<deploy user password> \ -PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS}
set BUILD_NO=.%date:~6,4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2% set GRADLE_USER_HOME=%BASE_GRADLE_USER_HOME%\gradle_user_home set COMPONENT_SET=<organization of component set>.<name of component set> set COMPONENT_SET_VERSION=<version of component set without build number/snapshot suffix> set ENVIRONMENT_PROPS=<workspace directory>\host_configs\<name of executing host>\environment.properties set 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%"
Note
The output of the BUILD_NO expression depends on the date/time configuration of the Windows-System. The example-expression is based on the following output of %date%
and %time%
:
+ echo %date% 31.12.2015 + echo %time% 08:45:40,20
So the expression (%date:~6,4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2%
) returns the value "20151231084540
".
This process should be triggered only manually (e.g., not automatically by polling the VCS).
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.
For a fast developer feedback we suggest to use snapshot builds. Project component set and assembly will be build in different steps.
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 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.
This example assumes that:
Create a new build item Component set corp_componentset:
Parameter | Value | Description |
---|---|---|
Item name | componentset_webshop | 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 | |
Prepare an environment for the run | [selected] | |
- Keep Jenkins Environment Variables | [selected] | |
- Keep Jenkins Build Variables | [selected] | |
Advanced Project Options | ||
- Display Name | Component Set corp_componentset | This is used for the item name on the web frontend. |
Description | Create a snapshot build of the component set. | |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/componentsets/corp_componentset/trunk | URL of the project component set |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | corp_componentset | This is the target path in the workspace directory for the the Subversion checkout. |
- Repository browser | Collabnet | Type of a repository browser |
- - URL | http://ciserver/viewvc/intershop/componentsets/corp_componentset/trunk | URL for the repository browser of this project |
Build Triggers | Poll SCM | |
- Schedule | H/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. |
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 snapshot of component set export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home cd corp_componentset sh ./gradlew publish \ -PRepoUserLogin=$DEPLOY_USER_NAME \ -PRepoUserPasswd=$DEPLOY_USER_PASSWORD | Provide the GRADLE_USER_HOME (Global property BASE_GRADLE_USER_HOME is used). Change to the component set folder. DEPLOY_USER_PASSWORD was specified as global password. DEPLOY_USER_NAME was specified as global property. |
- Command (Windows) | Publish snapshot of component set set GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home cd corp_componentset gradlew publish ^ -PRepoUserLogin=%DEPLOY_USER_NAME% ^ -PRepoUserPasswd=%DEPLOY_USER_PASSWORD% |
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.
Create a new build item Assembly corporate_assembly:
Parameter | Value | Description |
---|---|---|
Item name | assembly_webshop | 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 | |
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 | |
Advanced Project Options | ||
- Display Name | Assembly corporate_assembly | This is used for the item name on the web frontend. |
Description | Create a snapshot build of the assembly. | |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/assemblies/corporate_assembly/trunk | URL of the project assembly. |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | corporate_assembly | This is the target path in the work space directory for the the Subversion checkout. |
- Repository URL | http://ciserver/svn/intershop/devops/ci_server/host_configs/trunk | |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | host_configs | This is the folder with names of hosts on which the assembly build can be executed. |
- Repository browser | Collabnet | |
- - URL | http://ciserver/viewvc/intershop | |
Build Triggers | Poll SCM | |
- Schedule | H/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. |
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)
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_NAME -PRepoUserPasswd=$DEPLOY_USER_PASSWORD \ -PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS}
Command (Windows)
set GRADLE_USER_HOME=%BASE_GRADLE_USER_HOME}%\gradle_user_home set ENVIRONMENT_PROPS=%WORKSPACE%\host_configs\ciserver\environment.properties :: JENKINS-19222 (NODE_NAME is not defined on master) IF NOT "%NODE_NAME%" == "master" IF NOT "%NODE_NAME%" == "" ( set ENVIRONMENT_PROPS=%WORKSPACE%\host_configs\%NODE_NAME%\environment.properties ) cd corporate_assembly gradlew build publish -PreleaseWithDump=true -PRepoUserLogin=%DEPLOY_USER_NAME% -PRepoUserPasswd=%DEPLOY_USER_PASSWORD% ^ -PbuildEnvironmentProperties="%ENVIRONMENT_PROPS%" -PtestEnvironmentProperties="%ENVIRONMENT_PROPS%"
Line | Comment | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | Provide the GRADLE_USER_HOME (Global property BASE_GRADLE_USER_HOME is used). | ||||||||||
2 | The default value of ENVIRONMENT_PROPS is set to the configuration of the build machine. WORKSPACE is a environment-variable of Jenkins. | ||||||||||
5 | If the process runs on a remote agent, the configuration should be changed. | ||||||||||
10 | Change the working directory to the assembly folder. | ||||||||||
11 | Run gradle including the following tasks:
The following project properties are defined:
|
... :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.
Create a new build item Release webshop:
Parameter | Value | Description |
---|---|---|
Item name | webshop_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 | |
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 | |
Advanced Project Options | ||
- Display Name | Release "webshop" | This is used for the item name on the web front end. |
Description | Create the release of all artifacts of the "webshop" project. | |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/componentsets/corp_componentset/trunk | URL of the project component set. |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | corp_componentset | This is the target path in the workspace directory for the the Subversion checkout. |
Source Code Management | Subversion | |
- Repository URL | http://ciserver/svn/intershop/assemblies/corporate_assembly/trunk | URL of the project assembly |
- Credentials | Username / Password | Select user and password. |
- Local module directory | corporate_assembly | This is the target path in the workspace directory for the the Subversion checkout. |
- Repository URL | http://ciserver/svn/intershop/devops/ci_server/host_configs/trunk | |
- Credentials | Username / Password | Select Add and configure this parameter in the dialog. |
- Local module directory | host_configs | This is the folder with names of hosts on which the assembly build can be executed. |
- Repository browser | Collabnet | |
- - URL | http://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:
Linux:
NEW_BUILD_NO=`date +%Y%m%d%H%M%S` echo "BUILD_NO = .${NEW_BUILD_NO}" > ${WORKSPACE}/buildno.properties
Windows:
set NEW_BUILD_NO=%date:~6,4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2% echo BUILD_NO = .%NEW_BUILD_NO% > %WORKSPACE%\buildno.properties
both:
Inject environment variables - Set build no for environment | |
---|---|
Properties File Path | ${WORKSPACE}/buildno.properties |
Linux:
export GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}/gradle_user_home cd corp_componentset sh ./gradlew publish -PRepoUserLogin=$DEPLOY_USER_NAME -PRepoUserPasswd=$DEPLOY_USER_PASSWORD
Windows:
set GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}\gradle_user_home cd corp_componentset gradlew publish -PRepoUserLogin=%DEPLOY_USER_NAME% -PRepoUserPasswd=%DEPLOY_USER_PASSWORD%
Linux:
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_NAME -PRepoUserPasswd=$DEPLOY_USER_PASSWORD \ -PbuildEnvironmentProperties=${ENVIRONMENT_PROPS} -PtestEnvironmentProperties=${ENVIRONMENT_PROPS}
Windows:
set GRADLE_USER_HOME=${BASE_GRADLE_USER_HOME}\gradle_user_home set ENVIRONMENT_PROPS=%WORKSPACE%\host_configs\ciserver\environment.properties :: JENKINS-19222 (NODE_NAME is not defined on master) IF NOT "%NODE_NAME%" == "master" IF NOT "%NODE_NAME%" == "" ( set ENVIRONMENT_PROPS=%WORKSPACE%\host_configs\%NODE_NAME%\environment.properties ) cd corporate_assembly gradlew build publish -PreleaseWithDump=true -PRepoUserLogin=%DEPLOY_USER_NAME% -PRepoUserPasswd=%DEPLOY_USER_PASSWORD% ^ -PbuildEnvironmentProperties="%ENVIRONMENT_PROPS%" -PtestEnvironmentProperties="%ENVIRONMENT_PROPS%"
... :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:
If the repository is accessible over the public internet, it is necessary to configure the security of the repository. This recipe describes a security configuration for Sonatype Nexus.
Once you configured the basic repository the following configuration on the repository is required.
Add 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) |
Gradle | Target Privilege Gradle | Gradle (Repo) | All (Maven 2) |
Releases | Target Privilege Releases | Releases (Repo) | All (Maven 2) |
Intershop Releases | Target Privilege Intershop Releases | Intershop Releases (Repo) | All (Maven 2) |
Snapshots | Target Privilege Snapshots | Snapshots (Repo) | All (Maven 2) |
Central | Target Privilege Central | Central (Repo) | All (Maven 2) |
Add the role configuration and finish this configuration with Save.
Role ID | Name | Role/Privilege Managment |
---|---|---|
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-gradle-full | Role: Gradle (full) | Distributions - (create) Distributions - (delete) Distributions - (read) Distributions - (update) Distributions - (view) Gradle - (create) Gradle - (delete) Gradle - (read) Gradle - (update) Gradle - (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-ishreleases-full | Role: Intershop Releases (full) | Intershop Releases - (create) Intershop Releases - (delete) Intershop Releases - (read) Intershop Releases - (update) Intershop Releases - (view) |
Add the role configuration for a project developer and finish this configuration with Save.
Role ID | Name | Role/Privilege Managment |
---|---|---|
nexus-project-developer | Project Developer | Nexus Developer Role Role: Distributions (read) Role: Components (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 Managment |
---|---|---|
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 role for a special deployment user.
For special artifacts (Intershop releases, Gradle artifacts (distribution, plugins) it is possible to create an special deployment user.
Add the role configuration for a project deployment user and finish this configuration with Save.
Role ID | Name | Role/Privilege Managment |
---|---|---|
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 Managment | 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 Managment | 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 Managment | Project Developer |
It is necessary to extend the local gradle.properties or the environment settings with the necessary credentials.
Process | |
---|---|
| For this task it is necessary to use the deployment user for corporate artifacts. Username and password is part of the command line. Example gradlew clean publish -PRepoUserLogin=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 // this configuration is necessary for the read access export REPO_USER=prj_deployment export REPO_USER_PASSWD=<deploy user password> gradlew clean publish -I init.gradle -PRepoUserLogin=prj_deployment -PRepoUserPasswd=<passwd> |
| 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 export REPO_USER=prj_deployment export REPO_USER_PASSWD=<deploy user password> // Project properties will be used for the write access gradlew build publish -PRepoUserLogin=prj_deployment -PRepoUserPasswd=<deploy user password> It is also possible to specify Java system properties. Example // System properties are used for read access // Project properties will be used for the write access gradlew build publish -DrepoUser=prj_deployment -DrepoUserPasswd=<deploy user password> -PRepoUserLogin=prj_deployment -PRepoUserPasswd=<deploy user password> |
The developer can also specify username 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 Gradle user home.
systemProp.repoUser = <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 this in the keystore of the used JDK. This must be done on all machines, which have access to the repository - developer, build, test and production machines also.
User name and password of users must be stored as plain text on the developer machine as well on the build machine. This login and password can be used also for the login on the repository server directly. So it is also possible to change the password on this way. Sonatype 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 this credentials.