Поправлены константы, добавлен шаблонный Jenkinsfile
This commit is contained in:
82
Jenkinsfile
vendored
Normal file
82
Jenkinsfile
vendored
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
PRODUCT_NAME = '<%%RESERVED_NAME%%>'
|
||||||
|
PRODUCT_GROUP = '<%%RESERVED_GROUPNAME%%>'
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Extract VERSION') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
env.VERSION = sh(
|
||||||
|
script: '''
|
||||||
|
set -e
|
||||||
|
VERSION_FILE=src/main/resources/META-INF/ncore-product/$PRODUCT_GROUP/version.properties
|
||||||
|
VERSION=$(sed -n 's/^version=//p' "$VERSION_FILE")
|
||||||
|
|
||||||
|
if [[ ! "$VERSION" =~ ^[0-9]+(.[0-9]+)*(-[A-Za-z]+)?$ ]]; then
|
||||||
|
echo "Invalid version format: $VERSION" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$VERSION"
|
||||||
|
''',
|
||||||
|
returnStdout: true
|
||||||
|
).trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Make gradlew executable') {
|
||||||
|
steps {
|
||||||
|
sh 'chmod +x ./gradlew'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build with Gradle') {
|
||||||
|
steps {
|
||||||
|
sh './gradlew clean'
|
||||||
|
sh './gradlew nTDC nbackup build copyDist publish dockerFile dockerUD rdbDockerFile'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build and Push Docker Images') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'build', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
|
||||||
|
sh '''
|
||||||
|
echo "$PASS" | docker login --username "$USER" --password-stdin $REGISTRY
|
||||||
|
'''
|
||||||
|
def appImage = "<%%FACTORY_REGISTRY_IMAGE%%>:${env.VERSION}"
|
||||||
|
sh "cd build/docker && docker build -t ${appImage} ."
|
||||||
|
sh "docker push ${appImage}"
|
||||||
|
|
||||||
|
def rdbImage = "<%%FACTORY_REGISTRY_IMAGE%%>-db:${env.VERSION}"
|
||||||
|
sh "cd build/docker && docker build -t ${rdbImage} ."
|
||||||
|
sh "docker push ${rdbImage}"
|
||||||
|
|
||||||
|
def udbImage = "<%%FACTORY_REGISTRY_IMAGE%%>-update-db:${env.VERSION}"
|
||||||
|
sh "cd build/docker && docker build -t ${udbImage} ."
|
||||||
|
sh "docker push ${udbImage}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo "Проект ${env.PRODUCT_NAME} успешно собран на версии ${env.VERSION}"
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo "Проект ${env.PRODUCT_NAME} не собрался на версии ${env.VERSION}!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -23,7 +23,7 @@ ncore {
|
|||||||
sourceEncoding = 'UTF-8'
|
sourceEncoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'biz.redsoft.<%%RESERVED_NAME%%>'
|
group = '<%%RESERVED_GROUPNAME%%>'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
|||||||
@ -4,7 +4,8 @@
|
|||||||
<comment>Configuration settings for ncore platform</comment>
|
<comment>Configuration settings for ncore platform</comment>
|
||||||
|
|
||||||
<!-- Product settings -->
|
<!-- Product settings -->
|
||||||
<entry key="product.name"><%%RESERVED_NAME%%></entry>
|
<entry key="product.name"><%%RESERVED_GROUPNAME%%></entry>
|
||||||
|
<entry key="product.subsystem"><%%RESERVED_NAME%%></entry>
|
||||||
<entry key="product.title"><%%RESERVED_NAME%%> ncore project</entry>
|
<entry key="product.title"><%%RESERVED_NAME%%> ncore project</entry>
|
||||||
|
|
||||||
<!-- Database settings -->
|
<!-- Database settings -->
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package biz.redsoft.<%%RESERVED_NAME%%>;
|
package <%%RESERVED_GROUPNAME%%>;
|
||||||
|
|
||||||
import biz.redsoft.ncore.system.application.Application;
|
import biz.redsoft.ncore.system.application.Application;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package biz.redsoft.<%%RESERVED_NAME%%>;
|
package <%%RESERVED_GROUPNAME%%>;
|
||||||
|
|
||||||
import biz.redsoft.util.IncorrectVersionFormat;
|
import biz.redsoft.util.IncorrectVersionFormat;
|
||||||
import biz.redsoft.util.VersionUtils;
|
import biz.redsoft.util.VersionUtils;
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 953 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1016 B |
@ -4,7 +4,8 @@
|
|||||||
<comment>Configuration settings for ncore platform</comment>
|
<comment>Configuration settings for ncore platform</comment>
|
||||||
|
|
||||||
<!-- Product settings -->
|
<!-- Product settings -->
|
||||||
<entry key="product.name"><%%RESERVED_NAME%%></entry>
|
<entry key="product.name"><%%RESERVED_GROUPNAME%%></entry>
|
||||||
|
<entry key="product.subsystem"><%%RESERVED_NAME%%></entry>
|
||||||
<entry key="product.title"><%%RESERVED_NAME%%> ncore project</entry>
|
<entry key="product.title"><%%RESERVED_NAME%%> ncore project</entry>
|
||||||
|
|
||||||
<!-- Database settings -->
|
<!-- Database settings -->
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package biz.redsoft.<%%RESERVED_NAME%%>;
|
package <%%RESERVED_GROUPNAME%%>;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
Reference in New Issue
Block a user