ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.8k stars 3.39k forks source link

[Solved?] Docker Compose for Development fails at step make docker-compose #14424

Open jeremyatourville opened 11 months ago

jeremyatourville commented 11 months ago

Please confirm the following

Bug Summary

The build will fail for issues with ansible code

AWX version

23.0.0

Select the relevant components

Installation method

docker development environment

Modifications

yes

Ansible version

2.4.12

Operating system

Rocky 8 / RHEL 8

Web browser

No response

Steps to reproduce

dnf install epel-release -y
dnf install -y git gcc gcc-c++ ansible nodejs gettext device-mapper-persistent-data lvm2 bzip2 python3-pip -y
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce-repo
dnf install docker-ce-<version>
systemctl start docker && systemctl enable docker
usermod -aG docker $USER
newgrp docker
pip3 install docker-compose
alternatives --set python /usr/bin/python3
git clone https://github.com/ansible/awx.git

genrate encryption key

openssl rand -base64 30

copy this key to clipboard

cd awx/tools/docker-compose
nano inventory

paste in key from clipboard for secret_key

now start the build process

make docker-compose-build

build will complete and you can see the image is available

docker images

now try to finish the build and you will get the error

make docker-compose

Expected results

build should complete without errors

Actual results



ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.
  found unknown escape character

The error appears to be in '/opt/awx/tools/docker-compose/ansible/roles/sources/tasks/main.yml': line 51, column 46, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      error_code: "{{ item | basename() | regex_replace('custom_(\\d+).html', '\\1') }}"
      web_path: "{{ item | regex_replace('^.*\/static', '/static') }}"
                                             ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"
make:
*** [Makefile:518: docker-compose-sources] Error 4

### Additional information

issue was fixed by modifying
[awx](https://github.com/ansible/awx/tree/devel)/[tools](https://github.com/ansible/awx/tree/devel/tools)/[docker-compose](https://github.com/ansible/awx/tree/devel/tools/docker-compose)/[ansible](https://github.com/ansible/awx/tree/devel/tools/docker-compose/ansible)/[roles](https://github.com/ansible/awx/tree/devel/tools/docker-compose/ansible/roles)/[sources](https://github.com/ansible/awx/tree/devel/tools/docker-compose/ansible/roles/sources)/[tasks](https://github.com/ansible/awx/tree/devel/tools/docker-compose/ansible/roles/sources/tasks)

/main.yml line 51

from
`web_path: "{{ item | regex_replace('^.*\/static', '/static') }}"`

to
`web_path: "{{ item | regex_replace('^.*\''/static', '/static') }}"`
jeremyatourville commented 11 months ago

Another person commented the fix was: web_path: "{{ item | regex_replace('^.*\\/static', '/static') }}"

Is there a BEST fix or are both solutions valid?

1 web_path: "{{ item | regex_replace('^.*\''/static', '/static') }}"

OR

2 web_path: "{{ item | regex_replace('^.*\\/static', '/static') }}"

thedoubl3j commented 11 months ago

@jeremyatourville just to confirm, the ansible-core version that is running the docker-compose command is 2.4.12?

jeremyatourville commented 11 months ago

@thedoubl3j 2.14.2

[root@docker awx]# ansible --version
ansible [core 2.14.2]
fosterseth commented 10 months ago

@jeremyatourville is this still an issue for you?

jeremyatourville commented 10 months ago

Yes and No. Yes, there is an issue if you use the code straight from the repo.

No, if you "fix" the code that is posted. I was able to work around the issue by fixing the YAML. However, I did ask a question and haven't seen any response- Is there a BEST solution or are both solutions valid?

From: Seth Foster @.> Sent: Wednesday, October 4, 2023 1:00 PM To: ansible/awx @.> Cc: Tourville, Jeremy A CTR USARMY DEVCOM AVMC (USA) @.>; Mention @.> Subject: [Non-DoD Source] Re: [ansible/awx] [Solved?] Docker Compose for Development fails at step make docker-compose (Issue #14424)

@jeremyatourvillehttps://usg01.safelinks.protection.office365.us/?url=https%3A%2F%2Fgithub.com%2Fjeremyatourville&data=05%7C01%7Cjeremy.a.tourville.ctr%40army.mil%7C8e7c4e6f83fe4cbb392008dbc503ce13%7Cfae6d70f954b481192b60530d6f84c43%7C0%7C0%7C638320392374044555%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=h4%2BbWiLhJb1d9dL1iL8lz%2FsPxGNtkQ5i3zbq6Yxuwoc%3D&reserved=0 is this still an issue for you?

- Reply to this email directly, view it on GitHubhttps://usg01.safelinks.protection.office365.us/?url=https%3A%2F%2Fgithub.com%2Fansible%2Fawx%2Fissues%2F14424%23issuecomment-1747387206&data=05%7C01%7Cjeremy.a.tourville.ctr%40army.mil%7C8e7c4e6f83fe4cbb392008dbc503ce13%7Cfae6d70f954b481192b60530d6f84c43%7C0%7C0%7C638320392374044555%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Hm%2BpsQ%2FLeiulqgGVo%2Fy5sVu1fgmZS1NFVoFTdGXUtdg%3D&reserved=0, or unsubscribehttps://usg01.safelinks.protection.office365.us/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA7XVTMO6JWY7VZU4A36UVWLX5WP2RAVCNFSM6AAAAAA4PHIODGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGM4DOMRQGY&data=05%7C01%7Cjeremy.a.tourville.ctr%40army.mil%7C8e7c4e6f83fe4cbb392008dbc503ce13%7Cfae6d70f954b481192b60530d6f84c43%7C0%7C0%7C638320392374044555%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=z6XRAUDEI%2FSu2tD6MUHK7T6Kvnolq1OoPRCofNGgtYM%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.**@.>>