Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 170 additions & 0 deletions jobs/build-triggers/tendrl-build-triggers-pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
---
- job-template:
name: "tendrl-pr-trigger-tests-{package_name}"
display-name: 'Tendrl test (PR) - {package_name}'
description: |
<b>Job triggering test suite execution.</b><br>
<br>
It might be triggered by following phrase in comment in the respective PR:
<pre>
run tests
</pre>
And it is also possible to specify dependencies on PRs from other repos
in following format (in the PR description or in the comment triggering
the tests)
<pre>
Depends on: &lt;repo-name&gt;/pr&lt;pr_id&gt; &lt;repo2-name&gt;/pr&lt;pr2_id&gt;
</pre>
where <i>&lt;repo-name&gt;</i> is repo name including <i>tendrl-</i> prefix
and &lt;pr_id&gt; is PR number.
<br><br>
Maintainer: <a href="mailto:dahorak@redhat.com">Daniel Horak</a><br>
Team Contact: <a href="mailto:tendrl-devel@redhat.com">tendrl-devel</a><br>
JJB Code Location: <a href="https://github.com/Tendrl/tendrl-ci/tree/master/jobs">tendrl-ci</a><br>
Managed by Jenkins Job Builder. Do not edit via web.<br>
project-type: freestyle
package_prefix: "tendrl-"
defaults: global
disabled: false
concurrent: false
quiet-period: 0
block-downstream: false
block-upstream: false
node: 'tendrl-ci-slave01'
triggers: "{obj:triggers}"
scm: "{obj:scm}"
properties:
- github:
url: 'https://github.com/Tendrl/{package_name}/'
wrappers:
- timeout:
timeout: 60
abort: true
type: absolute
parameters:
- string:
name: ADDITIONAL_REPOS
default: ""
description: "Coma separated list of additional repos."
- string:
name: ADDITIONAL_REPOS_USM_SERVER
default: ""
description: "Coma separated list of additional repos."
- string:
name: ADDITIONAL_REPOS_USM_NODES
default: ""
description: "Coma separated list of additional repos."
- string:
name: ADDITIONAL_REPOS_USM_CLIENT
default: ""
description: "Coma separated list of additional repos."
builders:
- shell: |
#!/bin/bash -xe
echo
if [[ "${{ghprbPullId}}" ]]; then
echo "ghprbPullId: ${{ghprbPullId}}"
echo "ghprbCommentBody: ${{ghprbCommentBody}}"
echo "ghprbPullLongDescription: ${{ghprbPullLongDescription}}"
ADDITIONAL_REPOS="${{ADDITIONAL_REPOS}},http://artifacts.ci.centos.org/tendrl/pr/{package_prefix}{package_name}/pr${{ghprbPullId}}/{package_prefix}{package_name}-pr${{ghprbPullId}}.repo"
echo
echo "Parse ghprbCommentBody and ghprbPullLongDescription for dependent PRs."
# filter only lines containing "depends on:" string (and remove it)
# so it will iterate over list similar to this:
# tendrl-notifier/pr153 tendrl-commons/pr820 ...
for dependency in $(echo -e "${{ghprbCommentBody}}\n${{ghprbPullLongDescription}}" | \
grep -i "depends on:" | sed 's/depends on: //I'); do
package=${{dependency%/*}}
pr_id=${{dependency#*/}}
ADDITIONAL_REPOS="${{ADDITIONAL_REPOS}},http://artifacts.ci.centos.org/tendrl/pr/${{package}}/${{pr_id}}/${{package}}-${{pr_id}}.repo"
done
echo
fi

# Prepare env.sh file
echo > ${{WORKSPACE}}/env.sh
# use cop tendrl/tendrl (master) repo
echo "TENDRL_REPO=master" >> ${{WORKSPACE}}/env.sh
# configure additional repos
echo "ADDITIONAL_REPOS=${{ADDITIONAL_REPOS}}" >> ${{WORKSPACE}}/env.sh
echo "ADDITIONAL_REPOS_USM_SERVER=${{ADDITIONAL_REPOS_USM_SERVER}}" >> ${{WORKSPACE}}/env.sh
echo "ADDITIONAL_REPOS_USM_NODES=${{ADDITIONAL_REPOS_USM_NODES}}" >> ${{WORKSPACE}}/env.sh
echo "ADDITIONAL_REPOS_USM_CLIENT=${{ADDITIONAL_REPOS_USM_CLIENT}}" >> ${{WORKSPACE}}/env.sh
set +x

echo
echo "##############################################################"
echo "Run whole test suite."
echo
- trigger-builds:
- project: "tendrl-2-cluster-gluster"
property-file: env.sh
block: true

publishers:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where the test results will be posted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall status of the installation and tests is reported back to the PR where it was triggered (as a CentOS CI - tests line in the checks section) and Details link points to the particular job.
More granular results are available in the subsequent jobs (see Subproject Builds section of the Jenkins job).

Additionally when it fails, it will notify me over email, so I can check if it is real installation or test failure, or if it is problem with the tests itself.

- email:
recipients: dahorak@redhat.com


- project:
name: 'Test_suite'
triggers:
- github-pull-request:
admin-list:
- dahorak
white-list:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to input this rather than hardcoding

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same as for the build jobs. Itshould be possible, to automatically fetch the list of people from the organization specified below in the org-list section, but there seems to be some problem with this and I'm not sure why it doesn't work and where might be the problem with that.
I'll try to check that once more and find some more information about that - that will be definitely the best solution.

- a2batic
- cloudbehl
- fbalak
- gnehapk
- GowthamShanmugam
- julienlim
- ktdreyer
- ltrilety
- mbukatov
- mcarrano
- nnDarshan
- nthomas-redhat
- r0h4n
- rishubhjain
- sankarshanmukhopadhyay
- scuttlemonkey
- shirshendu
- shtripat
- sidhax
- tigert
- TimothyAsir
- TimothyAsirJeyasing
org-list:
- Tendrl
allow-whitelist-orgs-as-admins: false
trigger-phrase: '.*run test.*'
only-trigger-phrase: true
skip-build-phrase: 'no test'
github-hooks: true
cancel-builds-on-update: true
status-context: 'CentOS CI - tests'
status-add-test-results: false
scm:
- git:
url: 'https://github.com/Tendrl/{package_name}'
refspec: "+refs/pull/${{ghprbPullId}}/*:refs/remotes/origin/pr/${{ghprbPullId}}/*"
branches:
- "origin/pr/**"
basedir: tendrl-{package_name}
skip-tag: true
wipe-workspace: true
jobs:
- "tendrl-pr-trigger-tests-{package_name}"
package_name:
- api
- commons
- gluster-integration
- monitoring-integration
- node-agent
- notifier
- tendrl-ansible:
package_prefix: ""
- tendrl-selinux:
package_prefix: ""
- ui
2 changes: 1 addition & 1 deletion jobs/build-triggers/tendrl-build-triggers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
condition: ALWAYS

- email:
recipients: dahorak@redhat.com sds-mgmt-dev@redhat.com
recipients: dahorak@redhat.com
send-to-individuals: false


Expand Down