INFRA: Switch to tox for JJB verify and merge jobs
[infra/cicd.git] / tox.ini
diff --git a/tox.ini b/tox.ini
new file mode 100644 (file)
index 0000000..6f20440
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,49 @@
+[tox]
+basepython = py36
+minversion = 2.5
+skipsdist = true
+envlist = shellcheck, yamllint, jjbtest, jjbdeploy
+install_command = pip install --force-reinstall {opts} {packages}
+deps = -r{toxinidir}/jjb/infra/test-requirements.txt
+
+[testenv:jjbtest]
+description = invoke jenkins-job-builder to analyse jjb templates
+passenv = *
+deps = -r{toxinidir}/jjb/infra/test-requirements.txt
+whitelist_externals = bash
+commands =
+  bash -c "jenkins-jobs --conf {toxinidir}/jjb/global/jenkins_jobs.ini \
+      test --config-xml --recursive {toxinidir}/jjb"
+
+[testenv:jjbdeploy]
+description = invoke jenkins-job-builder to deploy jobs from jjb templates
+passenv = *
+deps = -r{toxinidir}/jjb/infra/test-requirements.txt
+whitelist_externals = bash
+commands =
+  bash -c "jenkins-jobs --conf {toxinidir}jjb/global/jenkins_jobs.ini \
+      --user $JJB_USERNAME --password $JJB_USERTOKEN update --recursive \
+      --delete-old --workers 4 {toxinidir}/jjb"
+
+[testenv:yamllint]
+description = invoke yamllint to analyse YAML files
+deps = -r{toxinidir}/jjb/infra/test-requirements.txt
+ignore_outcome=true
+whitelist_externals = bash
+commands =
+  bash -c "find {toxinidir} -type f -regex '.*.ya?ml' \
+    ! -regex '.*.tox.*\|.*.venv.*' \
+    -print0 | xargs -t -n1 -0 yamllint --format standard --strict"
+
+[testenv:shellcheck]
+description = invoke shellcheck to analyse bash shell scripts
+deps = -r{toxinidir}/jjb/infra/test-requirements.txt
+ignore_outcome=true
+whitelist_externals = bash
+commands =
+  bash -c "find {toxinidir} -type f -regex '.*.sh' \
+    ! -regex '.*.tox.*\|.*.venv.*' \
+    -print0 | xargs -t -n1 -0 shellcheck --color=never --source-path={toxinidir} \
+    --external-sources --format=tty"
+
+# vim: set ts=2 sw=2 ft=ini expandtab: