Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

AJ-106 Tag docker images #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ $docker build -f DockerfileJamesTlsKeyContainer -t keystore .
$docker run -v /keys --name keystore keystore
----

=== Public James images with version to docker hub
====Edit the predefined parameters by adding new
version=<james_version>

=== Launch Jenkins on the specified branch
If you change the workflow-job and would like to launch Jenkins build on new branch

====Create new "Workflow" which point to you james-jenkins branch with
====Create new "Workflow" which point to your james-jenkins branch with

Repositories point to your github repository
Repositories point to your branch
Expand Down
37 changes: 25 additions & 12 deletions workflow-job
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ def author = extractUsername()
def authorParentURL = "https://github.com/${author}/james-project.git"
def repoName = extractRepoName()

def dockerImageJamesCassandra = appendVersion("linagora/james-project")
def dockerImageJamesCassandraLDAP = appendVersion("linagora/james-ldap-project")
def dockerImageJamesSpringJPA = appendVersion("linagora/james-jpa-spring")
def dockerImageJamesGuiceJPA = appendVersion("linagora/james-jpa-guice")
def dockerImageJamesGuiceJPASample = appendVersion("linagora/james-jpa-sample")

// Not given optional parameters are set to null
def propertyMissing(String name) { null }

Expand All @@ -30,6 +36,13 @@ public String extractRepoName() {
return "${repoURL}".split('/')[4].split('\\.')[0];
}

public String appendVersion(String dockerImageName) {
if (version != null) {
return dockerImageName + "-${version}";
}
return dockerImageName;
}

public class CommitStatuses implements Serializable {
def commitStatuses;

Expand Down Expand Up @@ -504,33 +517,33 @@ flows["${sha1}"] = {
def dUser = dockerUser();
def dPassword = dockerPassword();
sh "docker login -u ${dUser} -p ${dPassword}"
sh "docker tag -f ${images.jamesCassandra} linagora/james-project"
sh "docker push linagora/james-project"
sh "docker tag -f ${images.jamesCassandra} ${dockerImageJamesCassandra}"
sh "docker push ${dockerImageJamesCassandra}"

sh "docker tag -f ${images.jamesJava6} linagora/james-jpa-spring"
sh "docker push linagora/james-jpa-spring"
sh "docker tag -f ${images.jamesJava6} ${dockerImageJamesSpringJPA}"
sh "docker push ${dockerImageJamesSpringJPA}"

sh "docker tag -f ${images.jamesJPA} linagora/james-jpa-guice"
sh "docker push linagora/james-jpa-guice"
sh "docker tag -f ${images.jamesJPA} ${dockerImageJamesGuiceJPA}"
sh "docker push ${dockerImageJamesGuiceJPA}"

sh "docker tag -f ${images.jamesCassandraLdap} linagora/james-ldap-project"
sh "docker push linagora/james-ldap-project"
sh "docker tag -f ${images.jamesCassandraLdap} ${dockerImageJamesCassandraLDAP}"
sh "docker push ${dockerImageJamesCassandraLDAP}"

sh "cd dockerfiles/run/guice/provisioned; docker build --tag=${images.jamesJpaSample} ."

sh "docker tag -f ${images.jamesJpaSample} linagora/james-jpa-sample"
sh "docker push linagora/james-jpa-sample"
sh "docker tag -f ${images.jamesJpaSample} ${dockerImageJamesGuiceJPASample}"
sh "docker push ${dockerImageJamesGuiceJPASample}"

publishing.success();
}
stage "Continuous Deployment"
node {
setDockerHost(continuousDeploymentDockerIp)
sh "docker pull linagora/james-project"
sh "docker pull ${dockerImageJamesCassandra}"
if (isAlive("james-project")) {
sh "docker rm -f james-project"
}
sh "docker run --hostname linagora.com -p '80:80' -p '25:25' -p '110:110' -p '143:143' -p '465:465' -p '587:587' -p '993:993' -p '8000:8000' --link cassandra:cassandra --link elasticsearch:elasticsearch -d --name james-project -v ${continuousDeploymentConfigurationPath}:/root/conf -t linagora/james-project"
sh "docker run --hostname linagora.com -p '80:80' -p '25:25' -p '110:110' -p '143:143' -p '465:465' -p '587:587' -p '993:993' -p '8000:8000' --link cassandra:cassandra --link elasticsearch:elasticsearch -d --name james-project -v ${continuousDeploymentConfigurationPath}:/root/conf -t ${dockerImageJamesCassandra}"
continuousDeployment.success();
}
}
Expand Down