From c7dbd3b1ee29c39d733175c49532a837b4507894 Mon Sep 17 00:00:00 2001 From: Ivan Remizov Date: Thu, 4 May 2017 23:06:30 +0300 Subject: [PATCH] Add tox templates This patch adds tox templates for running tox on generic repository --- library/scripts/jjb_compare_xml.sh | 6 +++ library/templates/tox.yaml | 71 ++++++++++++++++++++++++++++++ servers/example/projects/tox.yaml | 20 +++++++++ 3 files changed, 97 insertions(+) create mode 100644 library/templates/tox.yaml create mode 100644 servers/example/projects/tox.yaml diff --git a/library/scripts/jjb_compare_xml.sh b/library/scripts/jjb_compare_xml.sh index 909953e..382a5ae 100644 --- a/library/scripts/jjb_compare_xml.sh +++ b/library/scripts/jjb_compare_xml.sh @@ -1,5 +1,11 @@ #!/bin/bash +# This script expects these environment variables to be set: +# WORKSPACE - std. Jenkins variable, workspace of current build +# BUILD_URL - std. Jenkins variable, url of current build +# targetBranch - target branch of pull-request, provided by stash-pr-trigger +# pullRequestId - pull-request ID, provided by stash-pr-trigger + set -ex # workaround for old RHELs, we need to install correct tox system-wide diff --git a/library/templates/tox.yaml b/library/templates/tox.yaml new file mode 100644 index 0000000..2cb6575 --- /dev/null +++ b/library/templates/tox.yaml @@ -0,0 +1,71 @@ +- job-template: + id: 'library/tox' + name: '{project-key}.{repo-slug}.{branch-display-name}.tox' + + description: | +

Tox tests +

+ Run tox for PRs in {project-key}/{repo-slug} proposed to {branch} + + node: '{tox/node}' + + concurrent: true + + stash-poll-timer: '* * * * *' # !default + tox/timeout: 10 # !default + + parameters: + - library/stash-trigger/parameters + + wrappers: + - inject-passwords: + global: true + mask-password-params: true + - ansicolor: + colormap: xterm + - timeout: + fail: true + timeout: '{tox/timeout}' + write-description: true + + triggers: + - library/stash-trigger/trigger: + project-key: '{project-key}' + repo-slug: '{repo-slug}' + branch: '{branch}' + timer: '{stash-poll-timer}' + host: '{host}' + credentials-id: '{credentials-id}' + username: '{username}' + password: '{password}' + + scm: + - library/stash-trigger/scm: + host: '{host}' + port: '{port}' + username: '{username}' + password: '{password}' + credentials-id: '{credentials-id}' + + builders: + - shell: | + #!/bin/bash + set -ex + + # workaround for old RHELs, we need to install correct tox system-wide + rm -rf venv + virtualenv venv + source venv/bin/activate + pip install pip --upgrade + pip install tox + # --- + + rm -rf .tox + tox + + publishers: + - library/stash-trigger/publish-feedback: + host: '{host}' + username: '{username}' + password: '{password}' + credentials-id: '{credentials-id}' \ No newline at end of file diff --git a/servers/example/projects/tox.yaml b/servers/example/projects/tox.yaml new file mode 100644 index 0000000..f4e975f --- /dev/null +++ b/servers/example/projects/tox.yaml @@ -0,0 +1,20 @@ +- project: + name: tox-example + + tox/node: tox-node # example + + project-key: AA # example + repo-slug: jjb-library # example + branch-display-name: master + branch: master + + host: git.my-bitbucket.org + port: 443 + credentials-id: '' + username: '' + password: '' + + tox/timeout: 10 + + jobs: + - library/tox \ No newline at end of file