Ver código fonte

drone-02-修改drone文件

xixi178 7 meses atrás
pai
commit
bc5f2e0ac0
4 arquivos alterados com 41 adições e 61 exclusões
  1. 10 49
      .drone.yml
  2. 9 0
      .idea/inspectionProfiles/Project_Default.xml
  3. 16 4
      .idea/workspace.xml
  4. 6 8
      client-api/Dockerfile

+ 10 - 49
.drone.yml

@@ -1,60 +1,21 @@
 kind: pipeline # 定义对象类型,还有secret和signature两种类型
 type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
-name: drone-study # 定义流水线名称
+name: test_drone # 定义流水线名称
 
 steps: # 定义流水线执行步骤,这些步骤将顺序执行
-  - name: package # 1. 流水线名称(maven打包)
-    pull: if-not-exists
-    image: maven:ibmjava-alpine # 定义创建容器的Docker镜像
+  - name: build-package # 流水线名称
+    image: maven:3.8.5-openjdk-8 # 定义创建容器的Docker镜像
     volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
-      - name: maven-cache
-        path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
-        # 挂载宿主机的目录
       - name: maven-build
-        path: /app/build/drone-study # 将应用打包好的Jar和执行脚本挂载出来
-    commands: # 定义在Docker容器中执行的shell命令,这里是复制到maven镜像容器里面的,区分开项目就行了
-      - mvn clean package -Dmaven.test.skip=true
-      - cp target/drone.jar /app/build/drone-study/drone.jar
-      - cp Dockerfile /app/build/drone-study/Dockerfile
-      - cp run.sh /app/build/drone-study/run.sh
+        path: /root/testDrone # 将应用打包好的Jar和执行脚本挂载出来
+    commands:
+      - $MAVEN_HOME/bin/mvn -v
+      - $MAVEN_HOME/bin/mvn clean package -DskipTests=true
+      # 将打包后的jar包,拷贝到 /root/testDrone 目录
+      - cp target/*.jar  /root/testDrone
 
-  - name: build-start # 2. 流水线名称(ssh默认人工操作打包好的jar包)
-    image: appleboy/drone-ssh # ssh工具镜像
-    settings:
-      host: 123.60.43.219 # 远程连接地址,可以是IP可以是域名
-      username: root # 远程连接账号
-      password: Ab18315108835 #明文密码
-#      password:
-#        from_secret: ssh_password # 从Secret中读取SSH密码
-      key:
-        from_secret: ssh_key # 从Secret中读取SSH密钥
-      port: 22 # 远程连接端口
-      command_timeout: 10m # 远程执行命令超时时间
-      script_stop: false # 设置为false,遇到第一次错误会继续运行后面的命令
-      script:
-        - cd /www/wwwroot/data/maven/build/drone-study # 进入宿主机构建目录,可根据自己选择目录
-        - chmod +x run.sh # 更改为可执行脚本
-        - ./run.sh # 运行脚本打包应用镜像并运行
-
-        #暂时还不需要通知
-#  - name: notify # 3. 通知(这里使用了钉钉通知,可以使用微信通知、邮件通知等)
-#    pull: if-not-exists
-#    image: guoxudongdocker/drone-dingtalk:latest
-#    settings:
-#      token:
-#        from_secret: dingtalk_token
-#      type: markdown
-#      message_color: true
-#      message_pic: true
-#      sha_link: true
-#    when:
-#      status: [failure, success]
 
 volumes: # 定义流水线挂载目录,用于共享数据
   - name: maven-build
     host:
-      path: /www/wwwroot/data/maven/build/drone-study # 从宿主机中挂载的目录
-  - name: maven-cache
-    host:
-      path: /www/wwwroot/data/maven/cache
-
+      path: /root/testDrone   #jar包目录可以修改从宿主机中挂载的目录

+ 9 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -1,6 +1,14 @@
 <component name="InspectionProjectProfileManager">
   <profile version="1.0">
     <option name="myName" value="Project Default" />
+    <inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
     <inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
       <option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,cn.hutool.http.HttpRequest,execute" />
     </inspection_tool>
@@ -16,6 +24,7 @@
       <option name="callCheckString" value="java.io.File,.*,java.io.InputStream,read|skip|available|markSupported,java.io.Reader,read|skip|ready|markSupported,java.lang.AbstractStringBuilder,capacity|codePointAt|codePointBefore|codePointCount|indexOf|lastIndexOf|offsetByCodePoints|substring|subSequence,java.lang.Boolean,.*,java.lang.Byte,.*,java.lang.Character,.*,java.lang.Double,.*,java.lang.Float,.*,java.lang.Integer,.*,java.lang.Long,.*,java.lang.Math,.*,java.lang.Object,equals|hashCode|toString,java.lang.Short,.*,java.lang.StrictMath,.*,java.lang.String,.*,java.lang.Thread,interrupted,java.math.BigDecimal,.*,java.math.BigInteger,.*,java.net.InetAddress,.*,java.net.URI,.*,java.nio.channels.AsynchronousChannelGroup,.*,java.nio.channels.Channel,isOpen,java.nio.channels.FileChannel,open|map|lock|tryLock|write,java.nio.channels.ScatteringByteChannel,read,java.nio.channels.SocketChannel,open|socket|isConnected|isConnectionPending,java.util.Arrays,.*,java.util.Collections,(?!addAll).*,java.util.List,of,java.util.Map,of|ofEntries|entry,java.util.Set,of,java.util.UUID,.*,java.util.concurrent.BlockingQueue,offer|remove,java.util.concurrent.CountDownLatch,await|getCount,java.util.concurrent.ExecutorService,awaitTermination|isShutdown|isTerminated,java.util.concurrent.ForkJoinPool,awaitQuiescence,java.util.concurrent.Semaphore,tryAcquire|availablePermits|isFair|hasQueuedThreads|getQueueLength|getQueuedThreads,java.util.concurrent.locks.Condition,await|awaitNanos|awaitUntil,java.util.concurrent.locks.Lock,tryLock|newCondition,java.util.regex.Matcher,pattern|toMatchResult|start|end|group|groupCount|matches|find|lookingAt|quoteReplacement|replaceAll|replaceFirst|regionStart|regionEnd|hasTransparentBounds|hasAnchoringBounds|hitEnd|requireEnd,java.util.regex.Pattern,.*,java.util.stream.BaseStream,.*,java.util.stream.DoubleStream,.*,java.util.stream.IntStream,.*,java.util.stream.LongStream,.*,java.util.stream.Stream,.*" />
     </inspection_tool>
     <inspection_tool class="LoggingPlaceholderCountMatchesArgumentCount" enabled="false" level="WARNING" enabled_by_default="false" />
+    <inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
     <inspection_tool class="MavenModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
     <inspection_tool class="MismatchedCollectionQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false">
       <option name="queryNames">

+ 16 - 4
.idea/workspace.xml

@@ -4,9 +4,11 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="8eaaf244-eba9-47b2-a128-7c46802a5971" name="Changes" comment="drone-01">
+    <list default="true" id="8eaaf244-eba9-47b2-a128-7c46802a5971" name="Changes" comment="drone-01-注释掉通知stage">
       <change beforePath="$PROJECT_DIR$/.drone.yml" beforeDir="false" afterPath="$PROJECT_DIR$/.drone.yml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/Dockerfile" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -296,7 +298,8 @@
       <workItem from="1701427380779" duration="1603000" />
       <workItem from="1701432893921" duration="33000" />
       <workItem from="1704369039265" duration="159000" />
-      <workItem from="1712576927968" duration="3899000" />
+      <workItem from="1712576927968" duration="4703000" />
+      <workItem from="1712587571052" duration="1506000" />
     </task>
     <task id="LOCAL-00001" summary="init2">
       <created>1696846465336</created>
@@ -337,7 +340,15 @@
       <option name="project" value="LOCAL" />
       <updated>1712585142307</updated>
     </task>
-    <option name="localTasksCounter" value="6" />
+    <task id="LOCAL-00006" summary="drone-01-注释掉通知stage">
+      <option name="closed" value="true" />
+      <created>1712586803778</created>
+      <option name="number" value="00006" />
+      <option name="presentableId" value="LOCAL-00006" />
+      <option name="project" value="LOCAL" />
+      <updated>1712586803778</updated>
+    </task>
+    <option name="localTasksCounter" value="7" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -360,7 +371,8 @@
     <MESSAGE value="finally" />
     <MESSAGE value="提交测试版" />
     <MESSAGE value="drone-01" />
-    <option name="LAST_COMMIT_MESSAGE" value="drone-01" />
+    <MESSAGE value="drone-01-注释掉通知stage" />
+    <option name="LAST_COMMIT_MESSAGE" value="drone-01-注释掉通知stage" />
   </component>
   <component name="XSLT-Support.FileAssociations.UIState">
     <expand />

+ 6 - 8
client-api/Dockerfile

@@ -1,8 +1,6 @@
-# Docker image for springboot file run
-# VERSION 1.0
-# Author: Xiang
-# 基础镜像使用java
-FROM openjdk:8-jdk-alpine
-ADD drone.jar app.jar
-EXPOSE 6003
-ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","app.jar"]
+FROM registry.cn-shenzhen.aliyuncs.com/mogu-zh/jdk:8-mogu-alpine
+ENV LANG C.UTF-8
+ENV TZ Asia/Shanghai
+VOLUME /tmp
+ADD TestDrone-1.0-SNAPSHOT.jar TestDrone-1.0-SNAPSHOT.jar
+ENTRYPOINT ["java","-Xms256m","-Xmx256m","-jar","/TestDrone-1.0-SNAPSHOT.jar"]