Commit 2ca3bf0d authored by liuzicheng's avatar liuzicheng

初始化项目

parent b4f70beb
pipeline
{
agent any
environment {
CREDENTIALS_ID ="jqtx-git"
APPLICATION_URL="ssh://git@gitlab.jqtianxia.cn:2222/zhanhai/windows.git"
APPLICATION_NAME = 'windows'
APPLICATION_PORT = '8432'
ENV_NAME = "test"
APPLICATION_SERVER_NAME='test-portal'
DOCKER_REGISTER = 'docker-rep-registry-vpc.cn-hangzhou.cr.aliyuncs.com'
HARBOR_PROJECT ='loan'
HARBOR_USER='BlackJoker@1907867481722754'
HARBOR_PASSWORD='EYzYqxMZYfEwBB6Z'
XXL_PORT= '5265'
}
stages {
stage("Env Variables") {
steps {
sh "printenv"
}
}
stage ("拉取代码"){
steps{
script {
env.VERSION="${env.GIT_COMMIT}".substring(0,8)
env.PORT = "${env.APPLICATION_PORT}"
env.DOCKER_IMAGES_NAME = "${env.APPLICATION_NAME}-${env.ENV_NAME}-${env.VERSION}"
checkout([$class: 'GitSCM', branches: [[name: "${GIT_BRANCH}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId:"${CREDENTIALS_ID}", url: "${APPLICATION_URL}"]]])
sh "echo BRANCH is : ${env.GIT_BRANCH}"
sh "echo Build Version : ${env.VERSION}"
sh "echo Env name is : ${env.ENV_NAME}"
sh "echo Port is : ${env.PORT}"
sh "echo Image name is : ${env.DOCKER_IMAGES_NAME}"
}
}
}
stage ('构建'){
steps {
sh "/opt/apache-maven-3.8.1/bin/mvn clean package -DskipTests=true docker:build"
}
}
stage("发布镜像") {
steps {
script{
sh "docker login -u ${env.HARBOR_USER} -p ${env.HARBOR_PASSWORD} ${env.DOCKER_REGISTER}"
env.DOCKER_IMAGES_NAME = "${env.DOCKER_REGISTER}/${env.HARBOR_PROJECT}/${APPLICATION_NAME}:${env.VERSION}"
sh "docker tag ${env.APPLICATION_NAME} ${env.DOCKER_IMAGES_NAME}"
sh "docker push ${env.DOCKER_IMAGES_NAME}"
sh "docker rmi ${env.APPLICATION_NAME}:latest"
}
}
}
stage("推送远程服务器") {
steps {
script{
def list=env.APPLICATION_SERVER_NAME.split(',')
for(i in list ){
println "启动参数 ${DOCKER_REGISTER} ${HARBOR_PROJECT} ${APPLICATION_NAME} ${VERSION} ${APPLICATION_PORT} ${XXL_PORT}"
println "${i}"
sshPublisher(publishers: [sshPublisherDesc(configName: i, transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: "sh /root/themis/docker.sh ${DOCKER_REGISTER} ${HARBOR_PROJECT} ${APPLICATION_NAME} ${VERSION} ${APPLICATION_PORT} ${XXL_PORT}", execTimeout: 0, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '*', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '/root/themis/dd')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
}
}
}
}
}
}
\ No newline at end of file
pipeline
{
agent any
environment {
CREDENTIALS_ID ="jqtx-git"
APPLICATION_URL="ssh://git@gitlab.jqtianxia.cn:2222/zhanhai/themis.git"
APPLICATION_NAME = 'themis'
APPLICATION_PORT = '8199'
ENV_NAME = "prod"
APPLICATION_SERVER_NAME='datagateway-1'
DOCKER_REGISTER = 'docker-rep-registry-vpc.cn-hangzhou.cr.aliyuncs.com'
HARBOR_PROJECT ='prod'
HARBOR_USER='BlackJoker@1907867481722754'
HARBOR_PASSWORD='EYzYqxMZYfEwBB6Z'
XXL_PORT= '5265'
}
stages {
stage("Env Variables") {
steps {
sh "printenv"
}
}
stage ("拉取代码"){
steps{
script {
env.VERSION="${env.GIT_COMMIT}".substring(0,8)
env.PORT = "${env.APPLICATION_PORT}"
checkout([$class: 'GitSCM', branches: [[name: "${GIT_BRANCH}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId:"${CREDENTIALS_ID}", url: "${APPLICATION_URL}"]]])
sh "echo BRANCH is : ${env.GIT_BRANCH}"
sh "echo Build Version : ${env.VERSION}"
sh "echo Env name is : ${env.ENV_NAME}"
sh "echo Port is : ${env.PORT}"
}
}
}
stage ('构建'){
steps {
sh "/opt/apache-maven-3.8.1/bin/mvn clean package -DskipTests=true docker:build"
}
}
stage("发布镜像") {
steps {
script{
sh "docker login -u ${env.HARBOR_USER} -p ${env.HARBOR_PASSWORD} ${env.DOCKER_REGISTER}"
env.DOCKER_IMAGES_NAME = "${env.DOCKER_REGISTER}/${env.HARBOR_PROJECT}/${APPLICATION_NAME}:${env.VERSION}"
sh "docker tag ${env.APPLICATION_NAME} ${env.DOCKER_IMAGES_NAME}"
sh "docker push ${env.DOCKER_IMAGES_NAME}"
sh "docker rmi ${env.APPLICATION_NAME}:latest"
}
}
}
stage("推送远程服务器") {
steps {
script{
def list=env.APPLICATION_SERVER_NAME.split(',')
for(i in list ){
println "启动参数 ${DOCKER_REGISTER} ${HARBOR_PROJECT} ${APPLICATION_NAME} ${VERSION} ${APPLICATION_PORT} ${XXL_PORT}"
println "${i}"
// 生产环境禁用 sshPublisher(publishers: [sshPublisherDesc(configName: i, transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: "sh /root/coeus/docker.sh ${DOCKER_REGISTER} ${HARBOR_PROJECT} ${APPLICATION_NAME} ${VERSION} ${APPLICATION_PORT} ${XXL_PORT}", execTimeout: 0, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '*', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '/root/coeus/dd')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
}
}
}
}
}
}
FROM java:8
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
JAVA_OPTS="" \
SPRING_OPTS="" \
TZ="Asia/Shanghai"
RUN mkdir -p /home/jqtx/ && mkdir -p /data/xxl/logs
WORKDIR /home/jqtx
ADD entrypoint.sh entrypoint.sh
RUN chmod 775 entrypoint.sh
ADD *windows*.jar app.jar
ENTRYPOINT ["./entrypoint.sh"]
EXPOSE 8080
EXPOSE 8719
\ No newline at end of file
#!/bin/sh
exec java ${JAVA_OPTS} -jar "/home/jqtx/app.jar" ${SPRING_OPTS} "$@"
......@@ -183,6 +183,31 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<!--docker镜像相关的配置信息-->
<configuration>
<!--镜像名,这里用工程名-->
<imageName>${project.artifactId}</imageName>
<!--Dockerfile文件所在目录-->
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
<!--TAG,这里用工程版本号-->
<imageTags>
<imageTag>latest</imageTag>
</imageTags>
<!--<buildArgs>target/</buildArgs>-->
<!--构建镜像的配置信息-->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -21,6 +21,7 @@ public class RouterConfig implements CommandLineRunner {
private CreditSubmitCommand creditSubmitCommand;
@Autowired
private LoanSubmitCommand loanSubmitCommand;
@Autowired
private LoanStatusCommand loanStatusCommand;
@Autowired
......
......@@ -3,7 +3,7 @@ nacos:
logstash:
address: 47.110.231.217:5000
server:
port: 8432
port: 8080
spring:
application:
name: service-windows
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment