forked from apache/yetus
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
YETUS-681. Add robots plugin type YETUS-649. Travis CI support YETUS-684. add support for Gitlab CI YETUS-687. add better docker env support Circle CI support
- Loading branch information
1 parent
e8046f0
commit f055aa3
Showing
18 changed files
with
870 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# 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. | ||
|
||
--- | ||
|
||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: awwashere/buretoolbox | ||
|
||
working_directory: ~/repo | ||
|
||
environment: | ||
# Customize the JVM maximum heap limit | ||
MAVEN_OPTS: -Xmx3200m | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "pom.xml" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies- | ||
|
||
- run: > | ||
~/repo/precommit/src/main/shell/test-patch.sh | ||
--plugins=all | ||
--patch-dir=/tmp/yetus-out | ||
- save_cache: | ||
paths: | ||
- ~/.m2 | ||
key: v1-dependencies-{{ checksum "pom.xml" }} | ||
|
||
- store_artifacts: | ||
path: /tmp/yetus-out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 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. | ||
|
||
--- | ||
|
||
buretoolbox-job: | ||
image: awwashere/buretoolbox | ||
allow_failure: true | ||
script: | ||
- > | ||
precommit/src/main/shell/test-patch.sh | ||
--patch-dir=/tmp/yetus-out | ||
--plugins=all | ||
--java-home=/usr/lib/jvm/java-8-openjdk-amd64 | ||
artifacts: | ||
expire_in: 1 week | ||
when: always | ||
paths: | ||
- yetus-out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 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. | ||
|
||
--- | ||
|
||
sudo: required | ||
|
||
services: | ||
- docker | ||
|
||
addons: | ||
artifacts: true | ||
paths: | ||
- yetus-out | ||
|
||
script: | ||
- > | ||
precommit/src/main/shell/test-patch.sh | ||
--docker | ||
--patch-dir=/tmp/yetus-out | ||
--plugins=all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// 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. | ||
pipeline { | ||
agent any | ||
triggers { | ||
cron('@daily') | ||
} | ||
options { | ||
buildDiscarder(logRotator(numToKeepStr: '5')) | ||
timeout (time: 9, unit: 'HOURS') | ||
timestamps() | ||
checkoutToSubdirectory('src') | ||
} | ||
environment { | ||
//YETUS_RELEASE = '0.8.0' | ||
YETUS_BASEDIR = 'src' | ||
// will also need to change email section below | ||
YETUS_RELATIVE_PATCHDIR = 'out' | ||
YETUS_DOCKERFILE = "${YETUS_BASEDIR}/precommit/src/main/shell/test-patch-docker/Dockerfile" | ||
} | ||
stages { | ||
stage ('precommit-run') { | ||
steps { | ||
sh '''#!/usr/bin/env bash | ||
env | ||
if [[ -d "${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}" ]]; then | ||
rm -rf "${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}" | ||
fi | ||
mkdir -p "${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}" | ||
# where the source is located | ||
YETUS_ARGS+=("--basedir=${WORKSPACE}/${YETUS_BASEDIR}") | ||
# nuke the src repo before working | ||
YETUS_ARGS+=("--resetrepo") | ||
# Enable maven custom repos in order to avoid multiple executor clashes | ||
YETUS_ARGS+=("--mvn-custom-repos") | ||
# run in docker mode | ||
YETUS_ARGS+=("--docker") | ||
# temp storage, etc | ||
YETUS_ARGS+=("--patch-dir=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}") | ||
# lots of different output formats | ||
YETUS_ARGS+=("--brief-report-file=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}/brief.txt") | ||
YETUS_ARGS+=("--console-report-file=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}/console.txt") | ||
YETUS_ARGS+=("--html-report-file=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}/report.html") | ||
# rsync these files back into the archive dir | ||
YETUS_ARGS+=("--archive-list=checkstyle-errors.xml,findbugsXml.xml") | ||
# URL for user-side presentation | ||
YETUS_ARGS+=("--build-url-artifacts=artifact/out") | ||
# plugins to enable | ||
YETUS_ARGS+=("--plugins=all") | ||
# run test-patch from the source tree specified up above | ||
TESTPATCHBIN=${WORKSPACE}/src/precommit/src/main/shell/test-patch.sh | ||
/usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}" | ||
''' | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
// Has to be relative to WORKSPACE. | ||
archiveArtifacts "${env.YETUS_RELATIVE_PATCHDIR}/**" | ||
publishHTML target: [ | ||
allowMissing: true, | ||
keepAll: true, | ||
alwaysLinkToLastBuild: true, | ||
// Has to be relative to WORKSPACE | ||
reportDir: "${env.YETUS_RELATIVE_PATCHDIR}", | ||
reportFiles: 'report.html', | ||
reportName: 'Yetus QBT Report' | ||
] | ||
} | ||
failure { | ||
emailext subject: '$DEFAULT_SUBJECT', | ||
body: '''For more details, see ${BUILD_URL} | ||
${CHANGES, format="[%d] (%a) %m"} | ||
${FILE,path="out/brief.txt"}''', | ||
recipientProviders: [ | ||
[$class: 'CulpritsRecipientProvider'], | ||
[$class: 'DevelopersRecipientProvider'], | ||
[$class: 'RequesterRecipientProvider'] | ||
], | ||
replyTo: '$DEFAULT_REPLYTO', | ||
to: '$DEFAULT_RECIPIENTS' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
asf-site-src/source/documentation/in-progress/precommit-robots.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<!--- | ||
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. | ||
--> | ||
|
||
Robots: Continuous Integration Support | ||
====================================== | ||
|
||
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 | ||
* change log entries from file names to URLs | ||
* activate --resetrepo | ||
* enable the running of unit tests and run them in parallel | ||
* if possible, write comments to bug systems | ||
* attempt to determine the build tool in use | ||
* activate Docker maintenance when --docker is passed | ||
* attempt to determine whether this is a full build (qbt-mode) or testing a patch/merge request/pull request. | ||
|
||
Circle CI | ||
========= | ||
|
||
TRIGGER: ${CIRCLECI}=true | ||
|
||
Circle CI support in test-patch is limited to github.com. Artifacts (the --patch-dir directory) need to be handled directly on the command line. Linking to the logs is not currently supported. | ||
|
||
Gitlab CI | ||
========= | ||
|
||
TRIGGER: ${GITLAB_CI}=true | ||
|
||
Artifacts, patch logs, etc are configured to go to a yetus-out directory in the source tree after completion. Adding this stanza to your .gitlab-ci.yml file will upload and store those components for a week in Gitlab CI's artifact retrieval system: | ||
|
||
```yaml | ||
artifacts: | ||
expire_in: 1 week | ||
when: always | ||
paths: | ||
- yetus-out/ | ||
|
||
``` | ||
|
||
Jenkins | ||
======= | ||
|
||
TRIGGER: ${JENKINS_URL}=(anything) | ||
|
||
Jenkins is extremely open-ended and, given multiple executors, does not run workflows in isolation. As a result, many more configuration options generally need to be configured as it is not safe or may be suprising to users for test-patch to autodetermine some settings. By default, Jenkins will trigger a full build. | ||
|
||
There is some support for a few well known environment variables: | ||
* ${CHANGE_URL} or ${ghprbPullLink} will set the patch location as well as trigger some extra handling if 'github' or 'gitlab' appear in the string. | ||
* ${GIT_URL} will trigger the same extra handling if 'github' or 'gitlab' appear in the string. | ||
* If ${ghprbPullId} is set, then test-patch will configure itself for a Github-style PR. | ||
|
||
|
||
See also | ||
* See also the source tree's Jenkinsfile for some tips and tricks. | ||
* [precommit-admin](precommit-admin), for special utilities built for Jenkins. | ||
* [GitHub Branch Source Plugin](https://wiki.jenkins.io/display/JENKINS/GitHub+Branch+Source+Plugin) | ||
* [GitHub Pull Request Builder Plugin](https://wiki.jenkins.io/display/JENKINS/GitHub+pull+request+builder+plugin) | ||
* https://{your local server}/env-vars.html/ | ||
|
||
Travis CI | ||
========= | ||
|
||
TRIGGER: ${TRAVIS}=true | ||
|
||
Travis CI support will update the local checked out source repository to include references to all branches and tags | ||
|
||
If ${ARTIFACTS_PATH} is configured, then '--patch-dir' is set to the first listed directory path. However, links to the location logs must still be configured manually. | ||
|
||
Personalities will override the auto-detected Github repository information. It may be necessary to manually configure it in your .travis.yml file. |
Oops, something went wrong.