Branch test

This commit is contained in:
Sebastien 2018-03-01 13:17:32 +01:00
parent b12383b97a
commit fc6ee7bf2d
3 changed files with 16 additions and 3 deletions

View File

@ -3,6 +3,7 @@ RUN apt-get update
RUN apt-get -y upgrade RUN apt-get -y upgrade
RUN apt-get -y install openjdk-8-jre openjdk-8-jdk curl wget RUN apt-get -y install openjdk-8-jre openjdk-8-jdk curl wget
WORKDIR /bot_src WORKDIR /bot_src
ENV BRANCH_NAME=$BRANCH_NAME
ADD DownloadLast.sh /bot_src/ ADD DownloadLast.sh /bot_src/
RUN chmod +x DownloadLast.sh RUN chmod +x DownloadLast.sh
RUN ./DownloadLast.sh RUN ./DownloadLast.sh

View File

@ -4,8 +4,14 @@
data=$(curl -g "https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts") data=$(curl -g "https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts")
relativePath=$(grep -oPm1 "(?<=<relativePath>)[^<]+" <<< "$data") relativePath=$(grep -oPm1 "(?<=<relativePath>)[^<]+" <<< "$data")
jarFile=$(grep -oPm1 "(?<=<fileName>)[^<]+" <<< "$data") jarFile=$(grep -oPm1 "(?<=<fileName>)[^<]+" <<< "$data")
url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/artifact/"${relativePath}
if [[ $BRANCH_NAME=="master" ]]; then
url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/artifact/"${relativePath}
else
url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle%20Devel/lastStableBuild/artifact/"${relativePath}
fi
echo ${url} echo ${url}
wget ${url} -O bot.jar wget ${url} -O bot.jar

10
Jenkinsfile vendored
View File

@ -12,8 +12,14 @@ node {
} }
} }
stage('Gradle Buil'){ stage('Gradle Build'){
build job: 'Bot Discord Gradle', wait: true script {
if (env.BRANCH_NAME == 'master') {
build job: 'Bot Discord Gradle', wait: true
} else {
build job: 'Bot Discord Gradle devel', wait: true
}
}
} }
stage('Build image') { stage('Build image') {
/* This builds the actual image; synonymous to /* This builds the actual image; synonymous to