Skip to content
Snippets Groups Projects
Commit 9006639a authored by nimrod's avatar nimrod
Browse files

- Added Tox env to import role to Ansible Galaxy.

- Updated Jenkinsfile to use Tox.
parent 0dacdea4
No related branches found
No related tags found
No related merge requests found
/*
Jenkins pipeline for testing an Ansible role.
Required software on the agent:
- Python 2.7.
- Tox.
- Vagrant.
- Virtualbox.
*/
pipeline { pipeline {
agent any agent any
environment {
VBOX_HWVIRTEX = off
}
stages { stages {
stage('install') { stage('install') {
steps { steps {
sh 'git submodule update --init' sh 'git submodule update --init --recursive'
sh 'virtualenv example'
sh '. example/bin/activate && pip install -r tests/requirements.txt'
sh '. example/bin/activate && ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles'
sh '. example/bin/activate && molecule dependency'
} }
} }
stage('test') { stage('test') {
steps { steps {
sh '. example/bin/activate && pre-commit run --all-files' parallel (
// sh '. example/bin/activate && molecule test --platform all' 'pre-commit': {
sh 'tox -e pre-commit'
}
'molecule': {
sh 'tox'
}
)
} }
} }
} }
post { post {
success { success {
sh '. example/bin/activate && ansible-galaxy import -v' sh 'tox -e import'
} }
} }
} }
...@@ -24,3 +24,8 @@ commands = ...@@ -24,3 +24,8 @@ commands =
sh -c "ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles" sh -c "ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles"
molecule dependency molecule dependency
pre-commit run --all-files pre-commit run --all-files
[testenv:import]
envdir = {toxinidir}/.tox/molecule
deps = -rtests/requirements.txt
commands = ansible-galaxy import -v
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment