Skip to content

Commit 64cd2f4

Browse files
authored
Merge branch 'chaoss:main' into d0-contributor-metric
2 parents 1152b99 + bb8b08c commit 64cd2f4

File tree

85 files changed

+777
-859
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+777
-859
lines changed

.github/workflows/build_docker.yml

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
5353
5454
test-e2e:
55-
name: End-to-end test
55+
name: End-to-end test (Docker)
5656
runs-on: ubuntu-latest
5757
steps:
5858
- name: Checkout repository
@@ -168,6 +168,121 @@ jobs:
168168
# We use tail so that we can see the name of each file as it's printed
169169
run: "docker run -t --rm -v augur_logs:/logs bash -c 'find /logs -type f | xargs tail -n +0'"
170170

171+
test-e2e-podman:
172+
name: End-to-end test (Podman)
173+
runs-on: ubuntu-latest
174+
steps:
175+
- name: Remove unnecessary files from the base image
176+
run: |
177+
sudo rm -rf /usr/share/dotnet
178+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
179+
180+
- name: Start Podman socket
181+
run: systemctl --user start podman.socket
182+
183+
- name: Checkout repository
184+
uses: actions/checkout@v4
185+
186+
- name: Build database container
187+
uses: redhat-actions/buildah-build@v2
188+
with:
189+
context: .
190+
containerfiles: |
191+
./docker/database/Dockerfile
192+
platforms: linux/amd64
193+
tags: ghcr.io/${{ github.repository_owner }}/augur_database:test
194+
layers: true
195+
196+
- name: Build keyman container
197+
uses: redhat-actions/buildah-build@v2
198+
with:
199+
context: .
200+
containerfiles: |
201+
./docker/keyman/Dockerfile
202+
platforms: linux/amd64
203+
tags: ghcr.io/${{ github.repository_owner }}/augur_keyman:test
204+
layers: true
205+
206+
- name: Build rabbitmq container
207+
uses: redhat-actions/buildah-build@v2
208+
with:
209+
context: .
210+
containerfiles: |
211+
./docker/rabbitmq/Dockerfile
212+
platforms: linux/amd64
213+
tags: ghcr.io/${{ github.repository_owner }}/augur_rabbitmq:test
214+
layers: true
215+
216+
- name: Build backend container
217+
uses: redhat-actions/buildah-build@v2
218+
with:
219+
context: .
220+
containerfiles: |
221+
./docker/backend/Dockerfile
222+
platforms: linux/amd64
223+
tags: ghcr.io/${{ github.repository_owner }}/augur_backend:test
224+
layers: true
225+
226+
- name: Prepare compose file
227+
run: |
228+
yq eval -i '.services.augur.image = "ghcr.io/${{ github.repository_owner }}/augur_backend:test"' docker-compose.yml
229+
yq eval -i '.services.augur.pull_policy = "never"' docker-compose.yml
230+
yq eval -i '.services.augur.restart = "no"' docker-compose.yml
231+
232+
yq eval -i '.services.augur-db.image = "ghcr.io/${{ github.repository_owner }}/augur_database:test"' docker-compose.yml
233+
yq eval -i '.services.augur-db.pull_policy = "never"' docker-compose.yml
234+
yq eval -i '.services.augur-db.restart = "no"' docker-compose.yml
235+
236+
yq eval -i '.services.augur-keyman.image = "ghcr.io/${{ github.repository_owner }}/augur_keyman:test"' docker-compose.yml
237+
yq eval -i '.services.augur-keyman.pull_policy = "never"' docker-compose.yml
238+
yq eval -i '.services.augur-keyman.restart = "no"' docker-compose.yml
239+
240+
yq eval -i '.services.rabbitmq.image = "ghcr.io/${{ github.repository_owner }}/augur_rabbitmq:test"' docker-compose.yml
241+
yq eval -i '.services.rabbitmq.pull_policy = "never"' docker-compose.yml
242+
yq eval -i '.services.rabbitmq.restart = "no"' docker-compose.yml
243+
244+
- name: Setup Podman Compose
245+
uses: webgtx/setup-podman-compose@v1
246+
247+
- name: Set up list of log lines to match
248+
run: |
249+
cat <<EOF > /tmp/regex_matches.txt
250+
Gunicorn webserver started
251+
Starting core worker processes
252+
Starting secondary worker processes
253+
Starting facade worker processes
254+
Retrieved \\d+ github api keys for use
255+
Fetching new repos \\(complete\\)
256+
Inserting \\d+ contributors
257+
Inserting \\d+ issues
258+
Inserting prs of length: \\d+
259+
Querying committers count
260+
Done generating scc data for repo
261+
Sending due task
262+
EOF
263+
264+
- name: Start services & wait for output
265+
# This starts the system and sends the output to "await_all.py" which
266+
# scans for the regex matches from above. Once all matches are seen at
267+
# least once, the `compose down` will run to shut down the system. If
268+
# this all doesn't happen before the timeout, the job will fail.
269+
run: |
270+
podman compose -f docker-compose.yml up --no-build 2>&1 \
271+
| (./scripts/ci/await_all.py /tmp/regex_matches.txt \
272+
&& docker compose -f docker-compose.yml down)
273+
timeout-minutes: 3
274+
env:
275+
AUGUR_GITHUB_API_KEY: ${{ secrets.GITHUB_TOKEN }}
276+
AUGUR_GITHUB_USERNAME: ${{ github.repository_owner }}
277+
AUGUR_GITLAB_API_KEY: dummy
278+
AUGUR_GITLAB_USERNAME: dummy
279+
280+
- name: Dump logs
281+
# Always run this step to get logs, even if the previous step fails
282+
if: always()
283+
# We use tail so that we can see the name of each file as it's printed
284+
run: "podman run -t --rm -v augur_logs:/logs bash -c 'find /logs -type f | xargs tail -n +0'"
285+
171286

172287

173288
push-image:

.github/workflows/checks.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
branches: [main, release]
55

66
jobs:
7+
check-docs:
8+
name: runner / check docs
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v6
14+
- name: Ensure docs build cleanly
15+
# Setting `O` to pass extra options to the sphinx-build command.
16+
run: O="-a -E -n -W --keep-going" make docs
17+
718
run-pylint:
819
name: runner / pylint
920
permissions: write-all

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ git push origin master
9090
## Community Resources
9191

9292
### Augur
93-
- [Stable documentation (`main` branch)](https://oss-augur.readthedocs.io/en/main/)
94-
- [Nightly/developer build documentation (`dev` branch)](https://oss-augur.readthedocs.io/en/dev/) (warning: this is should be considered an unstable branch and should not be used for production)
93+
- [Stable documentation (`release` branch)](https://oss-augur.readthedocs.io/en/release/)
94+
- [Nightly/developer build documentation (`main` branch)](https://oss-augur.readthedocs.io/en/main/) (warning: this is should be considered an unstable branch and should not be used for production)
9595
- [Live Augur demo](https://ai.chaoss.io)
9696

9797
### CHAOSS

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ The primary way of looking at Augur data is through [8Knot](https://github.com/o
66
[![first-timers-only](https://img.shields.io/badge/first--timers--only-friendly-blue.svg?style=flat-square)](https://www.firsttimersonly.com/)
77
We follow the [First Timers Only](https://www.firsttimersonly.com/) philosophy of tagging issues for first timers only, and walking one newcomer through the resolution process weekly. You can find these issues tagged with [first timers only](https://github.com/chaoss/augur/labels/first-timers-only) on our issues list.
88

9-
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) [![Build Docker images](https://github.com/chaoss/augur/actions/workflows/build_docker.yml/badge.svg)](https://github.com/chaoss/augur/actions/workflows/build_docker.yml) [![Hits-of-Code](https://hitsofcode.com/github/chaoss/augur?branch=main)](https://hitsofcode.com/github/chaoss/augur/view?branch=main) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2788/badge)](https://bestpractices.coreinfrastructure.org/projects/2788)
9+
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) [![Build Docker images](https://github.com/chaoss/augur/actions/workflows/build_docker.yml/badge.svg)](https://github.com/chaoss/augur/actions/workflows/build_docker.yml) [![Hits-of-Code](https://hitsofcode.com/github/chaoss/augur?branch=release)](https://hitsofcode.com/github/chaoss/augur/view?branch=release) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2788/badge)](https://bestpractices.coreinfrastructure.org/projects/2788)
1010

1111
## NEW RELEASE ALERT!
1212
**If you want to jump right in, the updated docker, docker-compose and bare metal installation instructions are available [here](docs/new-install.md)**.
1313

14-
Augur is now releasing a dramatically improved new version to the ```main``` branch. It is also available [here](https://github.com/chaoss/augur/releases/tag/v0.89.3).
14+
Augur is now releasing a dramatically improved new version. It is also available [here](https://github.com/chaoss/augur/releases/tag/v0.89.3).
1515

1616

17-
- The `main` branch is a stable version of our new architecture, which features:
17+
- The `release` branch is a stable version of our new architecture, which features:
1818
- Dramatic improvement in the speed of large scale data collection (100,000+ repos). All data is obtained for 100k+ repos within 2 weeks.
1919
- A new job management architecture that uses Celery and Redis to manage queues, and enables users to run a Flower job monitoring dashboard.
2020
- Materialized views to increase the snappiness of API’s and Frontends on large scale data.

augur/api/gunicorn_conf.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# from augur import ROOT_AUGUR_DIRECTORY
22
import multiprocessing
33
import logging
4+
import os
45
from pathlib import Path
56
from glob import glob
67

@@ -19,7 +20,22 @@
1920
workers = multiprocessing.cpu_count() * 2 + 1
2021
umask = 0o007
2122
reload = True
22-
reload_extra_files = glob(str(Path.cwd() / '**/*.j2'), recursive=True)
23+
24+
is_dev = os.getenv("AUGUR_DEV", 'False').lower() in ('true', '1', 't', 'y', 'yes')
25+
26+
if is_dev:
27+
28+
augur_templates_dir = Path.cwd() / "augur/templates"
29+
30+
if not augur_templates_dir.is_dir():
31+
logger.critical("Could not locate templates in Gunicorn startup")
32+
exit(-1)
33+
34+
reload_extra_files = glob(str(augur_templates_dir.resolve() / '**/*.j2'), recursive=True)
35+
36+
# Don't want to leave extraneous variables in config scope
37+
del augur_templates_dir
38+
del is_dev
2339

2440
# set the log location for gunicorn
2541
logs_directory = get_value('Logging', 'logs_directory')

augur/api/routes/user.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
from augur.api.util import ssl_required
1717

1818
from augur.application.db.models import User, UserSessionToken, RefreshToken
19-
from augur.tasks.init.redis_connection import redis_connection as redis
19+
from augur.tasks.init.redis_connection import get_redis_connection
20+
2021
from ..server import app
2122

2223
logger = logging.getLogger(__name__)
@@ -64,6 +65,8 @@ def user_authorize():
6465
code = secrets.token_hex()
6566
username = current_user.login_name
6667

68+
redis = get_redis_connection()
69+
6770
redis.set(code, username, ex=300)
6871

6972
return jsonify({"status": "Validated", "code": code})
@@ -81,6 +84,8 @@ def generate_session(application):
8184

8285
if "code" not in grant_type:
8386
return jsonify({"status": "Invalid grant type"})
87+
88+
redis = get_redis_connection()
8489

8590
username = redis.get(code)
8691
redis.delete(code)

augur/application/cli/_cli_util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
import signal
66
from urllib.parse import urlparse
77

8-
from augur.tasks.init.redis_connection import redis_connection
8+
from augur.tasks.init.redis_connection import get_redis_connection
99

1010
def clear_redis_caches(logger):
1111
"""Clears the redis databases that celery and redis use."""
1212

1313
logger.info("Flushing all redis databases this instance was using")
1414
celery_purge_command = "celery -A augur.tasks.init.celery_app.celery_app purge -f"
1515
subprocess.call(celery_purge_command.split(" "))
16+
17+
18+
redis_connection = get_redis_connection()
1619
redis_connection.flushdb()
1720

1821

augur/application/cli/backend.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from augur.tasks.github.util.github_api_key_handler import GithubApiKeyHandler
2323
from augur.tasks.gitlab.gitlab_api_key_handler import GitlabApiKeyHandler
2424
from augur.tasks.data_analysis.contributor_breadth_worker.contributor_breadth_worker import contributor_breadth_model
25-
from augur.tasks.init.redis_connection import redis_connection
25+
from augur.tasks.init.redis_connection import get_redis_connection
2626
from augur.application.db.models import UserRepo
2727
from augur.application.db.session import DatabaseSession
2828
from augur.application.logs import AugurLogger
@@ -32,7 +32,9 @@
3232

3333
from keyman.KeyClient import KeyClient, KeyPublisher
3434

35-
logger = AugurLogger("augur", reset_logfiles=True).get_logger()
35+
reset_logs = os.getenv("AUGUR_RESET_LOGS", 'True').lower() in ('true', '1', 't', 'y', 'yes')
36+
37+
logger = AugurLogger("augur", reset_logfiles=reset_logs).get_logger()
3638

3739

3840
@click.group('server', short_help='Commands for controlling the backend API server & data collection workers')
@@ -363,6 +365,8 @@ def clear_redis_caches():
363365
logger.info("Flushing all redis databases this instance was using")
364366
celery_purge_command = "celery -A augur.tasks.init.celery_app.celery_app purge -f"
365367
subprocess.call(celery_purge_command.split(" "))
368+
369+
redis_connection = get_redis_connection()
366370
redis_connection.flushdb()
367371

368372
def clear_all_message_queues(connection_string):

augur/application/cli/cache.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55
import click
66

7-
from augur.tasks.init.redis_connection import redis_connection as redis_conn
7+
from augur.tasks.init.redis_connection import get_redis_connection
88
from augur.application.logs import AugurLogger
99
from augur.application.cli import test_connection, test_db_connection
1010

@@ -30,6 +30,7 @@ def clear_all():
3030

3131
if user_input in ("y", "Y", "Yes", "yes"):
3232
logger.info("Clearing call redis databases")
33+
redis_conn = get_redis_connection()
3334
redis_conn.flushall()
3435
return
3536

@@ -46,4 +47,6 @@ def clear():
4647
"""Clears the redis cache specified in the config"""
4748

4849
print("Clearing redis cache that is specified in the config")
50+
51+
redis_conn = get_redis_connection()
4952
redis_conn.flushdb()

augur/application/cli/tasks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
from augur import instance_id
1515
from augur.application.logs import AugurLogger
16-
from augur.tasks.init.redis_connection import redis_connection
1716
from augur.application.cli import test_connection, test_db_connection
1817
from augur.application.cli.backend import clear_rabbitmq_messages, raise_open_file_limit
1918

0 commit comments

Comments
 (0)