Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: AnsibleVarsParser #287

Merged
merged 14 commits into from
Jan 20, 2023
Merged

Conversation

quietjoy
Copy link
Contributor

Closes #110

This is a work in progress PR to attempt to allow ansible_bender variables to be specified across group and host var files.

@quietjoy quietjoy marked this pull request as draft January 16, 2023 20:58
Copy link
Collaborator

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, this looks solid! thank you for the detailed test cases

ansible_bender/core.py Show resolved Hide resolved
@quietjoy quietjoy changed the title WIP: AnsibleVarsParser Feat: AnsibleVarsParser Jan 18, 2023
@quietjoy quietjoy marked this pull request as ready for review January 18, 2023 17:16
@quietjoy
Copy link
Contributor Author

quietjoy commented Jan 18, 2023

Hi @TomasTomecek - any idea what the problem with CI is?

Tests are passing for me with the command: WITH_TESTS=yes vagrant up --provision

I can look into it later if you don't have enough time. I need some time to get more familar with packit.

I will also add some additional documentation for the new variables as well. Documentation added in 1ba394b

@TomasTomecek
Copy link
Collaborator

/usr/bin/python3: No module named pip

in the flood of tracebacks and errors of the build logs: let me fix that

@quietjoy quietjoy changed the title Feat: AnsibleVarsParser WIP: AnsibleVarsParser Jan 19, 2023
@TomasTomecek
Copy link
Collaborator

please rebase :)

@quietjoy quietjoy changed the title WIP: AnsibleVarsParser Feat: AnsibleVarsParser Jan 19, 2023
@TomasTomecek
Copy link
Collaborator

I can see one test failure:

=================================== FAILURES ===================================
___________________ test_can_specify_playbook_and_inventory ____________________

    def test_can_specify_playbook_and_inventory():
        playbook_path = "tests/data/projects/playbook_and_inventory/playbook.yml"
        inventory_path = "tests/data/projects/playbook_and_inventory/hosts.ini"
        vars_parser = AnsibleVarsParser(playbook_path, inventory_path)
    
        build, metadata = vars_parser.get_build_and_metadata()
    
        assert build.base_image == "docker.io/python:3-alpine"
        assert build.target_image == "a-very-nice-image"
>       assert len(build.build_volumes) == 1
E       assert 0 == 1
E        +  where 0 = len([])
E        +    where [] = <ansible_bender.conf.Build object at 0x7fb95804d110>.build_volumes

build      = <ansible_bender.conf.Build object at 0x7fb95804d110>
inventory_path = 'tests/data/projects/playbook_and_inventory/hosts.ini'
metadata   = <ansible_bender.conf.ImageMetadata object at 0x7fb9579cf050>
playbook_path = 'tests/data/projects/playbook_and_inventory/playbook.yml'
vars_parser = <ansible_bender.core.AnsibleVarsParser object at 0x7fb95729fa50>

tests/integration/test_core.py:29: AssertionError

is this related to your change?

@quietjoy
Copy link
Contributor Author

I can see one test failure:
is this related to your change?

@TomasTomecek - it is. I will look into it

@quietjoy
Copy link
Contributor Author

quietjoy commented Jan 19, 2023

Hmm...latest test failure is for FAILED tests/functional/test_buildah.py::test_two_runs. I have not seen this failure before. Will need some time to dig in

ERROR  Error: crun: executable file `true` not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
Error: crun: executable file `true` not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
There was an error during execution: Command '['podman', 'run', '--rm', 'quay.io/biocontainers/python:3', 'true']' returned non-zero exit status 127.

@TomasTomecek
Copy link
Collaborator

looks like a bug in podman to me:

$ podman run quay.io/biocontainers/python:3 ls -lha /bin/true
lrwxrwxrwx    1 root     root           7 May 23  2014 /bin/true -> busybox

true is available as /bin/true

also tests pass on all the stable fedora versions; I'm in favour of merging :)

btw I will be away on a vacation for one week, once I'm back I'd finally love to do a new release with this change to get feedback from the community

@quietjoy
Copy link
Contributor Author

@TomasTomecek - I am unable to replicate on my machine with WITH_TESTS=yes vagrant up --provision. I'm in favor of merging if you are.

After this merges, I am planning on putting together a small demo project that demonstrates how to use some of these new features.

Looking forward to the next release!

@TomasTomecek
Copy link
Collaborator

oki, let's merge, happy weekend!

@TomasTomecek TomasTomecek merged commit 68df071 into ansible-community:master Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find ansible_bender in group_vars
2 participants