config.xml 6.72 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<?xml version='1.1' encoding='UTF-8'?>
<project>
  <actions/>
  <description>1. Build Code and run unit test.&#xd;
2. Source Code Analysis&#xd;
3. Print Coverage Report&#xd;
4. Print Unit Test Report&#xd;
&#xd;
Jenkins will send email to RD Team if build fails.</description>
  <keepDependencies>false</keepDependencies>
  <properties>
    <com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.12">
      <gitLabConnection>ylhealth</gitLabConnection>
    </com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
    <jenkins.model.BuildDiscarderProperty>
      <strategy class="hudson.tasks.LogRotator">
        <daysToKeep>-1</daysToKeep>
        <numToKeep>3</numToKeep>
        <artifactDaysToKeep>-1</artifactDaysToKeep>
        <artifactNumToKeep>-1</artifactNumToKeep>
      </strategy>
    </jenkins.model.BuildDiscarderProperty>
  </properties>
  <scm class="hudson.plugins.git.GitSCM" plugin="git@3.10.0">
    <configVersion>2</configVersion>
    <userRemoteConfigs>
      <hudson.plugins.git.UserRemoteConfig>
28
        <url>https://cm.ylhealth.org/gitlab/ym/HRB_Mobile.git</url>
29 30 31 32 33
        <credentialsId>3485e854-8389-40e8-8c86-b94e94e91904</credentialsId>
      </hudson.plugins.git.UserRemoteConfig>
    </userRemoteConfigs>
    <branches>
      <hudson.plugins.git.BranchSpec>
34
        <name>develop</name>
35 36 37 38 39 40 41 42 43 44 45
      </hudson.plugins.git.BranchSpec>
    </branches>
    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
    <submoduleCfg class="list"/>
    <extensions/>
  </scm>
  <assignedNode>&quot;Build Node 134&quot;||&quot;Build Node 133&quot;||master</assignedNode>
  <canRoam>false</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
46
  <triggers/>
47 48
  <concurrentBuild>false</concurrentBuild>
  <builders>
49
    <hudson.tasks.Shell>
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
      <command>#!/bin/groovy
pipeline {
  tools {
    nodejs &apos;default-nodejs&apos;
  }
  stages {
    stage(&apos;Startup&apos;) {
      steps {
        script {
          sh &apos;npm install&apos;
        }
      }
    }
    stage(&apos;Test&apos;) {
      steps {
        script {
          sh &apos;npm run test&apos;
        }
      }
      post {
        always {
          step([$class: &apos;CoberturaPublisher&apos;, coberturaReportFile: &apos;output/coverage/jest/cobertura-coverage.xml&apos;])
        }
      }
    }
    stage(&apos;Build&apos;) {
      steps {
        script {
          sh &apos;npm start&apos;
          sh &apos;npm pack&apos;
        }
      }
    }
    stage(&apos;Deploy&apos;) {
      when {
        expression {
          currentBuild.result == null || currentBuild.result == &apos;SUCCESS&apos;
        }
      }
      steps {
        script {
          def server = Artifactory.server &apos;My_Artifactory&apos;
          uploadArtifact(server)
        }
      }
    }
  }
}
def uploadArtifact(server) {
  def uploadSpec = &quot;&quot;&quot;{
            &quot;files&quot;: [
              {
                &quot;pattern&quot;: &quot;continuous-test-code-coverage-guide*.tgz&quot;,
                &quot;target&quot;: &quot;npm-stable/&quot;
              }
           ]
          }&quot;&quot;&quot;
  server.upload(uploadSpec)

  def buildInfo = Artifactory.newBuildInfo()
  server.upload spec: uploadSpec, buildInfo: buildInfo
  server.publishBuildInfo buildInfo
}</command>
113
    </hudson.tasks.Shell>
114 115 116
  </builders>
  <publishers>
    <hudson.plugins.cobertura.CoberturaPublisher plugin="cobertura@1.13">
117
      <coberturaReportFile>coverage/coverage.xml</coberturaReportFile>
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
      <onlyStable>false</onlyStable>
      <failUnhealthy>false</failUnhealthy>
      <failUnstable>false</failUnstable>
      <autoUpdateHealth>false</autoUpdateHealth>
      <autoUpdateStability>false</autoUpdateStability>
      <zoomCoverageChart>false</zoomCoverageChart>
      <maxNumberOfBuilds>0</maxNumberOfBuilds>
      <failNoReports>true</failNoReports>
      <lineCoverageTargets>80, 0, 0</lineCoverageTargets>
      <conditionalCoverageTargets>70, 0, 0</conditionalCoverageTargets>
      <healthyTarget>
        <targets class="enum-map" enum-type="hudson.plugins.cobertura.targets.CoverageMetric">
          <entry>
            <hudson.plugins.cobertura.targets.CoverageMetric>LINE</hudson.plugins.cobertura.targets.CoverageMetric>
            <int>8000000</int>
          </entry>
          <entry>
            <hudson.plugins.cobertura.targets.CoverageMetric>CONDITIONAL</hudson.plugins.cobertura.targets.CoverageMetric>
            <int>7000000</int>
          </entry>
        </targets>
      </healthyTarget>
      <unhealthyTarget>
        <targets class="enum-map" enum-type="hudson.plugins.cobertura.targets.CoverageMetric">
          <entry>
            <hudson.plugins.cobertura.targets.CoverageMetric>LINE</hudson.plugins.cobertura.targets.CoverageMetric>
            <int>0</int>
          </entry>
          <entry>
            <hudson.plugins.cobertura.targets.CoverageMetric>CONDITIONAL</hudson.plugins.cobertura.targets.CoverageMetric>
            <int>0</int>
          </entry>
        </targets>
      </unhealthyTarget>
      <failingTarget>
        <targets class="enum-map" enum-type="hudson.plugins.cobertura.targets.CoverageMetric">
          <entry>
            <hudson.plugins.cobertura.targets.CoverageMetric>LINE</hudson.plugins.cobertura.targets.CoverageMetric>
            <int>0</int>
          </entry>
          <entry>
            <hudson.plugins.cobertura.targets.CoverageMetric>CONDITIONAL</hudson.plugins.cobertura.targets.CoverageMetric>
            <int>0</int>
          </entry>
        </targets>
      </failingTarget>
      <sourceEncoding>ASCII</sourceEncoding>
      <enableNewApi>false</enableNewApi>
    </hudson.plugins.cobertura.CoberturaPublisher>
    <hudson.tasks.junit.JUnitResultArchiver plugin="junit@1.27">
168
      <testResults>coverage/junit.xml</testResults>
169 170 171 172 173
      <keepLongStdio>false</keepLongStdio>
      <healthScaleFactor>1.0</healthScaleFactor>
      <allowEmptyResults>false</allowEmptyResults>
    </hudson.tasks.junit.JUnitResultArchiver>
    <hudson.tasks.Mailer plugin="mailer@1.23">
174
      <recipients></recipients>
175 176 177 178 179 180 181 182 183 184 185 186 187 188
      <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
      <sendToIndividuals>false</sendToIndividuals>
    </hudson.tasks.Mailer>
  </publishers>
  <buildWrappers>
    <hudson.plugins.ws__cleanup.PreBuildCleanup plugin="ws-cleanup@0.37">
      <deleteDirs>false</deleteDirs>
      <cleanupParameter></cleanupParameter>
      <externalDelete></externalDelete>
      <disableDeferredWipeout>false</disableDeferredWipeout>
    </hudson.plugins.ws__cleanup.PreBuildCleanup>
    <hudson.plugins.timestamper.TimestamperBuildWrapper plugin="timestamper@1.9"/>
  </buildWrappers>
</project>