diff --git a/Dockerfile b/Dockerfile index aab218d..0d6ebc7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ RUN apt-get update RUN apt-get -y upgrade RUN apt-get -y install openjdk-8-jre openjdk-8-jdk curl wget WORKDIR /bot_src +ENV BRANCH_NAME=$BRANCH_NAME ADD DownloadLast.sh /bot_src/ RUN chmod +x DownloadLast.sh RUN ./DownloadLast.sh diff --git a/DownloadLast.sh b/DownloadLast.sh index d15ecbd..d959e52 100755 --- a/DownloadLast.sh +++ b/DownloadLast.sh @@ -4,8 +4,14 @@ data=$(curl -g "https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts") relativePath=$(grep -oPm1 "(?<=)[^<]+" <<< "$data") jarFile=$(grep -oPm1 "(?<=)[^<]+" <<< "$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} + wget ${url} -O bot.jar diff --git a/Jenkinsfile b/Jenkinsfile index dfc4a2c..7ae6f6a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,8 +12,14 @@ node { } } - stage('Gradle Buil'){ - build job: 'Bot Discord Gradle', wait: true + stage('Gradle Build'){ + 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') { /* This builds the actual image; synonymous to