Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
signal
traffic-signal-platform
Commits
bd079cfd
Commit
bd079cfd
authored
Nov 24, 2022
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jenkins持续集成
parent
2326a7b4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
339 additions
and
7 deletions
+339
-7
Jenkinsfile
Jenkinsfile
+53
-0
pom.xml
pom.xml
+84
-1
pom.xml
signal-utc-service/pom.xml
+152
-5
package.xml
signal-utc-service/src/main/assembly/package.xml
+49
-0
Swagger2.java
...-service/src/main/java/net/wanji/utc/config/Swagger2.java
+1
-1
No files found.
Jenkinsfile
0 → 100644
View file @
bd079cfd
pipeline
{
agent
{
label
'jenkinsagent-87'
}
stages
{
stage
(
'检测环境'
)
{
steps
{
sh
'''java -version
mvn -v
git version
docker -v'''
}
}
stage
(
'拉取代码'
)
{
steps
{
checkout
([
$class
:
'GitSCM'
,
branches:
[[
name:
'*/master'
]],
extensions:
[],
userRemoteConfigs:
[[
credentialsId:
'aa123658-f2bd-4079-9735-65b3f31d4d0e'
,
url:
'http://10.100.1.74:56002/signal/traffic-signal-platform.git'
]]])
}
}
stage
(
'编译构建'
)
{
steps
{
sh
'mvn -pl signal-utc-service clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true'
}
}
stage
(
'删除镜像和容器'
)
{
steps
{
sh
'''
echo \'检查容器是否存在\'
containerid=`docker ps -a|grep signal-utc-service|awk \'{print $1}\'`
if [ "$containerid" != "" ];then
echo \'容器存在,删除容器\'
docker rm -f $containerid
fi
echo \'检查镜像是否存在\'
imageid=`docker images|grep signal-utc-service|awk \'{print $3}\'`
if [ "$imageid" != "" ];then
echo \'删除镜像\'
docker rmi -f $imageid
fi
'''
}
}
stage
(
'拉取镜像'
)
{
steps
{
sh
'docker pull 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1'
}
}
stage
(
'运行容器'
)
{
steps
{
sh
'docker run -p 30000:30000 -itd --name signal-utc-service 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1'
}
}
}
}
pom.xml
View file @
bd079cfd
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<groupId>
net.wanji
</groupId>
<groupId>
net.wanji
</groupId>
<artifactId>
traffic-signal-platform
</artifactId>
<artifactId>
traffic-signal-platform
</artifactId>
<version>
1.1.0
</version>
<version>
0.2.1
</version>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<name>
traffic-signal-platform
</name>
<name>
traffic-signal-platform
</name>
...
@@ -165,6 +165,89 @@
...
@@ -165,6 +165,89 @@
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
<!--打包配置-->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!--清除打包汇总生成的文件-->
<plugin>
<artifactId>
maven-clean-plugin
</artifactId>
<version>
2.5
</version>
<executions>
<execution>
<id>
auto-clean
</id>
<phase>
pre-clean
</phase>
<goals>
<goal>
clean
</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>
false
</skip>
<filesets>
<fileset>
<directory>
${project.basedir}/assembly
</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>
maven-resources-plugin
</artifactId>
<version>
2.6
</version>
<executions>
<!--将启动脚本复制到指定目录-->
<execution>
<id>
copy-start-bin
</id>
<phase>
package
</phase>
<goals>
<goal>
copy-resources
</goal>
</goals>
<configuration>
<outputDirectory>
${project.basedir}/assembly
</outputDirectory>
<resources>
<resource>
<directory>
${project.basedir}
</directory>
<filtering>
true
</filtering>
<includes>
<include>
*.sh
</include>
<inclede>
README.txt
</inclede>
<include>
license.properties
</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<!--将skywalking复制到指定目录-->
<execution>
<id>
copy-thridparty-skywalking
</id>
<phase>
package
</phase>
<goals>
<goal>
copy-resources
</goal>
</goals>
<configuration>
<outputDirectory>
${project.basedir}/assembly/gisc-common/third-party
</outputDirectory>
<resources>
<resource>
<directory>
${project.basedir}/third-party/
</directory>
<filtering>
false
</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>
\ No newline at end of file
signal-utc-service/pom.xml
View file @
bd079cfd
...
@@ -8,12 +8,12 @@
...
@@ -8,12 +8,12 @@
<parent>
<parent>
<groupId>
net.wanji
</groupId>
<groupId>
net.wanji
</groupId>
<artifactId>
traffic-signal-platform
</artifactId>
<artifactId>
traffic-signal-platform
</artifactId>
<version>
1.1.0
</version>
<version>
0.2.1
</version>
</parent>
</parent>
<groupId>
net.wanji
</groupId>
<groupId>
net.wanji
</groupId>
<artifactId>
signal-utc-service
</artifactId>
<artifactId>
signal-utc-service
</artifactId>
<version>
1.1.0
</version>
<version>
0.2.1
</version>
<name>
signal-utc-service
</name>
<name>
signal-utc-service
</name>
...
@@ -145,15 +145,162 @@
...
@@ -145,15 +145,162 @@
</dependency>
</dependency>
</dependencies>
</dependencies>
<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <mainClass>net.wanji.utc.UtcApplication</mainClass>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
<build>
<build>
<plugins>
<plugins>
<!-- 编译插件 -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
${maven.compiler.source}
</source>
<target>
${maven.compiler.target}
</target>
<compilerArguments>
<encoding>
${project.build.sourceEncoding}
</encoding>
</compilerArguments>
</configuration>
</plugin>
<!-- 项目打包插件 -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-jar-plugin
</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>
true
</addClasspath>
<classpathPrefix>
lib/
</classpathPrefix>
<mainClass>
net.wanji.utc.UtcApplication
</mainClass>
</manifest>
</archive>
<excludes>
<exclude>
generate_code_vm/**
</exclude>
<exclude>
mybatis-generator/**
</exclude>
<exclude>
**/*.yml
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<!-- 主类 -->
<configuration>
<finalName>
signal-utc-service
</finalName>
<descriptors>
<descriptor>
src/main/assembly/package.xml
</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>
make-assembly
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<configuration>
<skip>
true
</skip>
</configuration>
</plugin>
<!-- swagger 导出配置 -->
<plugin>
<groupId>
io.github.swagger2markup
</groupId>
<artifactId>
swagger2markup-maven-plugin
</artifactId>
<version>
1.3.3
</version>
<configuration>
<swaggerInput>
http://10.100.1.87:30003/utcsystem/v2/api-docs
</swaggerInput>
<outputDir>
src/docs/asciidoc/generated
</outputDir>
<config>
<swagger2markup.markupLanguage>
ASCIIDOC
</swagger2markup.markupLanguage>
</config>
</configuration>
</plugin>
<plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.asciidoctor
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<artifactId>
asciidoctor-maven-plugin
</artifactId>
<version>
1.5.6
</version>
<configuration>
<configuration>
<mainClass>
net.wanji.utc.UtcApplication
</mainClass>
<sourceDirectory>
src/docs/asciidoc/generated
</sourceDirectory>
<outputDirectory>
src/docs/asciidoc/html
</outputDirectory>
<backend>
html
</backend>
<sourceHighlighter>
coderay
</sourceHighlighter>
<attributes>
<toc>
left
</toc>
</attributes>
</configuration>
</configuration>
</plugin>
</plugin>
<!-- mvn clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true -->
<!-- 使用jib 无需深入学习docker, 无需编写Dockerfile -->
<plugin>
<groupId>
com.google.cloud.tools
</groupId>
<artifactId>
jib-maven-plugin
</artifactId>
<version>
2.5.2
</version>
<configuration>
<!--from节点用来设置镜像的基础镜像,相当于Docerkfile中的FROM关键字-->
<from>
<!--使用harbor上的openjdk镜像-->
<image>
10.100.1.87:5000/xinkong/openjdk:8-alpine3.9
</image>
<!--harbor服务器的登录信息-->
<auth>
<username>
admin
</username>
<password>
Wanji300552
</password>
</auth>
</from>
<to>
<image>
10.100.1.87:5000/xinkong/${artifactId}:${version}
</image>
<auth>
<username>
admin
</username>
<password>
Wanji300552
</password>
</auth>
</to>
<container>
<!--配置jvm虚拟机参数-->
<jvmFlags>
<jvmFlag>
-Xms512m
</jvmFlag>
</jvmFlags>
<!--配置使用的时区-->
<environment>
<TZ>
Asia/Shanghai
</TZ>
</environment>
<!--要暴露的端口-->
<ports>
<port>
30000
</port>
</ports>
<!-- <creationTime>2022-10-14T10:08:59.304+08:00</creationTime>-->
<creationTime>
${maven.build.timestamp}
</creationTime>
<mainClass>
com.wanji.web.SignalApplication
</mainClass>
</container>
<!--可以进行HTTP-->
<allowInsecureRegistries>
true
</allowInsecureRegistries>
</configuration>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
build
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</plugins>
</build>
</build>
...
...
signal-utc-service/src/main/assembly/package.xml
0 → 100644
View file @
bd079cfd
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"
>
<id>
1.0
</id>
<formats>
<format>
tar.gz
</format>
<format>
dir
</format>
</formats>
<includeBaseDirectory>
true
</includeBaseDirectory>
<fileSets>
<!-- for bin -->
<fileSet>
<directory>
src/main/bin
</directory>
<includes>
<include>
*.*
</include>
</includes>
<directoryMode>
775
</directoryMode>
<outputDirectory>
bin/
</outputDirectory>
</fileSet>
<!-- for configs -->
<fileSet>
<directory>
src/main/resources
</directory>
<includes>
<include>
*.yml
</include>
<include>
*.xml
</include>
</includes>
<outputDirectory>
/
</outputDirectory>
</fileSet>
<!-- for jar -->
<fileSet>
<directory>
${project.build.directory}
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
*.jar
</include>
</includes>
</fileSet>
</fileSets>
<!-- for lib -->
<dependencySets>
<dependencySet>
<outputDirectory>
lib/
</outputDirectory>
<scope>
runtime
</scope>
<excludes>
<exclude>
${groupId}:${artifactId}
</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
signal-utc-service/src/main/java/net/wanji/utc/config/Swagger2.java
View file @
bd079cfd
...
@@ -34,7 +34,7 @@ public class Swagger2 {
...
@@ -34,7 +34,7 @@ public class Swagger2 {
//创建人
//创建人
.
contact
(
new
Contact
(
"test"
,
"#"
,
"test@wanji.net.cn"
))
.
contact
(
new
Contact
(
"test"
,
"#"
,
"test@wanji.net.cn"
))
//版本号
//版本号
.
version
(
"
1.1.0
"
)
.
version
(
"
0.2.1
"
)
//描述
//描述
.
description
(
"城市交通信号厂商调用服务API"
)
.
description
(
"城市交通信号厂商调用服务API"
)
.
build
();
.
build
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment