mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 06:26:00 -03:30
Consolidate image and server setup in several checks (#14477)
This commit is contained in:
28
.github/actions/awx_devel_image/action.yml
vendored
Normal file
28
.github/actions/awx_devel_image/action.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: Setup images for AWX
|
||||||
|
description: Builds new awx_devel image
|
||||||
|
inputs:
|
||||||
|
github-token:
|
||||||
|
description: GitHub Token for registry access
|
||||||
|
required: true
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Get python version from Makefile
|
||||||
|
shell: bash
|
||||||
|
run: echo py_version=`make PYTHON_VERSION` >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Log in to registry
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "${{ inputs.github-token }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||||
|
|
||||||
|
- name: Pre-pull latest devel image to warm cache
|
||||||
|
shell: bash
|
||||||
|
run: docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }}
|
||||||
|
|
||||||
|
- name: Build image for current source checkout
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} \
|
||||||
|
COMPOSE_TAG=${{ github.base_ref }} \
|
||||||
|
make docker-compose-build
|
||||||
28
.github/actions/run_awx_devel/action.yml
vendored
28
.github/actions/run_awx_devel/action.yml
vendored
@@ -1,12 +1,8 @@
|
|||||||
# This currently *always* uses the "warm build cache" image
|
name: Run AWX docker-compose
|
||||||
# We should do something to allow forcing a rebuild, probably by looking for
|
|
||||||
# some string in the commit message or something.
|
|
||||||
|
|
||||||
name: Run AWX (devel environment)
|
|
||||||
description: Runs AWX with `make docker-compose`
|
description: Runs AWX with `make docker-compose`
|
||||||
inputs:
|
inputs:
|
||||||
github-token:
|
github-token:
|
||||||
description: GitHub Token for registry access
|
description: GitHub Token to pass to awx_devel_image
|
||||||
required: true
|
required: true
|
||||||
build-ui:
|
build-ui:
|
||||||
description: Should the UI be built?
|
description: Should the UI be built?
|
||||||
@@ -23,9 +19,10 @@ outputs:
|
|||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Get python version from Makefile
|
- name: Build awx_devel image for running checks
|
||||||
shell: bash
|
uses: ./.github/actions/awx_devel_image
|
||||||
run: echo py_version=`make PYTHON_VERSION` >> $GITHUB_ENV
|
with:
|
||||||
|
github-token: ${{ inputs.github-token }}
|
||||||
|
|
||||||
- name: Upgrade ansible-core
|
- name: Upgrade ansible-core
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -35,19 +32,6 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: sudo apt-get install -y gettext
|
run: sudo apt-get install -y gettext
|
||||||
|
|
||||||
- name: Log in to registry
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "${{ inputs.github-token }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
||||||
|
|
||||||
- name: Pre-pull latest available devel image and build HEAD on top of it
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }}
|
|
||||||
DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} \
|
|
||||||
COMPOSE_TAG=${{ github.base_ref }} \
|
|
||||||
make docker-compose-build
|
|
||||||
|
|
||||||
- name: Start AWX
|
- name: Start AWX
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@@ -37,16 +37,27 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build awx_devel image for running checks
|
||||||
|
uses: ./.github/actions/awx_devel_image
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Run check ${{ matrix.tests.name }}
|
- name: Run check ${{ matrix.tests.name }}
|
||||||
run: AWX_DOCKER_CMD='${{ matrix.tests.command }}' make github_ci_runner
|
run: AWX_DOCKER_CMD='${{ matrix.tests.command }}' make docker-runner
|
||||||
|
|
||||||
dev-env:
|
dev-env:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: ./.github/actions/run_awx_devel
|
||||||
|
id: awx
|
||||||
|
with:
|
||||||
|
build-ui: false
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Run smoke test
|
- name: Run smoke test
|
||||||
run: make github_ci_setup && ansible-playbook tools/docker-compose/ansible/smoke-test.yml -v
|
run: ansible-playbook tools/docker-compose/ansible/smoke-test.yml -v
|
||||||
|
|
||||||
awx-operator:
|
awx-operator:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
1
.github/workflows/e2e_test.yml
vendored
1
.github/workflows/e2e_test.yml
vendored
@@ -26,7 +26,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
build-ui: true
|
build-ui: true
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
log-filename: e2e-${{ matrix.job }}.log
|
|
||||||
|
|
||||||
- name: Pull awx_cypress_base image
|
- name: Pull awx_cypress_base image
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
13
Makefile
13
Makefile
@@ -79,7 +79,7 @@ I18N_FLAG_FILE = .i18n_built
|
|||||||
sdist \
|
sdist \
|
||||||
ui-release ui-devel \
|
ui-release ui-devel \
|
||||||
VERSION PYTHON_VERSION docker-compose-sources \
|
VERSION PYTHON_VERSION docker-compose-sources \
|
||||||
.git/hooks/pre-commit github_ci_setup github_ci_runner
|
.git/hooks/pre-commit
|
||||||
|
|
||||||
clean-tmp:
|
clean-tmp:
|
||||||
rm -rf tmp/
|
rm -rf tmp/
|
||||||
@@ -324,21 +324,10 @@ test:
|
|||||||
cd awxkit && $(VENV_BASE)/awx/bin/tox -re py3
|
cd awxkit && $(VENV_BASE)/awx/bin/tox -re py3
|
||||||
awx-manage check_migrations --dry-run --check -n 'missing_migration_file'
|
awx-manage check_migrations --dry-run --check -n 'missing_migration_file'
|
||||||
|
|
||||||
## Login to Github container image registry, pull image, then build image.
|
|
||||||
github_ci_setup:
|
|
||||||
# GITHUB_ACTOR is automatic github actions env var
|
|
||||||
# CI_GITHUB_TOKEN is defined in .github files
|
|
||||||
echo $(CI_GITHUB_TOKEN) | docker login ghcr.io -u $(GITHUB_ACTOR) --password-stdin
|
|
||||||
docker pull $(DEVEL_IMAGE_NAME) || : # Pre-pull image to warm build cache
|
|
||||||
$(MAKE) docker-compose-build
|
|
||||||
|
|
||||||
## Runs AWX_DOCKER_CMD inside a new docker container.
|
## Runs AWX_DOCKER_CMD inside a new docker container.
|
||||||
docker-runner:
|
docker-runner:
|
||||||
docker run -u $(shell id -u) --rm -v $(shell pwd):/awx_devel/:Z --workdir=/awx_devel $(DEVEL_IMAGE_NAME) $(AWX_DOCKER_CMD)
|
docker run -u $(shell id -u) --rm -v $(shell pwd):/awx_devel/:Z --workdir=/awx_devel $(DEVEL_IMAGE_NAME) $(AWX_DOCKER_CMD)
|
||||||
|
|
||||||
## Builds image and runs AWX_DOCKER_CMD in it, mainly for .github checks.
|
|
||||||
github_ci_runner: github_ci_setup docker-runner
|
|
||||||
|
|
||||||
test_collection:
|
test_collection:
|
||||||
rm -f $(shell ls -d $(VENV_BASE)/awx/lib/python* | head -n 1)/no-global-site-packages.txt
|
rm -f $(shell ls -d $(VENV_BASE)/awx/lib/python* | head -n 1)/no-global-site-packages.txt
|
||||||
if [ "$(VENV_BASE)" ]; then \
|
if [ "$(VENV_BASE)" ]; then \
|
||||||
|
|||||||
@@ -11,23 +11,6 @@
|
|||||||
- name: Test that the development environment is able to launch a job
|
- name: Test that the development environment is able to launch a job
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
tasks:
|
tasks:
|
||||||
- name: Boot the development environment
|
|
||||||
command: |
|
|
||||||
make docker-compose
|
|
||||||
environment:
|
|
||||||
COMPOSE_UP_OPTS: -d
|
|
||||||
args:
|
|
||||||
chdir: "{{ playbook_dir }}/../../../"
|
|
||||||
|
|
||||||
# Takes a while for migrations to finish
|
|
||||||
- name: Wait for the dev environment to be ready
|
|
||||||
uri:
|
|
||||||
url: "http://localhost:8013/api/v2/ping/"
|
|
||||||
register: _result
|
|
||||||
until: _result.status == 200
|
|
||||||
retries: 120
|
|
||||||
delay: 5
|
|
||||||
|
|
||||||
- name: Reset admin password
|
- name: Reset admin password
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i tools_awx_1 bash <<EOSH
|
docker exec -i tools_awx_1 bash <<EOSH
|
||||||
|
|||||||
Reference in New Issue
Block a user