Skip to content

Commit

Permalink
Compatibility with ansible-builder v3 (#1503)
Browse files Browse the repository at this point in the history
* Compatibility with ansible-builder v3

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Compatibility with ansible-builder v3

* Lint fix

* Schema update to reflect minor

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
cidrblock and pre-commit-ci[bot] authored Apr 28, 2023
1 parent 3e3c419 commit 34d4638
Show file tree
Hide file tree
Showing 15 changed files with 1,214 additions and 273 deletions.
2 changes: 1 addition & 1 deletion .config/requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible-builder >=1, <2
ansible-builder >=3.0.0.rc1
ansible-runner >=2.3.1, <3
importlib-metadata; python_version < "3.10.0"
jinja2
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

# builder context dirs
context

# test output
/tests/output/

# tmux integration test logs
Expand Down
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
// Override the pyproject.toml and disable xdist to enable test debugging
"python.testing.pytestArgs": ["-n0", "--dist", "no"],
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"isort.check": true,

"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.fixAll": true
}
},
"prettier.enable": false
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile --extra=docs --extra=test --no-annotate --output-file=requirements.txt --strip-extras setup.cfg
#
ansible-builder==1.2.0
ansible-builder==3.0.0rc1
ansible-core==2.14.3
ansible-runner==2.3.2
attrs==22.2.0
Expand Down
4 changes: 2 additions & 2 deletions src/ansible_navigator/data/ansible-navigator.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@
"required": [
"ansible-navigator"
],
"title": "ansible-navigator settings v3.0",
"title": "ansible-navigator settings v3.1",
"type": "object",
"version": "3.0"
"version": "3.1"
}
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from .defaults import FIXTURES_DIR


def _valid_container_engine() -> str:
def valid_ce() -> str:
"""Return an available container engine.
:returns: The container engine or exits
Expand All @@ -52,7 +52,7 @@ def fixture_valid_container_engine() -> str:
:returns: The container engine or exits
"""
return _valid_container_engine()
return valid_ce()


def default_ee_image_name() -> str:
Expand Down Expand Up @@ -323,7 +323,7 @@ def pytest_sessionstart(session: pytest.Session):
"""
if getattr(session.config, "workerinput", None) is not None:
return
container_engine = _valid_container_engine()
container_engine = valid_ce()
pull_image(
valid_container_engine=container_engine,
image_name=default_ee_image_name(),
Expand Down
2 changes: 0 additions & 2 deletions tests/fixtures/common/builder/test_ee/context/.gitignore

This file was deleted.

21 changes: 18 additions & 3 deletions tests/fixtures/common/builder/test_ee/execution-environment.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
---
version: 1
version: 3

images:
base_image:
name: registry.fedoraproject.org/fedora:38

dependencies:
galaxy: requirements.yml
ansible_core:
package_pip: ansible-core

ansible_runner:
package_pip: ansible-runner

galaxy: |
collections:
- ansible.utils
python:
- ansible-lint
additional_build_steps:
append:
append_final:
- RUN echo "Hello from EE"
3 changes: 0 additions & 3 deletions tests/fixtures/common/builder/test_ee/requirements.yml

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion tests/integration/actions/builder/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import difflib
import os

from pathlib import Path

import pytest

from ....defaults import FIXTURES_DIR
Expand All @@ -11,7 +13,8 @@
from ..._tmux_session import TmuxSession


BUILDER_FIXTURE = os.path.join(FIXTURES_DIR, "common", "builder", "test_ee")
BUILDER_FIXTURE = Path(FIXTURES_DIR) / "common" / "builder" / "test_ee"
EE_MANIFEST = BUILDER_FIXTURE / "execution-environment.yml"


class BaseClass:
Expand Down
15 changes: 6 additions & 9 deletions tests/integration/actions/builder/test_stdout_tmux.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Tests for ``config`` from CLI, stdout."""
import pytest

from ....conftest import valid_ce as ce
from ..._interactions import Command
from ..._interactions import SearchFor
from ..._interactions import UiTestStep
from ..._interactions import add_indices
from .base import BUILDER_FIXTURE
from .base import EE_MANIFEST
from .base import BaseClass


Expand Down Expand Up @@ -62,8 +63,7 @@ class ShellCommand(UiTestStep):
ShellCommand(
comment="build execution-environment without ee",
user_input=StdoutCommand(
cmdline=f"build --tag test_ee --container-runtime \
docker -v 3 --workdir {BUILDER_FIXTURE}",
cmdline=f"build --tag test_ee --container-runtime {ce()} -v 3 -f {EE_MANIFEST}",
mode="stdout",
execution_environment=False,
).join(),
Expand All @@ -72,8 +72,7 @@ class ShellCommand(UiTestStep):
ShellCommand(
comment="build execution-environment with ee",
user_input=StdoutCommand(
cmdline=f"build --tag test_ee --container-runtime docker -v 3 \
--workdir {BUILDER_FIXTURE}",
cmdline=f"build --tag test_ee --container-runtime {ce()} -v 3 -f {EE_MANIFEST}",
mode="stdout",
execution_environment=True,
).join(),
Expand All @@ -82,8 +81,7 @@ class ShellCommand(UiTestStep):
ShellCommand(
comment="build execution-environment without ee in interactive mode",
user_input=StdoutCommand(
cmdline=f"build --tag test_ee --container-runtime docker -v 3 \
--workdir {BUILDER_FIXTURE}",
cmdline=f"build --tag test_ee --container-runtime {ce()} -v 3 -f {EE_MANIFEST}",
mode="interactive",
execution_environment=False,
).join(),
Expand All @@ -92,8 +90,7 @@ class ShellCommand(UiTestStep):
ShellCommand(
comment="build execution-environment with ee in interactive mode",
user_input=StdoutCommand(
cmdline=f"build --tag test_ee --container-runtime docker -v 3 \
--workdir {BUILDER_FIXTURE}",
cmdline=f"build --tag test_ee --container-runtime {ce()} -v 3 -f {EE_MANIFEST}",
mode="interactive",
execution_environment=True,
).join(),
Expand Down

0 comments on commit 34d4638

Please sign in to comment.