File tree 8 files changed +109
-18
lines changed
polaris-sync-commons/src/main/java/cn/polarismesh/polaris/sync/common/rest
polaris-sync-registry-core/src/main/java/cn/polarismesh/polaris/sync/registry
8 files changed +109
-18
lines changed Original file line number Diff line number Diff line change
1
+ name : DockerImage
2
+
3
+ on :
4
+ release :
5
+ types : [ published ]
6
+
7
+ jobs :
8
+ release :
9
+ name : Release Polaris Docker Image
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Checkout code
13
+ uses : actions/checkout@v2
14
+
15
+ - name : Get version
16
+ id : get_version
17
+ run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
18
+
19
+ - name : Set up JDK 8
20
+ uses : actions/setup-java@v3
21
+ with :
22
+ distribution : ' temurin'
23
+ java-version : 8
24
+
25
+ - name : Set up Docker Buildx
26
+ uses : docker/setup-buildx-action@v1
27
+
28
+ - name : Log in to Docker Hub
29
+ uses : docker/login-action@v1
30
+ with :
31
+ username : ${{ secrets.POLARIS_DOCKER_NAME }}
32
+ password : ${{ secrets.POLARIS_DOCKER_PASSWORD }}
33
+
34
+ - name : Build Server
35
+ id : build-server
36
+ env :
37
+ DOCKER_TAG : ${{ steps.get_version.outputs.VERSION }}
38
+ run : |
39
+ ls -lstrh
40
+ bash build-docker.sh ${DOCKER_TAG}
Original file line number Diff line number Diff line change
1
+ FROM java:8
2
+
3
+ COPY polaris-sync-server/target/polaris-sync-${version}.jar /app/polaris-sync-server.jar
4
+
5
+ WORKDIR /app
6
+
7
+ RUN chmod 777 /app/
8
+
9
+ CMD ["java" , "-jar" , "polaris-sync-server.jar" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -o errexit
4
+
5
+ if [ " $# " -ne 1 ]; then
6
+ echo " Incorrect parameters"
7
+ echo " Usage: build-docker.sh <version>"
8
+ exit 1
9
+ fi
10
+
11
+ VERSION=$1
12
+
13
+ PREFIX=" docker.io/polarismesh"
14
+ SCRIPTDIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd)
15
+
16
+ pushd " $SCRIPTDIR /"
17
+ # java build the app.
18
+ docker run --rm -u root -v " $( pwd) " :/home/maven/project -w /home/maven/project maven:3.8.1-openjdk-8-slim mvn clean package
19
+ # plain build -- no ratings
20
+ docker build --pull -t " ${PREFIX} /polaris-sync:${VERSION} " -t " ${PREFIX} /polaris-sync:latest" --build-arg version=${VERSION} .
21
+ docker push " ${PREFIX} /polaris-sync:${VERSION} "
22
+ popd
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public static <T> RestResponse<T> withNormalResponse(ResponseEntity<T> responseE
47
47
public static <T > RestResponse <T > withRestClientException (RestClientException restClientException ) {
48
48
if (restClientException instanceof RestClientResponseException ) {
49
49
//存在消息返回,只是前面没有出错
50
- RestClientResponseException restClientResponseException = (RestClientResponseException )restClientException ;
50
+ RestClientResponseException restClientResponseException = (RestClientResponseException ) restClientException ;
51
51
return new RestResponse <T >(null , null ,
52
52
restClientResponseException .getRawStatusCode (), restClientResponseException .getStatusText ());
53
53
} else {
Original file line number Diff line number Diff line change 22
22
import org .springframework .validation .annotation .Validated ;
23
23
24
24
@ ConfigurationProperties ("polaris.sync.registry" )
25
- // @Validated
25
+ @ Validated
26
26
public class SyncRegistryProperties {
27
27
28
- // @NotEmpty
28
+ @ NotEmpty
29
29
private String configPath ;
30
30
31
- // @NotEmpty
31
+ @ NotEmpty
32
32
private String watchPath ;
33
33
34
34
public String getConfigPath () {
Original file line number Diff line number Diff line change 19
19
20
20
import java .time .Duration ;
21
21
import java .util .regex .Pattern ;
22
- import org .springframework .util .StringUtils ;
23
22
24
23
/**
25
24
* 解析时间格式的工具类
26
25
*
27
26
* @author andrewshan
28
- * @date 2019/8/20
29
27
*/
30
28
public class DurationUtils {
31
29
Original file line number Diff line number Diff line change 46
46
<version >${project.version} </version >
47
47
</dependency >
48
48
</dependencies >
49
+
50
+ <build >
51
+ <plugins >
52
+ <plugin >
53
+ <groupId >org.springframework.boot</groupId >
54
+ <artifactId >spring-boot-maven-plugin</artifactId >
55
+ <configuration >
56
+ <mainClass >cn.polarismesh.polaris.server.SyncServer</mainClass >
57
+ <layout >JAR</layout >
58
+ <executable >true</executable >
59
+ </configuration >
60
+ <executions >
61
+ <execution >
62
+ <id >repackage</id >
63
+ <goals >
64
+ <goal >repackage</goal >
65
+ </goals >
66
+ </execution >
67
+ </executions >
68
+ </plugin >
69
+ </plugins >
70
+ </build >
49
71
</project >
Original file line number Diff line number Diff line change 76
76
</plugins >
77
77
</pluginManagement >
78
78
<plugins >
79
- <plugin >
80
- <groupId >org.apache.maven.plugins</groupId >
81
- <artifactId >maven-checkstyle-plugin</artifactId >
82
- </plugin >
79
+ <!-- < plugin> -- >
80
+ <!-- <groupId>org.apache.maven.plugins</groupId> -- >
81
+ <!-- <artifactId>maven-checkstyle-plugin</artifactId> -- >
82
+ <!-- < /plugin> -- >
83
83
<plugin >
84
84
<groupId >org.apache.maven.plugins</groupId >
85
85
<artifactId >maven-compiler-plugin</artifactId >
154
154
</plugins >
155
155
</build >
156
156
157
- <reporting >
158
- <plugins >
159
- <plugin >
160
- <groupId >org.apache.maven.plugins</groupId >
161
- <artifactId >maven-checkstyle-plugin</artifactId >
162
- </plugin >
163
- </plugins >
164
- </reporting >
157
+ <!-- < reporting> -- >
158
+ <!-- <plugins> -- >
159
+ <!-- <plugin> -- >
160
+ <!-- <groupId>org.apache.maven.plugins</groupId> -- >
161
+ <!-- <artifactId>maven-checkstyle-plugin</artifactId> -- >
162
+ <!-- </plugin> -- >
163
+ <!-- </plugins> -- >
164
+ <!-- < /reporting> -- >
165
165
166
166
<profiles >
167
167
<profile >
You can’t perform that action at this time.
0 commit comments