yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [yetus] branch master updated: YETUS-874. Add support for Cirrus CI from Cirrus Labs (#49)
Date Wed, 08 May 2019 19:03:29 GMT
This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/master by this push:
     new ebdf1ea  YETUS-874. Add support for Cirrus CI from Cirrus Labs (#49)
ebdf1ea is described below

commit ebdf1ea8b65097712827ab31a692592f2a1facc0
Author: Allen Wittenauer <aw@apache.org>
AuthorDate: Wed May 8 12:03:24 2019 -0700

    YETUS-874. Add support for Cirrus CI from Cirrus Labs (#49)
---
 .cirrus.yml                                        | 35 ++++++++++
 .../documentation/in-progress/precommit-robots.md  | 34 ++++++++++
 .../shell/robots.d/{travisci.sh => cirrusci.sh}    | 78 ++++++++++++----------
 precommit/src/main/shell/robots.d/travisci.sh      |  2 +-
 4 files changed, 112 insertions(+), 37 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
new file mode 100644
index 0000000..16a5e39
--- /dev/null
+++ b/.cirrus.yml
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+
+yetus_task:
+  container:
+    image: apache/yetus:master
+  test_script: >
+             ${CIRRUS_WORKING_DIR}/precommit/src/main/shell/test-patch.sh
+             --plugins=all
+             --basedir="${CIRRUS_WORKING_DIR}"
+             --html-report-file=/tmp/yetus-out/report.html
+             --console-report-file=/tmp/yetus-out/console.txt
+             --brief-report-file=/tmp/yetus-out/brief.txt
+             --bugcomments=briefreport,htmlout,junit
+             --tests-filter=checkstyle,javadoc,rubocop,test4tests
+  always:
+    junit_artifacts:
+      path: "yetus-out/junit.xml"
+      format: junit
+    other_artifacts:
+      path: "yetus-out/**"
diff --git a/asf-site-src/source/documentation/in-progress/precommit-robots.md b/asf-site-src/source/documentation/in-progress/precommit-robots.md
index 8e73c1d..0b11fe0 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-robots.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-robots.md
@@ -24,6 +24,7 @@
 * [Intro](#intro)
 * [Azure Pipelines](#azure-pipelines)
 * [Circle CI](#circle-ci)
+* [Cirrus CI](#cirrus-ci)
 * [Gitlab CI](#gitlab-ci)
 * [Jenkins](#jenkins)
 * [Semaphore CI](#semaphore-ci)
@@ -101,6 +102,39 @@ See also:
 
 * Apache Yetus' source tree [.circleci/config.yaml](https://github.com/apache/yetus/blob/master/.circleci/config.yml)
for some tips and tricks.
 
+# Cirrus CI
+
+TRIGGER: ${CIRRUS_CI}=true
+
+`--patch-dir` will be configured to be `/tmp/yetus-out` and will be moved to the `yetus-out`
directory in the source tree after completion. Adding this stanza to your `.cirrus.yml` file
will upload and store those components for a week in Gitlab CI's artifact retrieval system:
+
+```yaml
+---
+  always:
+    junit_artifacts:
+      path: "yetus-out/junit.xml"
+      format: junit
+    other_artifacts:
+      path: "yetus-out/**"
+```
+
+To use the `--patch-dir` for additional output, use the `/tmp/yetus-out` path. For example:
`--html-report-file=/tmp/yetus-out/report.html`.
+
+To use the pre-built Apache Yetus Docker image from docker hub as the build environment,
use the following snippet in the `.cirrus.yml` file, substituting the tag for the version
of Apache Yetus that should be used and replacing the `JAVA_HOME` with the appropriate version
as bundled mentioned in the Dockerfile:
+
+```yaml
+---
+yetus_task:
+  container:
+    image: apache/yetus:0.10.0
+
+  ...
+```
+
+See also:
+
+* Apache Yetus' source tree [.cirrus.yml](https://github.com/apache/yetus/blob/master/.cirrus.yml)
for some tips and tricks.
+
 # Gitlab CI
 
 TRIGGER: ${GITLAB_CI}=true
diff --git a/precommit/src/main/shell/robots.d/travisci.sh b/precommit/src/main/shell/robots.d/cirrusci.sh
similarity index 58%
copy from precommit/src/main/shell/robots.d/travisci.sh
copy to precommit/src/main/shell/robots.d/cirrusci.sh
index 1334c1f..e1421d2 100755
--- a/precommit/src/main/shell/robots.d/travisci.sh
+++ b/precommit/src/main/shell/robots.d/cirrusci.sh
@@ -16,46 +16,52 @@
 
 # SHELLDOC-IGNORE
 
-if [[ "${TRAVIS}" == true ]] &&
+if [[ "${CIRRUS_CI}" == true ]] &&
   declare -f compile_cycle >/dev/null; then
   # shellcheck disable=SC2034
   ROBOT=true
-
   # shellcheck disable=SC2034
-  if [[ -n "${ARTIFACTS_PATH}" ]]; then
-    PATCH_DIR=${ARTIFACTS_PATH%%:*}
-  fi
-
+  PATCH_BRANCH_DEFAULT=${CIRRUS_DEFAULT_BRANCH}
+  # shellcheck disable=SC2034
+  INSTANCE=${CIRRUS_BUILD_ID}
   # shellcheck disable=SC2034
-  INSTANCE=${TRAVIS_BUILD_ID}
+  ROBOTTYPE=cirrusci
+  PATCH_DIR=/tmp/yetus-out
   # shellcheck disable=SC2034
-  ROBOTTYPE=travisci
+  RELOCATE_PATCH_DIR=true
+
 
   # shellcheck disable=SC2034
-  if [[ "${TRAVIS_PULL_REQUEST}" == false ]]; then
-    BUILDMODE=full
-    PATCH_BRANCH=${TRAVIS_BRANCH}
-  else
+  if [[ "${CIRRUS_PR}" == false ]]; then
     # shellcheck disable=SC2034
     BUILDMODE='patch'
     # shellcheck disable=SC2034
-    PATCH_OR_ISSUE=GH:${TRAVIS_PULL_REQUEST}
-    USER_PARAMS+=("GH:${TRAVIS_PULL_REQUEST}")
+    PATCH_OR_ISSUE=GH:${CIRRUS_PR}
+    USER_PARAMS+=("GH:${CIRRUS_PR}")
+  else
+    BUILDMODE=full
+    PATCH_BRANCH=${CIRRUS_BRANCH}
   fi
 
   # shellcheck disable=SC2034
-  GITHUB_REPO=${TRAVIS_REPO_SLUG}
+  GITHUB_REPO=${CIRRUS_REPO_FULL_NAME}
 
   add_docker_env \
-    TRAVIS \
-    TRAVIS_BRANCH \
-    TRAVIS_BUILD_ID \
-    TRAVIS_BUILD_WEB_URL \
-    TRAVIS_PULL_REQUEST \
-    TRAVIS_REPO_SLUG
+    CI \
+    CIRRUS_CI \
+    CIRRUS_DEFAULT_BRANCH \
+    CIRRUS_BUILD_ID \
+    CIRRUS_PR \
+    CIRRUS_BRANCH \
+    CIRRUS_REPO_FULL_NAME \
+    CIRRUS_TASK_ID \
+    CIRRUS_BUILD_ID
+
+  # shellcheck disable=SC2034
+  BUILD_URL="https://cirrus-ci.com/task/${CIRRUS_TASK_ID}"
 
   # shellcheck disable=SC2034
-  BUILD_URL_CONSOLE=console
+  BUILD_URL_CONSOLE=""
   # shellcheck disable=SC2034
   CONSOLE_USE_BUILD_URL=true
 
@@ -64,29 +70,29 @@ if [[ "${TRAVIS}" == true ]] &&
     pushd "${BASEDIR}" >/dev/null || exit 1
     "${GIT}" config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
     "${GIT}" fetch --tags
-    pushd "${BASEDIR}" >/dev/null || exit 1
+    popd >/dev/null || exit 1
   fi
 
-  yetus_add_array_element EXEC_MODES TravisCI
+  yetus_add_array_element EXEC_MODES CirrusCI
 fi
 
-function travisci_set_plugin_defaults
+function cirrusci_set_plugin_defaults
 {
   # shellcheck disable=SC2034
-  GITHUB_REPO=${TRAVIS_REPO_SLUG}
+  GITHUB_REPO=${CIRRUS_REPO_FULL_NAME}
+  # shellcheck disable=SC2034
+  JUNIT_RESULTS_XML="${PATCH_DIR}/junit.xml"
 }
 
-function travisci_finalreport
+function cirrusci_finalreport
 {
-  add_footer_table "Console output" "${TRAVIS_BUILD_WEB_URL}"
+  add_footer_table "Console output" "${BUILD_URL}"
 }
 
-#function travisci_verify_patchdir
-#{
-#  declare commentfile=$1
-#}
+function cirrusci_artifact_url
+{
+  declare dir
 
-#function travisci_unittest_footer
-#{
-#  declare statusjdk=$1
-#}
+  dir=${PATCH_DIR##*/}
+  echo "https://api.cirrus-ci.com/v1/artifact/task/${CIRRUS_TASK_ID}/other/${dir}"
+}
\ No newline at end of file
diff --git a/precommit/src/main/shell/robots.d/travisci.sh b/precommit/src/main/shell/robots.d/travisci.sh
index 1334c1f..7b230b0 100755
--- a/precommit/src/main/shell/robots.d/travisci.sh
+++ b/precommit/src/main/shell/robots.d/travisci.sh
@@ -64,7 +64,7 @@ if [[ "${TRAVIS}" == true ]] &&
     pushd "${BASEDIR}" >/dev/null || exit 1
     "${GIT}" config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
     "${GIT}" fetch --tags
-    pushd "${BASEDIR}" >/dev/null || exit 1
+    popd >/dev/null || exit 1
   fi
 
   yetus_add_array_element EXEC_MODES TravisCI


Mime
View raw message