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

[WIP] fix headless awx build #13745

Closed
wants to merge 1 commit into from

Conversation

TheRealHaoLiu
Copy link
Member

@TheRealHaoLiu TheRealHaoLiu commented Mar 23, 2023

SUMMARY

headless build of awx end in following error

 => ERROR [builder 12/12] RUN AWX_SETTINGS_FILE=/dev/null SKIP_SECRET_KEY_CHEC  2.1s
------
 > [builder 12/12] RUN AWX_SETTINGS_FILE=/dev/null SKIP_SECRET_KEY_CHECK=yes SKIP_PG_VERSION_CHECK=yes /var/lib/awx/venv/awx/bin/awx-manage collectstatic --noinput --clear:
#19 1.839 Traceback (most recent call last):
#19 1.839   File "/var/lib/awx/venv/awx/bin/awx-manage", line 8, in <module>
#19 1.839     sys.exit(manage())
#19 1.839   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/__init__.py", line 200, in manage
#19 1.840     execute_from_command_line(sys.argv)
#19 1.840   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
#19 1.840     utility.execute()
#19 1.840   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
#19 1.840     self.fetch_command(subcommand).run_from_argv(self.argv)
#19 1.840   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
#19 1.840     self.execute(*args, **cmd_options)
#19 1.840   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/management/base.py", line 398, in execute
#19 1.840     output = self.handle(*args, **options)
#19 1.840   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle
#19 1.841     collected = self.collect()
#19 1.841   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 105, in collect
#19 1.841     for path, storage in finder.list(self.ignore_patterns):
#19 1.841   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/contrib/staticfiles/finders.py", line 130, in list
#19 1.841     for path in utils.get_files(storage, ignore_patterns):
#19 1.841   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/contrib/staticfiles/utils.py", line 23, in get_files
#19 1.841     directories, files = storage.listdir(location)
#19 1.841   File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/files/storage.py", line 330, in listdir
#19 1.841     for entry in os.scandir(path):
#19 1.841 FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/ui/build/static'
------
executor failed running [/bin/sh -c AWX_SETTINGS_FILE=/dev/null SKIP_SECRET_KEY_CHECK=yes SKIP_PG_VERSION_CHECK=yes /var/lib/awx/venv/awx/bin/awx-manage collectstatic --noinput --clear]: exit code: 1
make: *** [awx-kube-build] Error 1
ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • Other
AWX VERSION
awx: 21.13.1.dev105+g0e6f49288a
ADDITIONAL INFORMATION

test:

make clean
HEADLESS=yes make awx-kube-build

🟢 IS able to access /api/v2/
🟡 / will show Server Error (we can improve this by placing a dummy index.htlm in the static dir but out of scope of this PR)

@TheRealHaoLiu TheRealHaoLiu changed the title fix headless awx build [WIP] fix headless awx build Mar 23, 2023
@TheRealHaoLiu TheRealHaoLiu marked this pull request as draft March 23, 2023 03:21
by adding make target that create fake static file dir so collectstatic wont fail when building in headless mode
# NOTE: The make target ui-next is imported from awx/ui_next/Makefile
HEADLESS ?= no
ifeq ($(HEADLESS), yes)
dist/$(SDIST_TAR_FILE):
dist/$(SDIST_TAR_FILE): ui-headless ui-next/headless
Copy link
Member

Choose a reason for hiding this comment

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

Should we make ui-next/headless a target of ui-headless so that if I run make ui-headless from the root folder it will hit both targets?

@shanemcd
Copy link
Member

I'd like to understand why this isn't happening in the awx-operator CI check... which builds AWX in headless mode and seems to be passing on other PRs.

@echo "=== Creating empty awx/ui/build ==="
@rm -rf awx/ui/build/static
@mkdir -p awx/ui/build/static
@touch awx/ui/build/static/HEADLESS
Copy link
Member

Choose a reason for hiding this comment

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

What is awx/ui/build/static/HEADLESS supposed to do?

Copy link
Member

@shanemcd shanemcd left a comment

Choose a reason for hiding this comment

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

Looking at this code, this command isn't supposed to get run when doing a headless build:

{% if not headless|bool %}
RUN AWX_SETTINGS_FILE=/dev/null SKIP_SECRET_KEY_CHECK=yes SKIP_PG_VERSION_CHECK=yes /var/lib/awx/venv/awx/bin/awx-manage collectstatic --noinput --clear
{% endif %}

Not sure how you got into this state, but I don't think more cruft in the Makefile is the answer here.

@TheRealHaoLiu
Copy link
Member Author

ok headless build is broken for make awx-kube-build bc it's different from what our CI does

@TheRealHaoLiu
Copy link
Member Author

fixed in #13658 bc its literally 1 line

@TheRealHaoLiu TheRealHaoLiu deleted the headless branch April 19, 2023 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants