Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Use official image from ansible-dev-tools repository #35

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

ssbarnea
Copy link

@ssbarnea ssbarnea commented Oct 7, 2024

@svor svor self-requested a review October 22, 2024 09:13
@svor
Copy link
Collaborator

svor commented Oct 22, 2024

molecule commands require oc, but the image doesn't provide it:

screenshot-translate_google_com-2024_10_22-12_10_48

devfile.yaml Outdated Show resolved Hide resolved
@svor
Copy link
Collaborator

svor commented Oct 22, 2024

cc @dmytro-ndp

@ssbarnea ssbarnea marked this pull request as ready for review November 4, 2024 10:35
@ssbarnea ssbarnea changed the title Test use of new image from adt repo Use official image from ansible-dev-tools repository Nov 4, 2024
@ssbarnea
Copy link
Author

ssbarnea commented Nov 4, 2024

@svor @dmytro-ndp I think we should be fine now, we include oc and also added a test to ensure we do not accidentally remove it in the future.

@ssbarnea ssbarnea requested a review from svor November 4, 2024 10:38
Copy link
Collaborator

@svor svor left a comment

Choose a reason for hiding this comment

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

We need the image with its digest; otherwise, everything works as expected:
screenshot-devspaces_apps_sandbox-stage_gb17_p1_openshiftapps_com-2024_11_04-13_21_43

Verified on https://devspaces.apps.sandbox-stage.gb17.p1.openshiftapps.com instance

devfile.yaml Outdated Show resolved Hide resolved
devfile.yaml Outdated Show resolved Hide resolved
Copy link
Collaborator

@svor svor left a comment

Choose a reason for hiding this comment

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

LGTM

@svor
Copy link
Collaborator

svor commented Nov 4, 2024

@dmytro-ndp could you please verify if everything is working correctly on the AirGap cluster with the new image? The Dev Spaces version doesn’t matter (it can be 3.16.1 or 3.17.0)

@dmytro-ndp
Copy link

dmytro-ndp commented Nov 4, 2024

@svor : I have tested Ansible tasks in Ansible sample workspace with image ghcr.io/ansible/ansible-devspaces@sha256:a28fa23d254ff1b3ae10b95a0812132148f141bda4516661e40d0c49c4ace200 in devfile.yaml using airgap Dev Spaces 3.17.0.RC.
Screenshot from 2024-11-04 21-21-37


Command 1.Molecule: start a test pod for the automation failed:

TASK [Create molecule instance as containers] **********************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
failed: [localhost] (item={'image': 'registry.access.redhat.com/ubi8/python-39@sha256:301fec66443f80c3cc507ccaf72319052db5a1dc56deb55c8f169011d4bbaacb', 'name': 'molecule-ubi8-python-1', 'workingDir': '/tmp'}) => {"ansible_loop_var": "item", "changed": false, "item": {"image": "registry.access.redhat.com/ubi8/python-39@sha256:301fec66443f80c3cc507ccaf72319052db5a1dc56deb55c8f169011d4bbaacb", "name": "molecule-ubi8-python-1", "workingDir": "/tmp"}, "msg": "Could not find or access '/home/user/.kube/config' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

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

CRITICAL Ansible return code was 2, command was: ansible-playbook --inventory /home/user/.cache/molecule/extensions/default/inventory --skip-tags molecule-notest,notest /projects/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/create.yml

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Screenshot from 2024-11-04 21-26-31

@svor
Copy link
Collaborator

svor commented Nov 4, 2024

@dmytro-ndp thank you for the verification. For some reason kube config was not injected into the tooling-container
After restarting the workspace, the /home/user/.kube/config file was added and all commands were executed without errors:
screenshot-devspaces_apps_ds-airgap-v15_crw-qe_com-2024_11_04-22_15_59

@ssbarnea
Copy link
Author

ssbarnea commented Nov 5, 2024

Thanks! If you spot any issue with the container, feel free to raise tickets on it. Also, if you want us to add some fail-safe checks just mention them there too, we do run some pytest based testing of the container content before we publish it, so is very easy to check for presence of different tools. Anything that can cause it to fail at runtime, better to for us to add a small inexpensive test early.

@dmytro-ndp
Copy link

@svor : thank you for the heads up!
I haven't also seen errors when run devfile task 1 in a new Ansible sample workspace.
It looked like a glitch.

I tried running ansible workspace as non admin user and faced another error when executed devfile tasks 5 5.Molecule: reset the test pod back to a fresh instance and task 6: 6.Molecule: run the full molecule test:

  • task 5 output:
 *  Executing task: devfile: 5.Molecule: reset the test pod back to a fresh instance 

INFO     default scenario test matrix: dependency, cleanup, destroy
INFO     Performing prerun with role_name_check=0...
INFO     Running default > 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.
WARNING  Skipping, missing the requirements file.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Destroy molecule containers] *********************************************
changed: [localhost] => (item={'image': 'registry.access.redhat.com/ubi8/python-39@sha256:301fec66443f80c3cc507ccaf72319052db5a1dc56deb55c8f169011d4bbaacb', 'name': 'molecule-ubi8-python-1', 'workingDir': '/tmp'})

TASK [Populate instance config] ************************************************
fatal: [localhost]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}

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

CRITICAL Ansible return code was 2, command was: ansible-playbook --inventory /home/user/.cache/molecule/extensions/default/inventory --skip-tags molecule-notest,notest /projects/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/destroy.yml

  • task 6 output:
Executing task: devfile: 6.Molecule: run the full molecule test 

INFO     default scenario test matrix: dependency, syntax, create, converge, idempotence, verify
INFO     Performing prerun with role_name_check=0...
INFO     Running default > 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.
WARNING  Skipping, missing the requirements file.
INFO     Running default > syntax

playbook: /projects/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/converge.yml
INFO     Running default > create
WARNING  Skipping, instances already created.
INFO     Running default > converge

PLAY [Converge] ****************************************************************

TASK [Gathering Facts] *********************************************************
fatal: [molecule-ubi8-python-1]: UNREACHABLE! => {"changed": false, "msg": "Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo /tmp `\"&& mkdir \"` echo /tmp/ansible-tmp-1730806440.8993182-4787-30381591230054 `\" && echo ansible-tmp-1730806440.8993182-4787-30381591230054=\"` echo /tmp/ansible-tmp-1730806440.8993182-4787-30381591230054 `\" ), exited with result 1", "unreachable": true}

PLAY RECAP *********************************************************************
molecule-ubi8-python-1     : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0

CRITICAL Ansible return code was 4, command was: ansible-playbook --inventory /home/user/.cache/molecule/extensions/default/inventory --skip-tags molecule-notest,notest /projects/ansible-devspaces-demo/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/converge.yml
WARNING  An error occurred during the test sequence action: 'converge'. Cleaning up.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Destroy molecule containers] *********************************************
ok: [localhost] => (item={'image': 'registry.access.redhat.com/ubi8/python-39@sha256:301fec66443f80c3cc507ccaf72319052db5a1dc56deb55c8f169011d4bbaacb', 'name': 'molecule-ubi8-python-1', 'workingDir': '/tmp'})

TASK [Populate instance config] ************************************************
ok: [localhost]

TASK [Dump instance config] ****************************************************
skipping: [localhost]

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

INFO     Pruning extra files from scenario ephemeral directory

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 
 * ```

There were no such errors when execute the tasks as cluster admin user, or not using image from PR when run ansible sample as non admin user using old image ghcr.io/ansible/ansible-workspace-env-reference@sha256:03d7f0fe6caaae62ff2266906b63d67ebd9cf6e4a056c7c0a0c1320e6cfbebce

@svor
Copy link
Collaborator

svor commented Nov 5, 2024

@dmytro-ndp I can't reproduce the problem on the AirGap cluster. I've tried existed workspace and a new one.
I think we can merge this PR.

Copy link

@dmytro-ndp dmytro-ndp left a comment

Choose a reason for hiding this comment

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

LGTM

@svor svor self-assigned this Nov 5, 2024
@svor svor merged commit f17a50b into devspaces-samples:devspaces-3-rhel-8 Nov 5, 2024
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants