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

Revert "podman: remove ansible_async_dir setting logic (#182)" #237

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hswong3i
Copy link
Contributor

@hswong3i hswong3i commented Feb 12, 2024

After upgrade to https://github.com/ansible-community/molecule-plugins/releases/tag/v23.5.3, I found that all my GitLab CI pipiline running with podman driver not working (e.g. https://gitlab.com/alvistack/docker-ubuntu/-/jobs/6148073273)

INFO     Running ubuntu-22.04-docker > destroy
Molecule ubuntu-22.04-docker > destroy 00:03
PLAY [Destroy] *****************************************************************
TASK [Destroy molecule instance(s)] ********************************************
changed: [localhost] => (item={'image': 'alvistack/ubuntu-22.04', 'name': 'eet3ufiemeeh-1', 'pre_build_image': True, 'privileged': True})
TASK [Wait for instance(s) deletion to complete] *******************************
failed: [localhost] (item={'failed': 0, 'started': 1, 'finished': 0, 'ansible_job_id': 'j345359959033.3993', 'results_file': '/home/vagrant/.ansible_async/j345359959033.3993', 'changed': True, 'item': {'image': 'alvistack/ubuntu-22.04', 'name': 'eet3ufiemeeh-1', 'pre_build_image': True, 'privileged': True}, 'ansible_loop_var': 'item'}) => {"ansible_job_id": "j345359959033.3993", "ansible_loop_var": "item", "attempts": 1, "changed": false, "finished": 1, "item": {"ansible_job_id": "j345359959033.3993", "ansible_loop_var": "item", "changed": true, "failed": 0, "finished": 0, "item": {"image": "alvistack/ubuntu-22.04", "name": "eet3ufiemeeh-1", "pre_build_image": true, "privileged": true}, "results_file": "/home/vagrant/.ansible_async/j345359959033.3993", "started": 1}, "msg": "could not find job", "results_file": "/root/.ansible_async/j345359959033.3993", "started": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

After debug I found that if disable https://github.com/ansible-community/molecule-plugins/blob/v23.5.3/src/molecule_plugins/podman/playbooks/create.yml#L167-L168 as below, the create will working fine:

    - name: Create molecule instance(s)
      containers.podman.podman_container:
      ...
      loop_control:
        label: "{{ item.name }}"      
      # async: 7200
      # poll: 0
      ---

So this lead me to the #182, which remove the ansible_async_dir logic.

After manually revert the commit 0244719, my problem get fixed:

This reverts commit 0244719.

Copy link

Label error. Requires exactly 1 of: bug, enhancement, major, minor, patch, skip-changelog. Found:

hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Feb 12, 2024
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.5.3.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.5.3-1.spec
    cp ../python*-molecule-plugins*23.5.3*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.5.3
    rm -rf ../python*-molecule-plugins*23.5.3*.*

See ansible-community#155
See ansible-community#237

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Feb 20, 2024
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.5.3.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.5.3-1.spec
    cp ../python*-molecule-plugins*23.5.3*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.5.3
    rm -rf ../python*-molecule-plugins*23.5.3*.*

See ansible-community#155
See ansible-community#237
See ansible-community#240

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Feb 28, 2024
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.5.3.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.5.3-1.spec
    cp ../python*-molecule-plugins*23.5.3*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.5.3
    rm -rf ../python*-molecule-plugins*23.5.3*.*

See ansible-community#155
See ansible-community#237
See ansible-community#240

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Dec 20, 2024
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.6.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.6.0-1.spec
    cp ../python*-molecule-plugins*23.6.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.6.0
    rm -rf ../python*-molecule-plugins*23.6.0*.*

See ansible-community#155
See ansible-community#237

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Jan 4, 2025
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.6.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.6.0-1.spec
    cp ../python*-molecule-plugins*23.6.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.6.0
    rm -rf ../python*-molecule-plugins*23.6.0*.*

See ansible-community#155
See ansible-community#237

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Jan 22, 2025
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.6.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.6.0-1.spec
    cp ../python*-molecule-plugins*23.6.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.6.0
    rm -rf ../python*-molecule-plugins*23.6.0*.*

See ansible-community#155
See ansible-community#237
See ansible-community#294

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Jan 22, 2025
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.6.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.6.0-1.spec
    cp ../python*-molecule-plugins*23.6.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.6.0
    rm -rf ../python*-molecule-plugins*23.6.0*.*

See ansible-community#155
See ansible-community#237
See ansible-community#294

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Jan 22, 2025
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.6.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.6.0-1.spec
    cp ../python*-molecule-plugins*23.6.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.6.0
    rm -rf ../python*-molecule-plugins*23.6.0*.*

See ansible-community#155
See ansible-community#237
See ansible-community#294

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
@apatard
Copy link
Member

apatard commented Jan 22, 2025

@hswong3i I guess this problem is still valid ? Do you really have to revert the whole commit ?

@hswong3i
Copy link
Contributor Author

@hswong3i I guess this problem is still valid ? Do you really have to revert the whole commit ?

Yes, we still need to revert the whole commit.

If WITH this PR (i.e. revert the commit), running sudo -E molecule create -s ubuntu-24.04-docker for https://github.com/alvistack/docker-ubuntu/blob/master/molecule/ubuntu-24.04-docker/molecule.yml:

hswong3i@hswong3i-Inspiron-14-5420:~/Documents/alvistack/docker-ubuntu$ sudo -E molecule create -s ubuntu-24.04-docker
WARNING  Driver podman does not provide a schema.
INFO     ubuntu-24.04-docker scenario test matrix: dependency, create, prepare
INFO     Running ubuntu-24.04-docker > dependency
Starting galaxy collection install process
Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.
INFO     Dependency completed successfully.
Starting galaxy collection install process
Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.
INFO     Dependency completed successfully.
INFO     Running ubuntu-24.04-docker > create
INFO     Sanity checks: 'podman'

PLAY [Create] ******************************************************************

TASK [Get passwd entries for USER env] *****************************************
ok: [localhost]

TASK [Get shell async_dir] *****************************************************
ok: [localhost]

TASK [Set async_dir for HOME env] **********************************************
ok: [localhost]

TASK [Log into a container registry] *******************************************
skipping: [localhost] => (item="thoh9sheeche-1 registry username: None specified") 
skipping: [localhost]

TASK [Check presence of custom Dockerfiles] ************************************
ok: [localhost] => (item=Dockerfile: None specified)

TASK [Create Dockerfiles from image names] *************************************
skipping: [localhost] => (item="Dockerfile: None specified; Image: alvistack/ubuntu-24.04") 
skipping: [localhost]

TASK [Discover local Podman images] ********************************************
ok: [localhost] => (item=thoh9sheeche-1)

TASK [Build an Ansible compatible image] ***************************************
skipping: [localhost] => (item=alvistack/ubuntu-24.04) 
skipping: [localhost]

TASK [Determine the CMD directives] ********************************************
ok: [localhost] => (item="thoh9sheeche-1 command: None specified")

TASK [Discover local podman networks] ******************************************
skipping: [localhost] => (item=thoh9sheeche-1: None specified) 
skipping: [localhost]

TASK [Create podman network dedicated to this scenario] ************************
skipping: [localhost]

TASK [Create molecule instance(s)] *********************************************
ok: [localhost] => (item=thoh9sheeche-1)

TASK [Wait for instance(s) creation to complete] *******************************
FAILED - RETRYING: [localhost]: Wait for instance(s) creation to complete (300 retries left).
changed: [localhost] => (item=thoh9sheeche-1)

PLAY RECAP *********************************************************************
localhost                  : ok=8    changed=1    unreachable=0    failed=0    skipped=5    rescued=0    ignored=0

If WITHOUT this PR (i.e. keep the commit), running sudo -E molecule create -s ubuntu-24.04-docker for https://github.com/alvistack/docker-ubuntu/blob/master/molecule/ubuntu-24.04-docker/molecule.yml:

hswong3i@hswong3i-Inspiron-14-5420:~/Documents/alvistack/docker-ubuntu$ sudo -E molecule create -s ubuntu-24.04-docker
WARNING  Driver podman does not provide a schema.
INFO     ubuntu-24.04-docker scenario test matrix: dependency, create, prepare
INFO     Running ubuntu-24.04-docker > dependency
Starting galaxy collection install process
Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.
INFO     Dependency completed successfully.
Starting galaxy collection install process
Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.
INFO     Dependency completed successfully.
INFO     Running ubuntu-24.04-docker > create
INFO     Sanity checks: 'podman'

PLAY [Create] ******************************************************************

TASK [Log into a container registry] *******************************************
skipping: [localhost] => (item="thoh9sheeche-1 registry username: None specified") 
skipping: [localhost]

TASK [Check presence of custom Dockerfiles] ************************************
ok: [localhost] => (item=Dockerfile: None specified)

TASK [Create Dockerfiles from image names] *************************************
skipping: [localhost] => (item="Dockerfile: None specified; Image: alvistack/ubuntu-24.04") 
skipping: [localhost]

TASK [Discover local Podman images] ********************************************
ok: [localhost] => (item=thoh9sheeche-1)

TASK [Build an Ansible compatible image] ***************************************
skipping: [localhost] => (item=alvistack/ubuntu-24.04) 
skipping: [localhost]

TASK [Determine the CMD directives] ********************************************
ok: [localhost] => (item="thoh9sheeche-1 command: None specified")

TASK [Discover local podman networks] ******************************************
skipping: [localhost] => (item=thoh9sheeche-1: None specified) 
skipping: [localhost]

TASK [Create podman network dedicated to this scenario] ************************
skipping: [localhost]

TASK [Create molecule instance(s)] *********************************************
ok: [localhost] => (item=thoh9sheeche-1)

TASK [Wait for instance(s) creation to complete] *******************************
failed: [localhost] (item=thoh9sheeche-1) => {"ansible_job_id": "j957027554399.31978", "ansible_loop_var": "item", "attempts": 1, "changed": false, "finished": 1, "item": {"ansible_job_id": "j957027554399.31978", "ansible_loop_var": "item", "changed": false, "failed": 0, "finished": 0, "item": {"image": "alvistack/ubuntu-24.04", "name": "thoh9sheeche-1", "pre_build_image": true, "privileged": true}, "results_file": "/home/hswong3i/.ansible_async/j957027554399.31978", "started": 1}, "msg": "could not find job", "results_file": "/root/.ansible_async/j957027554399.31978", "started": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

PLAY RECAP *********************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=1    skipped=5    rescued=0    ignored=0

CRITICAL Ansible return code was 2, command was: ansible-playbook --inventory /home/hswong3i/.cache/molecule/docker-ubuntu/ubuntu-24.04-docker/inventory --skip-tags molecule-notest,notest /usr/lib/python3/dist-packages/molecule_plugins/podman/playbooks/create.yml

hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Jan 23, 2025
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.6.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.6.0-1.spec
    cp ../python*-molecule-plugins*23.6.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.6.0
    rm -rf ../python*-molecule-plugins*23.6.0*.*

See ansible-community#155
See ansible-community#237
See ansible-community#294

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
@apatard
Copy link
Member

apatard commented Jan 23, 2025

@hswong3i I guess this problem is still valid ? Do you really have to revert the whole commit ?

Yes, we still need to revert the whole commit.

hm. I'll try to find to do more time to test. The original issue with #182 (bug #181) was about using $USER which is not always set. If you revert the commit, from what I understand, the bug will be back. So, I hope it should be possible to solve your issue and the issue solve by the commit.

hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Jan 23, 2025
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.7.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.7.0-1.spec
    cp ../python*-molecule-plugins*23.7.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.7.0
    rm -rf ../python*-molecule-plugins*23.7.0*.*

See ansible-community#155
See ansible-community#237

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
hswong3i added a commit to alvistack/ansible-community-molecule-plugins that referenced this pull request Jan 23, 2025
    git clean -xdf
    tar zcvf ../python-molecule-plugins_23.7.0.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-molecule-plugins.spec ../python-molecule-plugins_23.7.0-1.spec
    cp ../python*-molecule-plugins*23.7.0*.{gz,xz,spec,dsc} /osc/home\:alvistack/ansible-community-molecule-plugins-23.7.0
    rm -rf ../python*-molecule-plugins*23.7.0*.*

See ansible-community#155
See ansible-community#237

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
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.

2 participants