diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-02-01 10:13:03 +0100 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-02-04 08:16:13 +0000 |
commit | 007a4bdfef2e398d9141cc903927bae03ea4bc7a (patch) | |
tree | 9926a33421e1947dff68cc65696f56440bc90758 | |
parent | a646228c463cd6635dc65ddf40cb5ed53afed5e0 (diff) |
Refactor Helm role test setup
Test setup variable inclusion reworked for better sanity.
General Molecule docker image is used instead of pre-built one.
Change-Id: I013b9d7b92ded86220e6f2092ce75ee47b094d89
Issue-ID: OOM-2665
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
9 files changed, 25 insertions, 12 deletions
diff --git a/ansible/roles/helm/molecule/default/Dockerfile.j2 b/ansible/roles/helm/molecule/default/Dockerfile.j2 new file mode 100644 index 00000000..e6aa95d3 --- /dev/null +++ b/ansible/roles/helm/molecule/default/Dockerfile.j2 @@ -0,0 +1,14 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi diff --git a/ansible/roles/helm/molecule/default/group_vars/infrastructure.yml b/ansible/roles/helm/molecule/default/group_vars/infrastructure.yml deleted file mode 120000 index 3e9c2f0c..00000000 --- a/ansible/roles/helm/molecule/default/group_vars/infrastructure.yml +++ /dev/null @@ -1 +0,0 @@ -../../../../../group_vars/infrastructure.yml
\ No newline at end of file diff --git a/ansible/roles/helm/molecule/default/molecule.yml b/ansible/roles/helm/molecule/default/molecule.yml index 0d46c2d4..359d3aba 100644 --- a/ansible/roles/helm/molecule/default/molecule.yml +++ b/ansible/roles/helm/molecule/default/molecule.yml @@ -7,10 +7,7 @@ lint: name: yamllint platforms: - name: infrastructure-server - image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6} - pre_build_image: True - privileged: true - override_command: False + image: centos:7 groups: - infrastructure provisioner: @@ -25,7 +22,6 @@ provisioner: all: app_name: onap app_data_path: "/opt/{{ app_name }}" - helm_bin_dir: /usr/local/bin scenario: name: default verifier: diff --git a/ansible/roles/helm/molecule/default/playbook.yml b/ansible/roles/helm/molecule/default/playbook.yml index 2705b165..0f3fbc27 100644 --- a/ansible/roles/helm/molecule/default/playbook.yml +++ b/ansible/roles/helm/molecule/default/playbook.yml @@ -1,5 +1,10 @@ --- - name: Converge hosts: all + pre_tasks: + - name: Include infrastructure group variables + include_vars: ../../../../group_vars/infrastructure.yml + - name: Include test scenario variables + include_vars: vars.yml roles: - helm diff --git a/ansible/roles/helm/molecule/default/prepare.yml b/ansible/roles/helm/molecule/default/prepare.yml index 34c41e8e..10ccf232 100644 --- a/ansible/roles/helm/molecule/default/prepare.yml +++ b/ansible/roles/helm/molecule/default/prepare.yml @@ -4,5 +4,7 @@ pre_tasks: - name: Include infrastructure group variables include_vars: ../../../../group_vars/infrastructure.yml + - name: Include test scenario variables + include_vars: vars.yml roles: - prepare-helm diff --git a/ansible/roles/helm/molecule/default/vars.yml b/ansible/roles/helm/molecule/default/vars.yml new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/ansible/roles/helm/molecule/default/vars.yml @@ -0,0 +1 @@ +--- diff --git a/ansible/roles/helm/molecule/ubuntu/Dockerfile.j2 b/ansible/roles/helm/molecule/ubuntu/Dockerfile.j2 new file mode 120000 index 00000000..867ec5c3 --- /dev/null +++ b/ansible/roles/helm/molecule/ubuntu/Dockerfile.j2 @@ -0,0 +1 @@ +../default/Dockerfile.j2
\ No newline at end of file diff --git a/ansible/roles/helm/molecule/ubuntu/group_vars b/ansible/roles/helm/molecule/ubuntu/group_vars deleted file mode 120000 index 5ce8257f..00000000 --- a/ansible/roles/helm/molecule/ubuntu/group_vars +++ /dev/null @@ -1 +0,0 @@ -../default/group_vars/
\ No newline at end of file diff --git a/ansible/roles/helm/molecule/ubuntu/molecule.yml b/ansible/roles/helm/molecule/ubuntu/molecule.yml index a375a32d..a43ff074 100644 --- a/ansible/roles/helm/molecule/ubuntu/molecule.yml +++ b/ansible/roles/helm/molecule/ubuntu/molecule.yml @@ -7,10 +7,7 @@ lint: name: yamllint platforms: - name: infrastructure-server - image: molecule-${PREBUILD_PLATFORM_DISTRO:-ubuntu}:${PREBUILD_DISTRO_VERSION:-18.04} - pre_build_image: True - privileged: true - override_command: False + image: ubuntu:18.04 groups: - infrastructure provisioner: @@ -28,7 +25,6 @@ provisioner: all: app_name: onap app_data_path: "/opt/{{ app_name }}" - helm_bin_dir: /usr/local/bin scenario: name: ubuntu verifier: |