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 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
|
||||||
|
ARG BUILD_NBR
|
||||||
|
ARG 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 ${BRANCH_NAME} ${BUILD_NBR}
|
||||||
ENV PORT=8080
|
ENV PORT=8080
|
||||||
ENV TOKEN=10
|
ENV TOKEN=10
|
||||||
CMD java -jar bot.jar -t ${TOKEN}
|
CMD java -jar bot.jar -t ${TOKEN}
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#This script download the last stable build on jenkins
|
#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")
|
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}
|
|
||||||
echo ${url}
|
|
||||||
wget ${url} -O bot.jar
|
|
||||||
|
wget ${base_url}"/artifact/"${relativePath} -O bot.jar -nv
|
||||||
|
|
||||||
|
|
||||||
|
30
Jenkinsfile
vendored
30
Jenkinsfile
vendored
@ -2,23 +2,45 @@ node {
|
|||||||
def app
|
def app
|
||||||
stage('Clone') { // for display purposes
|
stage('Clone') { // for display purposes
|
||||||
// Get some code from a GitHub repository
|
// Get some code from a GitHub repository
|
||||||
git url: 'https://github.com/BrokenFire/BrokenDiscordBot.git'
|
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'){
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
stage('Gradle Build'){
|
||||||
|
script {
|
||||||
|
if (env.BRANCH_NAME == 'master') {
|
||||||
build job: 'Bot Discord Gradle', wait: true
|
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
|
||||||
* docker build on the command line */
|
* 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') {
|
stage('Push image') {
|
||||||
/* Finally, we'll push the image with two tags:
|
/* Finally, we'll push the image with two tags:
|
||||||
* First, the incremental build number from Jenkins
|
* First, the incremental build number from Jenkins
|
||||||
* Second, the 'latest' tag.
|
* Second, the 'latest' tag.
|
||||||
* Pushing multiple tags is cheap, as all the layers are reused. */
|
* 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'){
|
stage('Cleaning'){
|
||||||
|
@ -31,7 +31,7 @@ jar.doFirst {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
delete "${buildDir}/libs/*"
|
||||||
baseName = 'DiscordBot'
|
baseName = 'DiscordBot'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user