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-819. Azure Pipelines Support
Date Tue, 19 Mar 2019 15:58:04 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 6dba2bb  YETUS-819. Azure Pipelines Support
6dba2bb is described below

commit 6dba2bb1234dbe59da13328ed370c1ea4c74818a
Author: Allen Wittenauer <aw@apache.org>
AuthorDate: Mon Mar 4 19:43:28 2019 -0800

    YETUS-819. Azure Pipelines Support
    
    Signed-off-by: Allen Wittenauer <aw@apache.org>
---
 .../documentation/in-progress/precommit-robots.md  |  25 +++++
 azure-pipelines.yml                                |  35 +++++++
 .../src/main/shell/robots.d/azurepipelines.sh      | 104 +++++++++++++++++++++
 3 files changed, 164 insertions(+)

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 143bff6..73b37e3 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-robots.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-robots.md
@@ -17,9 +17,27 @@
   under the License.
 -->
 
+
 Robots: Continuous Integration Support
 ======================================
 
+<!-- MarkdownTOC levels="1,2" autolink="true" -->
+
+* [Intro](#intro)
+* [Azure Pipelines](#azure-pipelines)
+* [Circle CI](#circle-ci)
+* [Gitlab CI](#gitlab-ci)
+* [Jenkins](#jenkins)
+* [Semaphore CI](#semaphore-ci)
+* [Travis CI](#travis-ci)
+* [Manual Configuration](#manual-configuration)
+* [Sentinel Mode](#sentinel-mode)
+
+<!-- /MarkdownTOC -->
+
+Intro
+=====
+
 `test-patch` works hand-in-hand with various CI and other automated build systems.  `test-patch`
will attempt to auto-determine if it is running under such a system and change its defaults
to match known configuration parameters automatically. When robots are activated, there is
generally some additional/changed behavior:
 
   * display extra information in the footer
@@ -31,6 +49,13 @@ Robots: Continuous Integration Support
   * activate Docker maintenance when `--docker` is passed
   * attempt to determine whether this is a full build (`qbt`) or testing a patch/merge request/pull
request.
 
+Azure Pipelines
+===============
+
+TRIGGER: ${TF_BUILD}=True
+
+Azure Pipelines support has only been tested on the Ubuntu VM with GitHub as the source repository.
It automatically configures `--patch-dir` to be `${BUILD_ARTIFACTSTAGINGDIRECTORY}/yetus`.
 While the URL to the console is provided in the report, links are not provided due to the
URLs to artifacts not being available at runtime.
+
 Circle CI
 =========
 
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 0000000..2da7e99
--- /dev/null
+++ b/azure-pipelines.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.
+---
+
+pool:
+  vmImage: 'Ubuntu-16.04'
+
+steps:
+  - bash: env
+  - bash: >
+          precommit/src/main/shell/test-patch.sh
+          --docker
+          --docker-cache-from=apache/yetus-base:master
+          --dockerfile=precommit/src/main/shell/test-patch-docker/Dockerfile
+          --plugins=all
+          --tests-filter=checkstyle,javadoc,rubocop,test4tests
+    displayName: 'Run test-patch'
+
+  - task: PublishPipelineArtifact@0
+    condition: always()
+    inputs:
+      artifactName: 'yetus'
+      targetPath: $(Build.ArtifactStagingDirectory)/yetus
diff --git a/precommit/src/main/shell/robots.d/azurepipelines.sh b/precommit/src/main/shell/robots.d/azurepipelines.sh
new file mode 100755
index 0000000..f21d4d5
--- /dev/null
+++ b/precommit/src/main/shell/robots.d/azurepipelines.sh
@@ -0,0 +1,104 @@
+#!/usr/bin/env bash
+# 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.
+
+# no public APIs here
+# SHELLDOC-IGNORE
+
+# shellcheck disable=2034
+if [[ "${TF_BUILD}" = True ]] &&
+  declare -f compile_cycle >/dev/null; then
+  if [[ ${BUILD_REPOSITORY_URI} =~ github.com ]]; then
+
+    if [[ "${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}" ]]; then
+      BUILDMODE="patch"
+      PATCH_OR_ISSUE="GH:${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}"
+      USER_PARAMS+=("GH:${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}")
+      PATCH_BRANCH="${SYSTEM_PULLREQUEST_TARGETBRANCH}"
+    else
+      BUILDMODE=full
+      USER_PARAMS+=("--empty-patch")
+      # which will be 'Merge' on PRs for some reason
+      PATCH_BRANCH="${BUILD_SOURCEBRANCHNAME}"
+    fi
+    GITHUB_REPO=${BUILD_REPOSITORY_ID}
+    ROBOT=true
+    ROBOTTYPE=azurepipelines
+
+
+    #echo "${SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}_build?definitionId=${SYSTEM_DEFINITIONID}"
+
+    BUILD_URL="${SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${SYSTEM_TEAMPROJECT}"
+    BUILD_URL_CONSOLE="/_build/results?buildId=${BUILD_BUILDID}"
+    CONSOLE_USE_BUILD_URL=false
+
+    if [[ -n "${BUILD_SOURCESDIRECTORY}" ]] && [[ -d "${BUILD_SOURCESDIRECTORY}"
]]; then
+      BASEDIR=${BUILD_SOURCESDIRECTORY}
+    fi
+
+    if [[ -n "${BUILD_ARTIFACTSTAGINGDIRECTORY}" ]] && [[ -d "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
]]; then
+      PATCH_DIR=${BUILD_ARTIFACTSTAGINGDIRECTORY}/yetus
+    fi
+
+    git_requires_creds
+
+    if [[ "${GIT_OFFLINE}" == false ]]; then
+      yetus_error "WARNING: Working around Azure Pipelines branch information"
+      pushd "${BASEDIR}" >/dev/null || exit 1
+      "${GIT}" remote set-branches origin '*'
+      "${GIT}" fetch -v
+      popd >/dev/null || exit 1
+    fi
+
+    if [[ -z "${PATCH_OR_ISSUE}" ]] && [[ -n "${BRANCH_NAME}" ]]; then
+      if [[ "${GIT_OFFLINE}" == false ]]; then
+        yetus_error "WARNING: Resetting Jenkins git upstream information"
+        pushd "${BASEDIR}" >/dev/null || exit 1
+        "${GIT}" branch --set-upstream-to=origin/"${BRANCH_NAME}" "${BRANCH_NAME}"
+        popd >/dev/null || exit 1
+      fi
+      PATCH_BRANCH=${BRANCH_NAME}
+    fi
+
+    add_docker_env \
+      BUILD_ARTIFACTSTAGINGDIRECTORY \
+      BUILD_BUILDID \
+      BUILD_REPOSITORY_ID \
+      BUILD_REPOSITORY_URI \
+      BUILD_SOURCEBRANCHNAME \
+      BUILD_SOURCESDIRECTORY \
+      SYSTEM_PULLREQUEST_PULLREQUESTNUMBER \
+      SYSTEM_PULLREQUEST_TARGETBRANCH \
+      SYSTEM_TEAMFOUNDATIONCOLLECTIONURI \
+      SYSTEM_TEAMPROJECT \
+      SYSTEM_TEAMPROJECTID \
+      TF_BUILD
+
+    yetus_add_array_element EXEC_MODES Azure_Pipelines
+  fi
+fi
+
+function azurepipelines_set_plugin_defaults
+{
+  if [[ ${BUILD_REPOSITORY_URI} =~ github.com ]]; then
+    github_breakup_url "${BUILD_REPOSITORY_URI}"
+    GITHUB_REPO=${BUILD_REPOSITORY_ID}
+  fi
+}
+
+function azurepipelines_finalreport
+{
+  add_footer_table "Console output" "${BUILD_URL}${BUILD_URL_CONSOLE}"
+}
\ No newline at end of file


Mime
View raw message