Skip to content

Commit

Permalink
Merge branch 'main' into AAP-15757
Browse files Browse the repository at this point in the history
  • Loading branch information
mkanoor authored Feb 14, 2024
2 parents 2f56329 + 1e59d1a commit b317fe6
Show file tree
Hide file tree
Showing 108 changed files with 4,228 additions and 3,365 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ dist
**/__pycache__
.git
.idea
.venv
venv
1 change: 1 addition & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:

jobs:
build-and-push-image:
if: github.repository == 'ansible/eda-server'
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
branches: [ 'main', 'devel' ]
merge_group:
branches: [ 'main' ]

Expand All @@ -28,7 +28,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.11'
cache: 'poetry'

- name: Install dependencies
Expand All @@ -52,8 +52,6 @@ jobs:
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
env:
EDA_SECRET_KEY: 'test'
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/e2e-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: e2e tests on demand

on:
workflow_dispatch:
inputs:
edaqa_ref:
description: 'ref of the eda-qa repository, default is main'
required: false
default: 'main'
pull_request_target:
types:
- labeled
- synchronize

env:
EDA_QA_PATH: "./eda-qa"
REGISTRY: quay.io
QUAY_USER: ansible+eda_gha

jobs:
api-e2e-tests:
if: >
(github.repository == 'ansible/eda-server' && github.event_name == 'workflow_dispatch') ||
(github.repository == 'ansible/eda-server' && github.event_name == 'pull_request_target' &&
contains(github.event.pull_request.labels.*.name, 'run-e2e'))
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.QUAY_USER }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Run api in background
working-directory: tools/docker
env:
DJANGO_SETTINGS_MODULE: aap_eda.settings.default
EDA_DEBUG: "false"
run: |
docker-compose -p eda -f docker-compose-dev.yaml build
docker-compose -p eda -f docker-compose-dev.yaml up -d
while ! curl -s http://localhost:8000/_healthz | grep -q "OK"; do
echo "Waiting for API to be ready..."
sleep 1
done
- name: Fetch test suite
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: ansible/eda-qa
ref: ${{ github.event.inputs.edaqa_ref }}
path: ${{ env.EDA_QA_PATH }}
token: ${{ secrets.EDA_QA_GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install dependencies
working-directory: ${{ env.EDA_QA_PATH }}
run: pip install .

- name: Run tests
working-directory: ${{ env.EDA_QA_PATH }}
env:
EDAQA_FERNET_PASSWORD: ${{ secrets.EDAQA_FERNET_PASSWORD }}
EDAQA_ENV: authenticated
run: pytest

- name: Print EDA logs
if: always()
working-directory: tools/docker
run: |
docker-compose -p eda -f docker-compose-dev.yaml logs
3 changes: 3 additions & 0 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ jobs:

- name: Run tests
working-directory: ${{ env.EDA_QA_PATH }}
env:
EDAQA_FERNET_PASSWORD: ${{ secrets.EDAQA_FERNET_PASSWORD }}
EDAQA_ENV: authenticated
run: pytest

- name: Print EDA logs
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

[![GitHub Workflow Status](https://github.com/ansible/eda-server/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/ansible/eda-server/actions/workflows/ci.yaml?query=branch%3Amain)

![Python 3.9](https://img.shields.io/badge/Python-3.9-blue)
![Python 3.10](https://img.shields.io/badge/Python-3.10-blue)
![Python 3.11](https://img.shields.io/badge/Python-3.11-blue)

# Event Driven Ansible Controller
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ If you are proposing a feature:
Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests.
2. The pull request should work for Python 3.9
2. The pull request should work for Python 3.11
3. The pull request should pass all tests, linters and CI checks. You can run
each of these locally in your [development environment](docs/development.md)

## Contact

Also you can check the [Matrix chat](https://matrix.to/#/#eda:ansible.com), or via the
[email protected] email.
<[email protected]> email.
32 changes: 18 additions & 14 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

For running services locally:

* Python >= 3.9
* Python >= 3.11

For standalone development tools written in Python, such as `pre-commit`,
we recommend using your system package manager,
Expand Down Expand Up @@ -86,7 +86,7 @@ systemctl --user enable --now podman.socket
On Linux and macOS, Poetry can be installed with the official installer:

```shell
curl -sSL https://install.python-poetry.org | python3 -
curl -sSL https://install.python-poetry.org | python3.11 -
```

Alternatively, you can install it with manually with `pip` or `pipx`:
Expand All @@ -100,7 +100,7 @@ pipx install poetry
In ArchLinux, Poetry is available in the official distribution repositories:

```shell
sudo pacman -S python-poetry
sudo pacman -S python-poetry
```

In macOS, Poetry can be installed with Homebrew:
Expand Down Expand Up @@ -157,12 +157,12 @@ git clone [email protected]:ansible/eda-server.git

### Install dependencies

**NOTE**: Since we added experimental [LDAP authentication](https://github.com/ansible/eda-server/pull/557), the following additional packages are required: `openldap-devel xmlsec1-devel libtool-ltdl-devel`.
**NOTE**: Since we added experimental [LDAP authentication](https://github.com/ansible/eda-server/pull/557), the following additional packages are required: `openldap-devel xmlsec1-devel libtool-ltdl-devel`.

Go to your project directory and install dependencies for local development:

```shell
task dev:init
task dev:init
```

Or if you want to customize installation options, you may run commands, executed by the `dev:init`
Expand All @@ -188,6 +188,7 @@ $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/aap-eda latest 28fd94c8cf89 5 hours ago 611MB
```

To override image name:(using short git hash for version here)

```shell
Expand Down Expand Up @@ -249,20 +250,21 @@ task manage -- migrate
With docker compose:

```shell
task docker:migrate
task docker:migrate
```

### Seeding the database

Locally:

```shell
task manage -- create_initial_data
```

With docker compose:

```
task docker -- run api --rm aap-eda-manage create_initial_data
```shell
task docker -- run --rm eda-api aap-eda-manage create_initial_data
```

### Create superuser
Expand All @@ -287,7 +289,7 @@ by running `task run:scheduler`
With docker compose:

```shell
task docker -- up -d api
task docker -- up -d eda-api
```

### Running tests
Expand All @@ -296,26 +298,26 @@ To run tests locally, you need to have a running instance of postgresql and redi

Run all tests:

```
```shell
task test
```

Run a single module:

```
```shell
task test -- tests/integration/api/test_activation.py
```

Run a single test:

```
```shell
task test -- tests/integration/api/test_activation.py::test_retrieve_activation
```

With docker compose:

```shell
task docker -- run api --rm python -m pytest
```shell
task docker -- run --rm eda-api python3.11 -m pytest
```

### Running linters
Expand Down Expand Up @@ -354,3 +356,5 @@ You can run individual formatting tools if needed:
task format:isort
task format:black
```

You can now access the UI at <https://localhost:8443/eda/> with default login username and password(admin/testpass).
12 changes: 9 additions & 3 deletions docs/mac_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ If you are developing on Mac with podman this document will guide you thru the s
2. Make development changes and run product using your local changes

# Pre Requisites
1. podman
2. docker-compose
1. podman: [Podman for Mac](https://podman.io/getting-started/installation#macos)
2. docker-compose: [Docker for Mac](https://www.docker.com/docker-mac)



Expand Down Expand Up @@ -44,7 +44,12 @@ podman-machine-default ssh://core@localhost:49473/run/user/501/podman/podman.soc
```
example use the uid 501 above and port 49473 from your enviornment in the next step

2. ssh -fnNT -L/tmp/podman.sock:/run/user/{uid}/podman/podman.sock -i ~/.ssh/podman-machine-default ssh://core@localhost:{port} -o StreamLocalBindUnlink=yes
2. Create a secure tunnel, and forward the local socket to the remote socket
```
ssh -fnNT -L/tmp/podman.sock:/run/user/{uid}/podman/podman.sock -i ~/.ssh/podman-machine-default ssh://core@localhost:{port} -o StreamLocalBindUnlink=yes
ps aux | grep "ssh -fnNT" |grep -v color
```
3. export DOCKER_HOST=unix:///tmp/podman.sock


Expand All @@ -63,6 +68,7 @@ You can build an image with your changes and use that image in docker-compose
2. export EDA_IMAGE=localhost/myserver:latest
3. docker-compose -f ./tools/docker/docker-compose-mac.yml up

You can now access the UI at <https://localhost:8443/eda/> with default login username and password(admin/testpass).

## Layout
![Alt_PodmanDeployment](./podman_deployment.png?raw=true)
Loading

0 comments on commit b317fe6

Please sign in to comment.