diff --git a/.gitignore b/.gitignore index 71dd7966fa..54c57c36fe 100644 --- a/.gitignore +++ b/.gitignore @@ -147,3 +147,5 @@ use_dev_supervisor.txt *.unison.tmp *.# /tools/docker-compose/overrides/ +/awx/ui_next/.ui-built +/Dockerfile diff --git a/Makefile b/Makefile index db938905ef..ef7fd54614 100644 --- a/Makefile +++ b/Makefile @@ -462,18 +462,21 @@ endif # UI TASKS # -------------------------------------- -awx/ui_next/node_modules: - $(NPM_BIN) --prefix awx/ui_next --loglevel warn --ignore-scripts install - clean-ui: rm -rf node_modules rm -rf awx/ui_next/node_modules rm -rf awx/ui_next/build rm -rf awx/ui_next/src/locales/_build + rm -rf awx/ui_next/.ui-built git checkout awx/ui_next/src/locales ui-release: ui-devel -ui-devel: awx/ui_next/node_modules +ui-devel: awx/ui_next/node_modules awx/ui_next/.ui-built + +awx/ui_next/node_modules: + $(NPM_BIN) --prefix awx/ui_next --loglevel warn --ignore-scripts install + +awx/ui_next/.ui-built: $(NPM_BIN) --prefix awx/ui_next --loglevel warn run extract-strings $(NPM_BIN) --prefix awx/ui_next --loglevel warn run compile-strings $(NPM_BIN) --prefix awx/ui_next --loglevel warn run build @@ -484,6 +487,7 @@ ui-devel: awx/ui_next/node_modules cp -r awx/ui_next/build/static/css/* awx/public/static/css cp -r awx/ui_next/build/static/js/* awx/public/static/js cp -r awx/ui_next/build/static/media/* awx/public/static/media + touch $@ ui-zuul-lint-and-test: $(NPM_BIN) --prefix awx/ui_next install diff --git a/installer/roles/image_build/files/Dockerfile.sdist b/installer/roles/image_build/files/Dockerfile.sdist index 2512bb0651..c4ed45477f 100644 --- a/installer/roles/image_build/files/Dockerfile.sdist +++ b/installer/roles/image_build/files/Dockerfile.sdist @@ -13,9 +13,10 @@ RUN dnf -y update && dnf -y install epel-release && \ # Use the distro provided npm to bootstrap our required version of node RUN npm install -g n && n 14.15.1 && dnf remove -y nodejs +RUN mkdir -p /.npm && chmod g+rwx /.npm + ENV PATH=/usr/local/n/versions/node/14.15.1/bin:$PATH WORKDIR "/awx" -ENTRYPOINT ["/bin/bash", "-c"] -CMD ["make sdist"] +CMD ["make", "sdist"] diff --git a/installer/roles/image_build/tasks/main.yml b/installer/roles/image_build/tasks/main.yml index d3d49ed087..46add2552c 100644 --- a/installer/roles/image_build/tasks/main.yml +++ b/installer/roles/image_build/tasks/main.yml @@ -34,7 +34,7 @@ register: sdist - name: Clean distribution - shell: make clean + command: make clean args: chdir: .. ignore_errors: true @@ -58,6 +58,10 @@ delegate_to: localhost when: use_container_for_build|default(true)|bool +- name: Get current uid + command: id -u + register: uid + - name: Build AWX distribution using container docker_container: env: @@ -67,6 +71,7 @@ image: "awx_sdist_builder:{{ awx_version }}" name: awx_sdist_builder state: started + user: "{{ uid.stdout }}" detach: false volumes: - ../:/awx:Z @@ -74,7 +79,7 @@ when: use_container_for_build|default(true)|bool - name: Build AWX distribution locally - shell: make sdist + command: make sdist args: chdir: .. delegate_to: localhost @@ -88,86 +93,15 @@ set_fact: awx_image: "{{ awx_image|default('awx') }}" -- name: Ensure directory exists - file: - path: "{{ docker_base_path }}" - state: directory - delegate_to: localhost - -- name: Stage sdist - copy: - src: "../dist/{{ awx_sdist_file }}" - dest: "{{ docker_base_path }}/{{ awx_sdist_file }}" - delegate_to: localhost - -- name: Template web Dockerfile +- name: Render Dockerfile template: src: Dockerfile.j2 - dest: "{{ docker_base_path }}/Dockerfile" - delegate_to: localhost - -- name: Stage launch_awx - copy: - src: launch_awx.sh - dest: "{{ docker_base_path }}/launch_awx.sh" - mode: '0755' - delegate_to: localhost - -- name: Stage launch_awx_task - copy: - src: launch_awx_task.sh - dest: "{{ docker_base_path }}/launch_awx_task.sh" - mode: '0755' - delegate_to: localhost - -- name: Stage rsyslog.conf - copy: - src: rsyslog.conf - dest: "{{ docker_base_path }}/rsyslog.conf" - mode: '0660' - delegate_to: localhost - -- name: Stage supervisor.conf - copy: - src: supervisor.conf - dest: "{{ docker_base_path }}/supervisor.conf" - delegate_to: localhost - -- name: Stage supervisor_task.conf - copy: - src: supervisor_task.conf - dest: "{{ docker_base_path }}/supervisor_task.conf" - delegate_to: localhost - -- name: Stage settings.py - copy: - src: settings.py - dest: "{{ docker_base_path }}/settings.py" - delegate_to: localhost - -- name: Stage requirements - copy: - src: ../requirements/ - dest: "{{ docker_base_path }}/requirements" - delegate_to: localhost - -- name: Stage config watcher - copy: - src: ../tools/scripts/config-watcher - dest: "{{ docker_base_path }}/config-watcher" - mode: 0755 - delegate_to: localhost - -- name: Stage Makefile - copy: - src: ../Makefile - dest: "{{ docker_base_path }}/Makefile" - delegate_to: localhost + dest: ../Dockerfile - name: Build base awx image docker_image: build: - path: "{{ docker_base_path }}" + path: ".." dockerfile: Dockerfile pull: false args: diff --git a/installer/roles/image_build/templates/Dockerfile.j2 b/installer/roles/image_build/templates/Dockerfile.j2 index 8cf60caefb..64417060c7 100644 --- a/installer/roles/image_build/templates/Dockerfile.j2 +++ b/installer/roles/image_build/templates/Dockerfile.j2 @@ -73,7 +73,7 @@ ADD requirements/requirements_dev.txt /tmp/requirements RUN cd /tmp && make requirements_awx_dev requirements_ansible_dev {% endif %} {% if not build_dev|bool %} -COPY {{ awx_sdist_file }} /tmp/{{ awx_sdist_file }} +COPY dist/{{ awx_sdist_file }} /tmp/{{ awx_sdist_file }} RUN mkdir -p -m 755 /var/lib/awx && \ OFFICIAL=yes /var/lib/awx/venv/awx/bin/pip install /tmp/{{ awx_sdist_file }} {% endif %} @@ -177,7 +177,7 @@ RUN ln -s /var/lib/awx/venv/awx/bin/awx-manage /usr/bin/awx-manage {% endif %} # Create default awx rsyslog config -ADD {% if build_dev|bool %}installer/roles/image_build/files/{% endif %}rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf +ADD installer/roles/image_build/files/rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf ## File mappings {% if build_dev|bool %} @@ -191,12 +191,12 @@ ADD tools/docker-compose/bootstrap_development.sh /usr/bin/bootstrap_development ADD tools/docker-compose/entrypoint.sh /entrypoint.sh ADD tools/scripts/awx-python /usr/bin/awx-python {% else %} -ADD launch_awx.sh /usr/bin/launch_awx.sh -ADD launch_awx_task.sh /usr/bin/launch_awx_task.sh -ADD settings.py /etc/tower/settings.py -ADD supervisor.conf /etc/supervisord.conf -ADD supervisor_task.conf /etc/supervisord_task.conf -ADD config-watcher /usr/bin/config-watcher +ADD installer/roles/image_build/files/launch_awx.sh /usr/bin/launch_awx.sh +ADD installer/roles/image_build/files/launch_awx_task.sh /usr/bin/launch_awx_task.sh +ADD installer/roles/image_build/files/settings.py /etc/tower/settings.py +ADD installer/roles/image_build/files/supervisor.conf /etc/supervisord.conf +ADD installer/roles/image_build/files/supervisor_task.conf /etc/supervisord_task.conf +ADD tools/scripts/config-watcher /usr/bin/config-watcher {% endif %} # Pre-create things we need to access