Поправлены константы, добавлен шаблонный Jenkinsfile

This commit is contained in:
2026-01-30 21:01:49 +03:00
parent a46430d4d8
commit 802c194672
9 changed files with 90 additions and 6 deletions

82
Jenkinsfile vendored Normal file
View 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}!"
}
}
}

View File

@ -23,7 +23,7 @@ ncore {
sourceEncoding = 'UTF-8'
}
group = 'biz.redsoft.<%%RESERVED_NAME%%>'
group = '<%%RESERVED_GROUPNAME%%>'
repositories {
maven {

View File

@ -4,7 +4,8 @@
<comment>Configuration settings for ncore platform</comment>
<!-- 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>
<!-- Database settings -->

View File

@ -1,4 +1,4 @@
package biz.redsoft.<%%RESERVED_NAME%%>;
package <%%RESERVED_GROUPNAME%%>;
import biz.redsoft.ncore.system.application.Application;

View File

@ -1,4 +1,4 @@
package biz.redsoft.<%%RESERVED_NAME%%>;
package <%%RESERVED_GROUPNAME%%>;
import biz.redsoft.util.IncorrectVersionFormat;
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

View File

@ -4,7 +4,8 @@
<comment>Configuration settings for ncore platform</comment>
<!-- 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>
<!-- Database settings -->

View File

@ -35,7 +35,7 @@
* exception statement from your version.
*/
package biz.redsoft.<%%RESERVED_NAME%%>;
package <%%RESERVED_GROUPNAME%%>;
import java.io.File;
import java.io.IOException;