Merge branch 'devel'
This commit is contained in:
commit
7d8b116e3c
@ -3,9 +3,11 @@ 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
|
||||
ARG BUILD_NBR
|
||||
ARG BRANCH_NAME
|
||||
ADD DownloadLast.sh /bot_src/
|
||||
RUN chmod +x DownloadLast.sh
|
||||
RUN ./DownloadLast.sh
|
||||
RUN ./DownloadLast.sh ${BRANCH_NAME} ${BUILD_NBR}
|
||||
ENV PORT=8080
|
||||
ENV TOKEN=10
|
||||
CMD java -jar bot.jar -t ${TOKEN}
|
||||
|
@ -1,11 +1,19 @@
|
||||
#!/bin/bash
|
||||
#This script download the last stable build on jenkins
|
||||
echo "Branch: "$1
|
||||
if [[ $1 = "master" ]]
|
||||
then
|
||||
base_url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild"
|
||||
else
|
||||
base_url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle%20Devel/lastStableBuild/"
|
||||
fi
|
||||
|
||||
data=$(curl -g "https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts")
|
||||
data=$(curl -s -g ${base_url}"/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts")
|
||||
relativePath=$(grep -oPm1 "(?<=<relativePath>)[^<]+" <<< "$data")
|
||||
jarFile=$(grep -oPm1 "(?<=<fileName>)[^<]+" <<< "$data")
|
||||
url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/artifact/"${relativePath}
|
||||
echo ${url}
|
||||
wget ${url} -O bot.jar
|
||||
|
||||
|
||||
|
||||
wget ${base_url}"/artifact/"${relativePath} -O bot.jar -nv
|
||||
|
||||
|
||||
|
34
Jenkinsfile
vendored
34
Jenkinsfile
vendored
@ -1,24 +1,46 @@
|
||||
node {
|
||||
def app
|
||||
stage('Clone') { // for display purposes
|
||||
// Get some code from a GitHub repository
|
||||
git url: 'https://github.com/BrokenFire/BrokenDiscordBot.git'
|
||||
// Get some code from a GitHub repository
|
||||
echo env.BRANCH_NAME
|
||||
script {
|
||||
if (env.BRANCH_NAME == 'master') {
|
||||
git url: 'https://github.com/BrokenFire/BrokenDiscordBot.git', branch: 'master'
|
||||
} else {
|
||||
git url: 'https://github.com/BrokenFire/BrokenDiscordBot.git', branch: 'devel'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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
|
||||
* docker build on the command line */
|
||||
|
||||
app = docker.build("brokenfire/brokendiscordbot","--rm=true .")
|
||||
app = docker.build("brokenfire/brokendiscordbot",'--build-arg BUILD_NBR=${BUILD_NUMBER} --build-arg BRANCH_NAME=${BRANCH_NAME} --rm=true .')
|
||||
}
|
||||
stage('Push image') {
|
||||
/* Finally, we'll push the image with two tags:
|
||||
* First, the incremental build number from Jenkins
|
||||
* Second, the 'latest' tag.
|
||||
* Pushing multiple tags is cheap, as all the layers are reused. */
|
||||
app.push()
|
||||
def docker_tag
|
||||
script {
|
||||
if (env.BRANCH_NAME == 'master') {
|
||||
app.push(docker_tag)
|
||||
} else {
|
||||
app.push("devel")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
stage('Cleaning'){
|
||||
|
@ -31,7 +31,7 @@ jar.doFirst {
|
||||
}
|
||||
|
||||
jar {
|
||||
|
||||
delete "${buildDir}/libs/*"
|
||||
baseName = 'DiscordBot'
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user