Skip to content

Commit

Permalink
Made base image fully configurable
Browse files Browse the repository at this point in the history
Instead of allowing us to configure only the tag used by the base
test image, now we made it generic and fully overridable.

Signed-off-by: Sorin Sbarnea <[email protected]>
  • Loading branch information
ssbarnea committed Oct 20, 2019
1 parent c9fee49 commit 1fcd9a6
Show file tree
Hide file tree
Showing 22 changed files with 24 additions and 26 deletions.
6 changes: 2 additions & 4 deletions molecule/test/functional/docker/test_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,8 @@ def test_command_test_builds_local_molecule_image(
scenario_to_test, with_scenario, scenario_name, driver_name
):
try:
version = os.environ.get('TEST_CENTOS_VERSION', 7)
cmd = sh.docker.bake(
'rmi', 'molecule_local/centos:{}'.format(version), '--force'
)
image = os.environ.get('TEST_BASE_IMAGE', "pycontribs/centos:7")
cmd = sh.docker.bake('rmi', 'molecule_local/{}'.format(image), '--force')
pytest.helpers.run_command(cmd)
except sh.ErrorReturnCode:
pass
Expand Down
2 changes: 1 addition & 1 deletion molecule/test/resources/molecule_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ lint:
name: yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
lint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
docker_container:
name: delegated-instance-docker
hostname: delegated-instance-docker
image: molecule_local/centos:${TEST_CENTOS_VERSION}
image: molecule_local/${TEST_BASE_IMAGE}
recreate: false
log_driver: json-file
command: sleep infinity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
command: /sbin/init
privileged: true
provisioner:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
networks:
- name: foo
- name: bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
networks:
- name: foo
- name: bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ lint:
config-file: ../../../resources/.yamllint
platforms:
- name: instance-1
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
groups:
- foo
- bar
buildargs:
testarg: this_is_a_test
- name: instance-2
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
groups:
- foo
- baz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
groups:
- example
children:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
groups:
- example
children:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: $INSTANCE_NAME
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
command: /sbin/init
privileged: true
provisioner:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
playbooks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: ../../resources/.yamllint
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
provisioner:
name: ansible
config_options:
Expand Down
2 changes: 1 addition & 1 deletion molecule/test/unit/model/v2/test_pre_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _model_molecule_env_errors_section_data():
name: $MOLECULE_LINT_NAME
platforms:
- name: instance
image: centos:${TEST_CENTOS_VERSION}
image: ${TEST_BASE_IMAGE}
networks:
- name: foo
- name: bar
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ passenv = *
setenv =
ANSIBLE_CALLABLE_WHITELIST={env:ANSIBLE_CALLABLE_WHITELIST:timer,profile_roles}
PYTHONDONTWRITEBYTECODE=1
TEST_CENTOS_VERSION=7
TEST_BASE_IMAGE=pycontribs/centos:7
# -n auto used only on unit as is not supported by functional yet
unit: PYTEST_ADDOPTS=molecule/test/unit/ --cov={toxinidir}/molecule/ --no-cov-on-fail {env:PYTEST_ADDOPTS:-n auto}
functional: PYTEST_ADDOPTS=molecule/test/functional/ {env:PYTEST_ADDOPTS:}
Expand Down

0 comments on commit 1fcd9a6

Please sign in to comment.