Commit fbbff685 authored by 郭燕飞's avatar 郭燕飞 💬

接入jib

parent 2cd0f34d
before_script:
- gradleVersionFun(){
if [ ! -f "gradleConfig" ]; then
echo "gradleConfig is null";
gradle=gradle;
else
source ./gradleConfig;
echo "gradleVersion"+$gradleVersion;
echo "gradleBuildType"+$gradleBuildType;
if [ $gradleVersion==6 ]; then
gradle=/opt/app/gradle-6.6.1/bin/gradle;
else
gradle=gradle;
fi
fi
};
sonarqube_feature_preview: sonarqube_feature_preview:
script: script:
- git config --global user.email "sonar@duiba" - git config --global user.email "sonar@duiba"
- git config --global user.name "sonar" - git config --global user.name "sonar"
- gradle clean - $gradle clean
- export - export
- gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.branch=dummy -Dsonar.login=reporter -Dsonar.password=duiba123456 -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -x test - $gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.branch=dummy -Dsonar.login=reporter -Dsonar.password=duiba123456 -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -x test
stage: test stage: test
only: only:
- /^feature.*$/ - /^feature.*$/
...@@ -15,9 +32,9 @@ sonarqube_hotfix_preview: ...@@ -15,9 +32,9 @@ sonarqube_hotfix_preview:
script: script:
- git config --global user.email "sonar@duiba" - git config --global user.email "sonar@duiba"
- git config --global user.name "sonar" - git config --global user.name "sonar"
- gradle clean - $gradle clean
- export - export
- gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.branch=dummy -Dsonar.login=reporter -Dsonar.password=duiba123456 -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -x test - $gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.branch=dummy -Dsonar.login=reporter -Dsonar.password=duiba123456 -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -x test
stage: test stage: test
only: only:
- /^(hotfix|release).*$/ - /^(hotfix|release).*$/
...@@ -29,8 +46,8 @@ sonarqube_develop_preview: ...@@ -29,8 +46,8 @@ sonarqube_develop_preview:
- git config --global user.email "sonar@duiba" - git config --global user.email "sonar@duiba"
- git config --global user.name "sonar" - git config --global user.name "sonar"
- git checkout origin/develop - git checkout origin/develop
- gradle clean - $gradle clean
- gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.login=reporter -Dsonar.password=duiba123456 -x test - $gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.login=reporter -Dsonar.password=duiba123456 -x test
only: only:
- develop - develop
tags: tags:
......
FROM registry.cn-hangzhou.aliyuncs.com/duiba/duiba-jdk8
MAINTAINER op@duiba.com.cn
ARG appname
ARG environment
ENV LANG en_US.utf8
RUN mkdir /root/duiba-deploy/
COPY ./duiba-deploy /root/duiba-deploy/
COPY ./scripts /root/scripts
#define entry point which will be run first when the container starts up
ENTRYPOINT java $JAVA_OPS -jar /root/duiba-deploy/$appname.jar --spring.profiles.active=$SPRING_ENV --spring.cloud.config.uri=$CONFIG_SERVER
apply plugin: "org.springframework.boot" apply plugin: "org.springframework.boot"
apply plugin: "com.google.cloud.tools.jib"
bootJar { bootJar {
archiveName = "{artifactId}.jar" archiveName = "{artifactId}.jar"
......
...@@ -18,9 +18,10 @@ buildscript { ...@@ -18,9 +18,10 @@ buildscript {
dependencies { dependencies {
classpath "io.spring.gradle:dependency-management-plugin:1.0.5.RELEASE" classpath "io.spring.gradle:dependency-management-plugin:1.0.5.RELEASE"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5" //sonarqube classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.0" //sonarqube
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "org.springframework.build.gradle:propdeps-plugin:0.0.7" classpath "org.springframework.build.gradle:propdeps-plugin:0.0.7"
classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:2.5.0"
classpath "cn.com.duiba:duiba-gradle-plugin:0.1.9" classpath "cn.com.duiba:duiba-gradle-plugin:0.1.9"
} }
} }
......
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -Dfile.encoding=UTF-8
\ No newline at end of file
gradleVersion=6
gradleBuildType=jib
jibFromImage=registry.cn-hangzhou.aliyuncs.com/duiba/duiba-jdk8
jibContainerMainClass={groupId}.{artifactIdPackage}.Application
\ No newline at end of file
before_script:
- gradleVersionFun(){
if [ ! -f "gradleConfig" ]; then
echo "gradleConfig is null";
gradle=gradle;
else
source ./gradleConfig;
echo "gradleVersion"+$gradleVersion;
echo "gradleBuildType"+$gradleBuildType;
if [ $gradleVersion==6 ]; then
gradle=/opt/app/gradle-6.6.1/bin/gradle;
else
gradle=gradle;
fi
fi
};
sonarqube_feature_preview: sonarqube_feature_preview:
script: script:
- git config --global user.email "sonar@duiba" - git config --global user.email "sonar@duiba"
- git config --global user.name "sonar" - git config --global user.name "sonar"
- gradle clean - $gradle clean
- export - export
- gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.branch=dummy -Dsonar.login=reporter -Dsonar.password=duiba123456 -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -x test - $gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.branch=dummy -Dsonar.login=reporter -Dsonar.password=duiba123456 -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -x test
stage: test stage: test
only: only:
- /^feature.*$/ - /^feature.*$/
...@@ -15,9 +32,9 @@ sonarqube_hotfix_preview: ...@@ -15,9 +32,9 @@ sonarqube_hotfix_preview:
script: script:
- git config --global user.email "sonar@duiba" - git config --global user.email "sonar@duiba"
- git config --global user.name "sonar" - git config --global user.name "sonar"
- gradle clean - $gradle clean
- export - export
- gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.branch=dummy -Dsonar.login=reporter -Dsonar.password=duiba123456 -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -x test - $gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.branch=dummy -Dsonar.login=reporter -Dsonar.password=duiba123456 -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -x test
stage: test stage: test
only: only:
- /^(hotfix|release).*$/ - /^(hotfix|release).*$/
...@@ -29,8 +46,8 @@ sonarqube_develop_preview: ...@@ -29,8 +46,8 @@ sonarqube_develop_preview:
- git config --global user.email "sonar@duiba" - git config --global user.email "sonar@duiba"
- git config --global user.name "sonar" - git config --global user.name "sonar"
- git checkout origin/develop - git checkout origin/develop
- gradle clean - $gradle clean
- gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.login=reporter -Dsonar.password=duiba123456 -x test - $gradle sonarqube -Dsonar.host.url=http://sonar.dui88.com -Dsonar.login=reporter -Dsonar.password=duiba123456 -x test
only: only:
- develop - develop
tags: tags:
......
FROM registry.cn-hangzhou.aliyuncs.com/duiba/duiba-jdk8
MAINTAINER op@duiba.com.cn
ARG appname
ARG environment
ENV LANG en_US.utf8
RUN mkdir /root/duiba-deploy/
COPY ./duiba-deploy /root/duiba-deploy/
COPY ./scripts /root/scripts
#define entry point which will be run first when the container starts up
ENTRYPOINT java $JAVA_OPS -jar /root/duiba-deploy/$appname.jar --spring.profiles.active=$SPRING_ENV --spring.cloud.config.uri=$CONFIG_SERVER
...@@ -18,9 +18,10 @@ buildscript { ...@@ -18,9 +18,10 @@ buildscript {
dependencies { dependencies {
classpath "io.spring.gradle:dependency-management-plugin:1.0.5.RELEASE" classpath "io.spring.gradle:dependency-management-plugin:1.0.5.RELEASE"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5" //sonarqube classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.0" //sonarqube
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "org.springframework.build.gradle:propdeps-plugin:0.0.7" classpath "org.springframework.build.gradle:propdeps-plugin:0.0.7"
classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:2.5.0"
classpath "cn.com.duiba:duiba-gradle-plugin:0.1.9" classpath "cn.com.duiba:duiba-gradle-plugin:0.1.9"
} }
} }
...@@ -35,6 +36,7 @@ sonarqube { ...@@ -35,6 +36,7 @@ sonarqube {
} }
} }
apply plugin: "com.google.cloud.tools.jib"
apply plugin: "duiba.gradle.plugin" apply plugin: "duiba.gradle.plugin"
apply plugin: "maven" apply plugin: "maven"
apply plugin: "java" apply plugin: "java"
......
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -Dfile.encoding=UTF-8
\ No newline at end of file
gradleVersion=6
gradleBuildType=jib
jibFromImage=registry.cn-hangzhou.aliyuncs.com/duiba/duiba-jdk8
jibContainerMainClass={groupId}.{artifactIdPackage}.Application
\ No newline at end of file
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