Compare commits
12 Commits
master
...
2.1.6.RELE
| Author | SHA1 | Date | |
|---|---|---|---|
| fb5cc69a60 | |||
| b1102b472c | |||
| cb264276dc | |||
| b7cbe93e7c | |||
| ac19ac7c78 | |||
| 4774b36930 | |||
| 9ee84b9243 | |||
| 267f7672e2 | |||
| 56c4c56386 | |||
| 9de7591256 | |||
| ff7c8d9620 | |||
| 2a44f2c94f |
@@ -4,7 +4,11 @@ services:
|
||||
|
||||
variables:
|
||||
DOCKER_DRIVER: overlay
|
||||
SPRING_PROFILES_ACTIVE: gitlab-ci
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
IMAGE_VERSION: $CI_COMMIT_REF_NAME
|
||||
|
||||
before_script:
|
||||
- "echo 构建版本号: ${IMAGE_VERSION}"
|
||||
|
||||
stages:
|
||||
- build
|
||||
@@ -13,6 +17,8 @@ stages:
|
||||
maven-build:
|
||||
image: maven:3-jdk-8
|
||||
stage: build
|
||||
tags:
|
||||
- 8T
|
||||
script: "mvn package -B"
|
||||
artifacts:
|
||||
paths:
|
||||
@@ -20,7 +26,10 @@ maven-build:
|
||||
|
||||
docker-build:
|
||||
stage: package
|
||||
tags:
|
||||
- 8T
|
||||
script:
|
||||
- docker build -t $CONTAINER_IMAGE:1.4 .
|
||||
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASS
|
||||
- docker push $CONTAINER_IMAGE:1.4
|
||||
- docker build -t $CONTAINER_IMAGE:$IMAGE_VERSION .
|
||||
- docker push $CONTAINER_IMAGE:$IMAGE_VERSION
|
||||
- docker logout
|
||||
64
README.MD
Normal file
64
README.MD
Normal file
@@ -0,0 +1,64 @@
|
||||
# SpringBoot 测试样板工程
|
||||
|
||||
## 用途
|
||||
|
||||
- Docker环境测试
|
||||
- CICD测试
|
||||
- Java环境测试
|
||||
- 端口、端口转发测试
|
||||
|
||||
|
||||
|
||||
## 用法
|
||||
|
||||
默认暴露端口:8080
|
||||
|
||||
健康检查路径:`/actuator/beans`、`/actuator/info`
|
||||
|
||||
**请求样例**
|
||||
|
||||
```
|
||||
GET http://localhost:8080/actuator/info
|
||||
```
|
||||
|
||||
返回结果
|
||||
|
||||
```json
|
||||
{
|
||||
"app": {
|
||||
"author": "F嘉阳",
|
||||
"encoding": "UTF-8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 样例接口
|
||||
|
||||
**请求URL:**
|
||||
|
||||
```
|
||||
GET/POST/PUT/DELETE http://localhost:8080/print/{content}
|
||||
```
|
||||
|
||||
**参数:**
|
||||
|
||||
| 参数名 | 类型 | 必选 | 内容 | 说明 |
|
||||
| :------ | ---- | :--- | :--- | -------- |
|
||||
| content | 字符 | 否 | info | 输出内容 |
|
||||
|
||||
**请求样例**
|
||||
|
||||
```
|
||||
http://localhost:8080/print/info
|
||||
```
|
||||
|
||||
|
||||
|
||||
**返回示例**
|
||||
|
||||
```json
|
||||
hello , info
|
||||
```
|
||||
|
||||
17
pom.xml
17
pom.xml
@@ -23,6 +23,23 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<!-- tomcat加载优先级高于jetty,若不加排除,则仍然加载tomcat -->
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 使用 Jetty 容器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -14,7 +14,7 @@ public class DemoApplication {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
|
||||
@RequestMapping("/{content}")
|
||||
@RequestMapping("/print/{content}")
|
||||
public String helloWorld(@PathVariable(name = "content", required = false) String content) {
|
||||
return "hello , " + content;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,14 @@
|
||||
server:
|
||||
port: 8080
|
||||
port: 8080
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
app:
|
||||
author: F嘉阳
|
||||
encoding: @project.build.sourceEncoding@
|
||||
Reference in New Issue
Block a user