diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c5c497b --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,34 @@ +// https://github.com/CookieFactoryInSpring/demo-module-maven/blob/demo-jenkins/Jenkinsfile +// https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html + +pipeline { + agent any + environment { + REPO_USER = credentials('artifactory-user-id') + REPO_USER_PWD = credentials('artifactory-apikey-id') + } + stages { + stage ('Initialize') { + steps { + sh ''' + echo "PATH = ${PATH}" + echo "M2_HOME = ${M2_HOME}" + cp assets/settings.xml ${M2_HOME}/ + ls -lah ${M2_HOME} + java -version + mvn -version + ''' + } + } + stage('Verify') { + steps { + sh "cd backend && mvn clean verify" + } + } + stage('Build all') { + steps { + sh "cd backend && mvn -Drepo.id=snapshots clean deploy" + } + } + } +} diff --git a/agent/Dockerfile b/agent/Dockerfile new file mode 100644 index 0000000..c365e0d --- /dev/null +++ b/agent/Dockerfile @@ -0,0 +1,17 @@ +FROM jenkins/agent:latest-jdk17 + +ENV PATH="$PATH:/home/jenkins/.local/bin" +ENV M2_HOME="/home/jenkins/.m2" + +RUN mkdir -p ~/.local/bin \ + && mkdir -p ~/.m2 \ + # Maven + && curl -L https://dlcdn.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz --output maven.tgz \ + && tar xzvf maven.tgz \ + && mv apache-maven-*/* ~/.local/ \ + && rm -rf apache-maven-*/ maven.tgz \ + # Docker + && curl -L https://download.docker.com/linux/static/stable/x86_64/docker-23.0.0.tgz --output docker.tgz \ + && tar xzvf docker.tgz \ + && mv docker/* ~/.local/bin/ \ + && rm -rf docker/ docker.tgz diff --git a/agent/build.sh b/agent/build.sh new file mode 100755 index 0000000..f3ebd81 --- /dev/null +++ b/agent/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +docker build -t nrousseau/jenkins-agent-allinone:4.0 . +docker push nrousseau/jenkins-agent-allinone:4.0 diff --git a/assets/settings.xml b/assets/settings.xml new file mode 100644 index 0000000..1d2bf0c --- /dev/null +++ b/assets/settings.xml @@ -0,0 +1,56 @@ + + + + + admin + 4UHq2vpt78vKiqa_ + central + + + admin + 4UHq2vpt78vKiqa_ + snapshots + + + + + + + + false + + central + tcf-libs-release + http://vmpx17.polytech.unice.fr:8081/artifactory/tcf-libs-release + + + + snapshots + tcf-libs-snapshot + http://vmpx17.polytech.unice.fr:8081/artifactory/tcf-libs-snapshot + + + + + + false + + central + tcf-libs-release + http://vmpx17.polytech.unice.fr:8081/artifactory/tcf-libs-release + + + + snapshots + tcf-libs-snapshot + http://vmpx17.polytech.unice.fr:8081/artifactory/tcf-libs-snapshot + + + artifactory + + + + artifactory + + \ No newline at end of file diff --git a/backend/pom.xml b/backend/pom.xml index 13de6bb..c0cb7f5 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -124,4 +124,12 @@ + + + snapshots + 0375b9d96ca0-snapshots + http://vmpx17.polytech.unice.fr:8081/artifactory/tcf-libs-snapshot-local + + +