mirror of
https://github.com/UiO-Gaming/ShiteMusicBot.git
synced 2026-11-05 13:56:51 +01:00
57 lines
1.9 KiB
Groovy
57 lines
1.9 KiB
Groovy
pipeline {
|
|
agent none
|
|
environment {
|
|
GIT_REPO = 'Ev-1/ShiteMusicBot'
|
|
DOCKER_REPO = 'rnorge/music'
|
|
TAG=""
|
|
FLAKE_FILES = "bot.py cogs/*.py cogs/utils/*.py"
|
|
}
|
|
stages {
|
|
stage('Flake8') {
|
|
agent { label 'amd64'}
|
|
steps {
|
|
sh """
|
|
python3.7 -m venv venv && venv/bin/pip install flake8 && venv/bin/python -m flake8 --max-line-length 120 ${FLAKE_FILES}
|
|
rm -rf venv/
|
|
"""
|
|
script {
|
|
TAG = sh(returnStdout: true, script: 'grep -i bot_version cogs/utils/bot_version.py | cut -d" " -f3 | tr -d \\"').trim()
|
|
}
|
|
}
|
|
}
|
|
stage('Docker Builds') {
|
|
parallel {
|
|
stage('branch') {
|
|
agent { label 'amd64'}
|
|
when {
|
|
not {
|
|
changeRequest()
|
|
}
|
|
}
|
|
steps {
|
|
script {
|
|
if (BRANCH_NAME == 'master') {
|
|
def image = docker.build("${DOCKER_REPO}:${TAG}")
|
|
image.push()
|
|
}
|
|
def image = docker.build("${DOCKER_REPO}:$GIT_BRANCH")
|
|
image.push()
|
|
}
|
|
}
|
|
}
|
|
stage('pr') {
|
|
agent { label 'amd64'}
|
|
when {
|
|
changeRequest()
|
|
}
|
|
steps {
|
|
script {
|
|
def image = docker.build("${DOCKER_REPO}:PR_$GIT_BRANCH")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|