Commit a39fcf2c authored by Patrik Dufresne's avatar Patrik Dufresne Committed by Patrik Dufresne

TASK-1081 Add gitlab cicd

parent 4d986233
Pipeline #410 passed with stages
in 2 minutes and 16 seconds
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
/target
*~
/*.lic
\ No newline at end of file
/*.lic
/.classpath
/.project
/.settings
\ No newline at end of file
image: maven:3-jdk-7
variables:
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
-Dmaven.repo.local=.m2/repository"
# Cache downloaded dependencies and plugins between builds.
cache:
paths:
- .m2/repository
stages:
- build
- publish
before_script:
- export REVISION="$(curl http://git.patrikdufresne.com/pdsl/maven-scm-version/raw/master/version.sh | bash -)"
- echo "REVISION=$REVISION"
test:
stage: build
script:
- mvn -B -Drevision=${REVISION} clean install
sonar:
image: maven:3-jdk-8
stage: build
allow_failure: true
script:
- mvn -B -Drevision=${REVISION} -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN clean verify sonar:sonar
nexus_deploy:
stage: publish
script:
- mvn -B -s ./settings.xml -Drevision=${REVISION} clean install deploy
github_push:
stage: publish
script:
- git push --force https://${GITHUB_USR}:${GITHUB_PWD}@github.com/ikus060/${CI_PROJECT_NAME}.git refs/remotes/origin/${CI_COMMIT_REF_NAME}:refs/heads/${CI_COMMIT_REF_NAME}
- git push https://${GITHUB_USR}:${GITHUB_PWD}@github.com/ikus060/${CI_PROJECT_NAME}.git --tags
gitlab_push:
stage: publish
script:
- git push --force https://${GITLAB_COM_USR}:${GITLAB_COM_PWD}@gitlab.com/pdsl/${CI_PROJECT_NAME}.git refs/remotes/origin/${CI_COMMIT_REF_NAME}:refs/heads/${CI_COMMIT_REF_NAME}
- git push https://${GITLAB_COM_USR}:${GITLAB_COM_PWD}@gitlab.com/pdsl/${CI_PROJECT_NAME}.git --tags
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.patrikdufresne.license</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
pipeline {
environment {
NEXUS = credentials("local-nexus")
GITLAB = credentials("gitlab-jenkins")
GITHUB = credentials("github")
}
parameters {
booleanParam(defaultValue: false, description: 'Generate a release build with a tagged version.', name: 'Release')
}
agent {
docker {
image 'jamesdbloom/docker-java7-maven'
args '-v $HOME/.m2:/root/.m2'
}
}
stages {
stage ('Build') {
steps {
writeFile file: "settings.xml", text: "<settings><servers><server><id>patrikdufresne</id><username>${NEXUS_USR}</username><password>${NEXUS_PSW}</password></server></servers></settings>"
sh 'mvn --settings settings.xml -U -Dmaven.test.failure.ignore=true clean deploy'
}
}
stage ('Release') {
when {
environment name: 'Release', value: 'true'
}
steps {
script {
// We want to pick up the version from the pom
pom = readMavenPom file: 'pom.xml'
version = pom.version.replace("-SNAPSHOT", "-${BUILD_NUMBER}")
}
sh 'git checkout .'
sh "mvn versions:set -DnewVersion=${version}"
sh "mvn --settings settings.xml -U -Dmaven.test.skip=true deploy"
sh """
git config --local user.email "jenkins@patrikdufresne.com"
git config --local user.name "Jenkins"
git tag 'v${version}'
export REPO=`git config remote.origin.url`
git push http://${GITLAB}@\044{REPO#*//} --tags
"""
addInfoBadge "v${version}"
}
}
stage('GitHubPush') {
steps {
sh "git push --force https://${GITHUB}@github.com/ikus060/license.git refs/remotes/origin/${BRANCH_NAME}:refs/heads/${BRANCH_NAME}"
sh "git push https://${GITHUB}@github.com/ikus060/license.git --tags"
}
}
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.patrikdufresne.license</groupId>
<artifactId>com.patrikdufresne.license</artifactId>
<version>0.9-SNAPSHOT</version>
<groupId>com.patrikdufresne</groupId>
<artifactId>license</artifactId>
<version>${revision}</version>
<!-- Define the SCM used for developpement. This information is used by
release:prepare -->
<scm>
<developerConnection>scm:git:http://git.patrikdufresne.com/common/license.git</developerConnection>
<tag>HEAD</tag>
</scm>
<tag>HEAD</tag>
</scm>
<!-- Define the repository. Used by deploy:deploy -->
<distributionManagement>
<repository>
......@@ -30,8 +31,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- generate source package -->
......@@ -80,18 +81,13 @@
<header>src/main/build-tools/license-header.txt</header>
</configuration>
</plugin>
<!-- Force release plugin version -->
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
<!-- Fix surefire bug -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
......
<!--
Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<id>patrikdufresne</id>
<username>${env.NEXUS_USR}</username>
<password>${env.NEXUS_PWD}</password>
</server>
</servers>
</settings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/**
* Copyright(C) 2013 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
* Copyright(C) 2018 Patrik Dufresne Service Logiciel inc <info@patrikdufresne.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment