Skip to content

Commit

Permalink
Introduce experimental builds on bleeding edge distributions.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdebock committed Aug 23, 2018
1 parent 99431d7 commit 60c2e2b
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ env:
- version=">=2.4,<2.5" distro="debian-stable"
- version=">=2.5,<2.6" distro="debian-stable"
- version=">=2.6,<2.7" distro="debian-stable"
- version=">=2.4,<2.5" distro="debian-unstable"
- version=">=2.5,<2.6" distro="debian-unstable"
- version=">=2.6,<2.7" distro="debian-unstable"
- version=">=2.4,<2.5" distro="fedora-latest"
- version=">=2.5,<2.6" distro="fedora-latest"
- version=">=2.6,<2.7" distro="fedora-latest"
Expand All @@ -43,12 +46,24 @@ env:
- version=">=2.4,<2.5" distro="ubuntu-latest"
- version=">=2.5,<2.6" distro="ubuntu-latest"
- version=">=2.6,<2.7" distro="ubuntu-latest"
- version=">=2.4,<2.5" distro="ubuntu-devel"
- version=">=2.5,<2.6" distro="ubuntu-devel"
- version=">=2.6,<2.7" distro="ubuntu-devel"

matrix:
allow_failures:
- env: version=">=2.4,<2.5" distro="alpine-edge"
- env: version=">=2.5,<2.6" distro="alpine-edge"
- env: version=">=2.6,<2.7" distro="alpine-edge"
- env: version=">=2.4,<2.5" distro="debian-unstable"
- env: version=">=2.5,<2.6" distro="debian-unstable"
- env: version=">=2.6,<2.7" distro="debian-unstable"
- env: version=">=2.4,<2.5" distro="fedora-rawhide"
- env: version=">=2.5,<2.6" distro="fedora-rawhide"
- env: version=">=2.6,<2.7" distro="fedora-rawhide"
- env: version=">=2.4,<2.5" distro="ubuntu-devel"
- env: version=">=2.5,<2.6" distro="ubuntu-devel"
- env: version=">=2.6,<2.7" distro="ubuntu-devel"

cache:
- pip
Expand Down
3 changes: 3 additions & 0 deletions molecule/debian-unstable/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Molecule managed

FROM {{ item.image }}
22 changes: 22 additions & 0 deletions molecule/debian-unstable/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
platforms:
- name: tomcat-debian-unstable
image: debian:unstable
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: debian-unstable
verifier:
name: goss
lint:
name: yamllint
10 changes: 10 additions & 0 deletions molecule/debian-unstable/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Converge
hosts: all
become: true
gather_facts: false

roles:
- role: robertdebock.bootstrap
- role: robertdebock.java
- role: ansible-role-tomcat
7 changes: 7 additions & 0 deletions molecule/debian-unstable/tests/test_default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Molecule managed
---
file:
/usr/bin/python:
exists: true
owner: root
group: root
53 changes: 53 additions & 0 deletions molecule/debian-unstable/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
# This is an example playbook to execute goss tests.
# Tests need distributed to the appropriate ansible host/groups
# prior to execution by `goss validate`.

- name: Verify
hosts: all
become: true
vars:
goss_version: v0.3.2
goss_arch: amd64
goss_dst: /usr/local/bin/goss
goss_sha256sum: 2f6727375db2ea0f81bee36e2c5be78ab5ab8d5981f632f761b25e4003e190ec
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
goss_test_directory: /tmp
goss_format: documentation
tasks:
- name: Download and install Goss
get_url:
url: "{{ goss_url }}"
dest: "{{ goss_dst }}"
sha256sum: "{{ goss_sha256sum }}"
mode: 0755
register: download_goss
until: download_goss is succeeded
retries: 3

- name: Copy Goss tests to remote
copy:
src: "{{ item }}"
dest: "{{ goss_test_directory }}/{{ item | basename }}"
with_fileglob:
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml"

- name: Register test files
shell: "ls {{ goss_test_directory }}/test_*.yml"
register: test_files

- name: Execute Goss tests
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
register: test_results
with_items: "{{ test_files.stdout_lines }}"

- name: Display details about the Goss results
debug:
msg: "{{ item.stdout_lines }}"
with_items: "{{ test_results.results }}"

- name: Fail when tests fail
fail:
msg: "Goss failed to validate"
when: item.rc != 0
with_items: "{{ test_results.results }}"
3 changes: 3 additions & 0 deletions molecule/ubuntu-devel/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Molecule managed

FROM {{ item.image }}
22 changes: 22 additions & 0 deletions molecule/ubuntu-devel/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
driver:
name: docker
lint:
name: yamllint
platforms:
- name: tomcat-ubuntu-devel
image: ubuntu:devel
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: ubuntu-devel
verifier:
name: goss
lint:
name: yamllint
10 changes: 10 additions & 0 deletions molecule/ubuntu-devel/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Converge
hosts: all
become: true
gather_facts: false

roles:
- role: robertdebock.bootstrap
- role: robertdebock.java
- role: ansible-role-tomcat
7 changes: 7 additions & 0 deletions molecule/ubuntu-devel/tests/test_default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Molecule managed
---
file:
/usr/bin/python:
exists: true
owner: root
group: root
53 changes: 53 additions & 0 deletions molecule/ubuntu-devel/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
# This is an example playbook to execute goss tests.
# Tests need distributed to the appropriate ansible host/groups
# prior to execution by `goss validate`.

- name: Verify
hosts: all
become: true
vars:
goss_version: v0.3.2
goss_arch: amd64
goss_dst: /usr/local/bin/goss
goss_sha256sum: 2f6727375db2ea0f81bee36e2c5be78ab5ab8d5981f632f761b25e4003e190ec
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
goss_test_directory: /tmp
goss_format: documentation
tasks:
- name: Download and install Goss
get_url:
url: "{{ goss_url }}"
dest: "{{ goss_dst }}"
sha256sum: "{{ goss_sha256sum }}"
mode: 0755
register: download_goss
until: download_goss is succeeded
retries: 3

- name: Copy Goss tests to remote
copy:
src: "{{ item }}"
dest: "{{ goss_test_directory }}/{{ item | basename }}"
with_fileglob:
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml"

- name: Register test files
shell: "ls {{ goss_test_directory }}/test_*.yml"
register: test_files

- name: Execute Goss tests
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
register: test_results
with_items: "{{ test_files.stdout_lines }}"

- name: Display details about the Goss results
debug:
msg: "{{ item.stdout_lines }}"
with_items: "{{ test_results.results }}"

- name: Fail when tests fail
fail:
msg: "Goss failed to validate"
when: item.rc != 0
with_items: "{{ test_results.results }}"

0 comments on commit 60c2e2b

Please sign in to comment.