diff --git a/Jenkinsfile b/Jenkinsfile
index aa206682c8f..372cb465161 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -4,16 +4,21 @@
* Jenkinsfile for zanata-platform
*/
+@Field
+public static final String PROJ_URL = 'https://github.com/zanata/zanata-platform'
+
// Import pipeline library for utility methods & classes:
// ansicolor(), Notifier, PullRequests, Strings
@Field
-public static final String PIPELINE_LIBRARY_BRANCH = 'master'
+public static final String PIPELINE_LIBRARY_BRANCH = 'v0.3.0'
// GROOVY-3278:
// Using referenced String constant as value of Annotation causes compile error
-@Library('zanata-pipeline-library@master')
+@Library('zanata-pipeline-library@v0.3.0')
import org.zanata.jenkins.Notifier
import org.zanata.jenkins.PullRequests
+import org.zanata.jenkins.ScmGit
+import static org.zanata.jenkins.Reporting.codecov
import static org.zanata.jenkins.StackTraces.getStackTrace
import groovy.transform.Field
@@ -23,13 +28,15 @@ milestone()
PullRequests.ensureJobDescription(env, manager, steps)
+// initialiser must be run separately (bindings not available during compilation phase)
+@Field
+def pipelineLibraryScmGit
+
+@Field
+def mainScmGit
+
@Field
def notify
-// initialiser must be run separately (bindings not available during compilation phase)
-notify = new Notifier(env, steps, currentBuild,
- 'https://github.com/zanata/zanata-platform.git',
- 'Jenkinsfile', PIPELINE_LIBRARY_BRANCH,
-)
// we can't set these values yet, because we need a node to look at the environment
@Field
@@ -45,6 +52,13 @@ def jobName
// we need a node to access env.DEFAULT_NODE.
node {
echo "running on node ${env.NODE_NAME}"
+ pipelineLibraryScmGit = new ScmGit(env, steps, 'https://github.com/zanata/zanata-pipeline-library')
+ pipelineLibraryScmGit.init(PIPELINE_LIBRARY_BRANCH)
+ mainScmGit = new ScmGit(env, steps, PROJ_URL)
+ mainScmGit.init(env.BRANCH_NAME)
+ notify = new Notifier(env, steps, currentBuild,
+ pipelineLibraryScmGit, mainScmGit, 'Jenkinsfile',
+ )
defaultNodeLabel = env.DEFAULT_NODE ?: 'master || !master'
// eg github-zanata-org/zanata-platform/update-Jenkinsfile
jobName = env.JOB_NAME
@@ -59,7 +73,7 @@ node {
],
[
$class: 'GithubProjectProperty',
- projectUrlStr: 'https://github.com/zanata/zanata-platform'
+ projectUrlStr: PROJ_URL
],
[
$class: 'ParametersDefinitionProperty',
@@ -231,21 +245,7 @@ timestamps {
// TODO try https://github.com/jenkinsci/github-pr-coverage-status-plugin
// send test coverage data to codecov.io
- try {
- withCredentials(
- [[$class: 'StringBinding',
- credentialsId: 'codecov_zanata-platform',
- variable: 'CODECOV_TOKEN']]) {
- // NB the codecov script uses CODECOV_TOKEN
- sh "curl -s https://codecov.io/bash | bash -s - -K"
- }
- } catch (InterruptedException e) {
- throw e
- } catch (hudson.AbortException e) {
- throw e
- } catch (e) {
- echo "[WARNING] Ignoring codecov error: $e"
- }
+ codecov(env, steps, mainScmGit)
// notify if compile+unit test successful
// TODO update notify (in pipeline library) to support Rocket.Chat webhook integration
diff --git a/api/zanata-common-api/pom.xml b/api/zanata-common-api/pom.xml
index b0732bb634e..9d747450c0c 100644
--- a/api/zanata-common-api/pom.xml
+++ b/api/zanata-common-api/pom.xml
@@ -9,7 +9,7 @@
api
4.4.0-SNAPSHOT
- takari-jar
+ jar
diff --git a/build b/build
index 2425ac756d6..e5a03f3a587 100755
--- a/build
+++ b/build
@@ -71,7 +71,6 @@ General options:
-c, --clean (mvn clean)
-C, --clean-partial
removes various generated files from server without running a full mvn clean
- (takari lifecycle handles this in jar modules)
-P, --skip-package
runs mvn test instead of mvn package
-i, --install (mvn install)
diff --git a/build-tools/pom.xml b/build-tools/pom.xml
index 22cf9931b48..78fbf7b4fac 100644
--- a/build-tools/pom.xml
+++ b/build-tools/pom.xml
@@ -6,7 +6,7 @@
Build Tools
Build tools for Zanata modules
http://zanata.org/
- takari-jar
+ jar
@@ -59,26 +59,11 @@
1.8
-
-
-
- io.takari.maven.plugins
- takari-lifecycle-plugin
-
- 1.12.4
- true
-
- proc
-
-
-
-
-
com.lesfurets
jenkins-pipeline-unit
- 0.12
+ 1.1
test
diff --git a/build-tools/src/test/java/TestJenkinsfile.java b/build-tools/src/test/java/TestJenkinsfile.java
index d451abc9732..3bdc90a0e87 100644
--- a/build-tools/src/test/java/TestJenkinsfile.java
+++ b/build-tools/src/test/java/TestJenkinsfile.java
@@ -1,22 +1,23 @@
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.codehaus.groovy.runtime.MethodClosure;
+import org.junit.Before;
+import org.junit.Test;
import com.cloudbees.groovy.cps.impl.CpsCallableInvocation;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.lesfurets.jenkins.unit.cps.BasePipelineTestCPS;
import com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration;
import groovy.lang.Closure;
-import org.codehaus.groovy.runtime.MethodClosure;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import static com.lesfurets.jenkins.unit.MethodSignature.method;
import static com.lesfurets.jenkins.unit.global.lib.GitSource.gitSource;
import static com.lesfurets.jenkins.unit.global.lib.LibraryConfiguration.library;
import static java.lang.Boolean.TRUE;
+import static org.assertj.core.api.Assertions.assertThat;
// try 'extends BasePipelineTest' for debugging in case of weird Groovy exceptions
public class TestJenkinsfile extends BasePipelineTestCPS {
@@ -66,24 +67,8 @@ public void setUp() throws Exception {
throw new RuntimeException("Unmocked invocation");
});
getHelper().registerAllowedMethod(method("sh", Map.class),
- args -> {
- @SuppressWarnings("unchecked")
- Map a = (Map) args;
- if (TRUE.equals(a.get("returnStdout"))) {
- String script = a.get("script").toString();
- if (script.contains("allocate-jboss-ports")) {
- return "JBOSS_HTTP_PORT=51081\nSMTP_PORT=34765\n";
- }
- // Notifier.groovy in zanata-pipeline-library uses this:
- if (script.contains("git ls-remote")) {
- return "1234567890 abcdef\n";
- }
- }
- if (TRUE.equals(a.get("returnStatus"))) {
- return 0;
- }
- return 0;
- });
+ SH.INSTANCE);
+
// PipelineUnit(withCredentialsInterceptor) can't handle a List