added docker swarm support + auto deploy
nclazz/www.nclazz.de/pipeline/head This commit looks good
Details
|
@ -1,8 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../../:\nclazz.de\src\www\www.nclazz.de\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_12" project-jdk-name="12" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/www.nclazz.de.iml" filepath="$PROJECT_DIR$/.idea/www.nclazz.de.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,2 @@
|
|||
FROM docker.nclazz.de/nclazz/static-webserver:latest
|
||||
COPY ./site .
|
|
@ -0,0 +1,71 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
DOCKER_REGISTRY = "docker.nclazz.de"
|
||||
DOCKER_GROUP = 'nclazz'
|
||||
DOCKER_IMAGE = 'site'
|
||||
DOCKER_TAG = 'latest'
|
||||
|
||||
DEPLOY_NODE = "${ BRANCH_NAME == "master" ? "swarm && prod" : "swarm && staging" }"
|
||||
SERVICE_NAME = 'marrone-international'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Run Docker Build') {
|
||||
agent { label 'docker' }
|
||||
steps {
|
||||
sh 'chmod +x version.sh'
|
||||
sh './version.sh > site/version.json'
|
||||
script {
|
||||
docker.withRegistry("https://$DOCKER_REGISTRY", "jenkins_nexus") {
|
||||
def image = docker.build("nclazz/site")
|
||||
image.push("${env.DOCKER_TAG}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Run Deployment') {
|
||||
agent { label "provision" }
|
||||
when {
|
||||
branch 'master'
|
||||
}
|
||||
steps {
|
||||
deployToSwarm(
|
||||
name: 'www-nclazz',
|
||||
file: "${env.WORKSPACE}/docker-compose.yml",
|
||||
forceUpdate: true,
|
||||
askApproval: false,
|
||||
slackChannel: 'deployment'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
failure {
|
||||
slackSend(
|
||||
channel: 'notifications',
|
||||
color: 'danger',
|
||||
message: "There is a *build failure* in ${env.JOB_NAME}.\nBuild: ${env.BUILD_URL} "
|
||||
)
|
||||
}
|
||||
unstable {
|
||||
slackSend(
|
||||
channel: 'notifications',
|
||||
color: 'warning',
|
||||
message: "Some tests have failed in ${env.JOB_NAME}.\nBuild: ${env.BUILD_URL} "
|
||||
)
|
||||
}
|
||||
fixed {
|
||||
slackSend(
|
||||
channel: 'notifications',
|
||||
color: 'good',
|
||||
message: "The build ${env.JOB_NAME} completed successfully and is back to normal.\nBuild: ${env.BUILD_URL} "
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
site:
|
||||
deploy:
|
||||
replicas: 2
|
||||
placement:
|
||||
max_replicas_per_node: 1
|
||||
image: docker.nclazz.de/nclazz/site:latest
|
||||
ports:
|
||||
- 9082:80
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
echo "{ \"commit\": \"$GIT_COMMIT\", \"build\": \"$BUILD_ID\" }"
|