Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/setup-pyth…
Browse files Browse the repository at this point in the history
…on-4
  • Loading branch information
nedbat authored Nov 13, 2023
2 parents b06caf4 + 5f2875a commit 3b86322
Show file tree
Hide file tree
Showing 41 changed files with 1,321 additions and 617 deletions.
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ updates:
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "edx/arbi-bom"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
tox-env: [django32, quality]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.8'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/escalate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: atlassian/gajira-create@v3
id: jiracreate
with:
project: PSRE
project: GSRE
issuetype: Story
summary: ${{ github.event.issue.title }}
description: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.8'
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/upgrade-python-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Upgrade Requirements

on:
schedule:
- cron: "5 4 * * 0"
workflow_dispatch:
inputs:
branch:
description: "Target branch to create requirements PR against"
required: true
default: main

jobs:
call-upgrade-python-requirements-workflow:
uses: openedx/.github/.github/workflows/upgrade-python-requirements.yml@master
with:
branch: ${{ github.event.inputs.branch }}
team_reviewers: "arbi-bom"
email_address: [email protected]
send_success_notification: false
secrets:
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
edx_smtp_username: ${{ secrets.EDX_SMTP_USERNAME }}
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}
51 changes: 50 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,56 @@ Change Log
Unreleased
~~~~~~~~~~
*

[3.1.1] - 2023-11-06
~~~~~~~~~~~~~~~~~~~~
Fixed
_____
* ConfigWatcher should now respond to model events properly now that it registers receivers with strong references. (Tested in sandbox.)

[3.1.0] - 2023-10-31
~~~~~~~~~~~~~~~~~~~~

Changed
_______

* Add log message for each model the ConfigWatcher is listening to
* Ensure that ConfigWatcher only attaches receivers once

[3.0.0] - 2023-10-30
~~~~~~~~~~~~~~~~~~~~

Changed
_______

* Renamed ``ConfigWatcherApp`` to ``ConfigWatcher`` to be less redundant. This is technically a breaking change but the app was not in use yet.
* Enabled ``ConfigWatcher`` as a plugin for LMS

[2.2.0] - 2023-10-27
~~~~~~~~~~~~~~~~~~~~

Added
_____

* Add ``edx_arch_experiments.config_watcher`` Django app for monitoring Waffle changes
* Add script to get github action errors
* Add script to republish failed events

[2.1.0] - 2023-10-10
~~~~~~~~~~~~~~~~~~~~

* Add ORA2 to our code owner mapping script.

[2.0.0] - 2023-06-01
~~~~~~~~~~~~~~~~~~~~

* Removes summary hook aside, now in the ai-aside repo

[1.2.0] - 2023-05-08
~~~~~~~~~~~~~~~~~~~~

* Update summary hook to trigger on videos
* Remove text selection data key from summary hook html

[1.1.4] - 2023-04-14
~~~~~~~~~~~~~~~~~~~~
Expand Down
98 changes: 98 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Docker in this repo is only supported for running tests locally
# as an alternative to virtualenv natively - johnnagro 2023-09-06
FROM ubuntu:focal as app
LABEL org.opencontainers.image.authors="[email protected]"


# Packages installed:
# git; Used to pull in particular requirements from github rather than pypi,
# and to check the sha of the code checkout.

# build-essentials; so we can use make with the docker container

# language-pack-en locales; ubuntu locale support so that system utilities have a consistent
# language and time zone.

# python; ubuntu doesnt ship with python, so this is the python we will use to run the application

# python3-pip; install pip to install application requirements.txt files

# pkg-config
# mysqlclient>=2.2.0 requires this (https://github.com/PyMySQL/mysqlclient/issues/620)

# libmysqlclient-dev; to install header files needed to use native C implementation for
# MySQL-python for performance gains.

# libssl-dev; # mysqlclient wont install without this.

# python3-dev; to install header files for python extensions; much wheel-building depends on this

# gcc; for compiling python extensions distributed with python packages like mysql-client

# If you add a package here please include a comment above describing what it is used for
RUN apt-get update && apt-get -qy install --no-install-recommends \
language-pack-en \
locales \
python3.8 \
python3-pip \
python3.8-venv \
pkg-config \
libmysqlclient-dev \
libssl-dev \
python3-dev \
gcc \
build-essential \
git \
curl


RUN pip install --upgrade pip setuptools
# delete apt package lists because we do not need them inflating our image
RUN rm -rf /var/lib/apt/lists/*

RUN ln -s /usr/bin/python3 /usr/bin/python

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV DJANGO_SETTINGS_MODULE test_settings

# Env vars: path
ENV VIRTUAL_ENV='/edx/app/venvs/edx-arch-experiments'
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV PATH="/edx/app/edx-arch-experiments/node_modules/.bin:${PATH}"
ENV PATH="/edx/app/edx-arch-experiments/bin:${PATH}"
ENV PATH="/edx/app/nodeenv/bin:${PATH}"

RUN useradd -m --shell /bin/false app

WORKDIR /edx/app/edx-arch-experiments

RUN python3.8 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# Copy the requirements explicitly even though we copy everything below
# this prevents the image cache from busting unless the dependencies have changed.
COPY requirements/ /edx/app/edx-arch-experiments/requirements/

# Dependencies are installed as root so they cannot be modified by the application user.
RUN pip install -r requirements/dev.txt
RUN pip install nodeenv

# Set up a Node environment and install Node requirements.
# Must be done after Python requirements, since nodeenv is installed
# via pip.
# The node environment is already 'activated' because its .../bin was put on $PATH.
RUN nodeenv /edx/app/nodeenv --node=18.15.0 --prebuilt

RUN mkdir -p /edx/var/log

# Code is owned by root so it cannot be modified by the application user.
# So we copy it before changing users.
USER app

# This line is after the requirements so that changes to the code will not
# bust the image cache
COPY . /edx/app/edx-arch-experiments

6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy
$(CMD_PIP_COMPILE) -o requirements/base.txt requirements/base.in
$(CMD_PIP_COMPILE) -o requirements/test.txt requirements/test.in
$(CMD_PIP_COMPILE) -o requirements/doc.txt requirements/doc.in
$(CMD_PIP_COMPILE) -o requirements/scripts.txt requirements/scripts.in
$(CMD_PIP_COMPILE) -o requirements/quality.txt requirements/quality.in
$(CMD_PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
$(CMD_PIP_COMPILE) -o requirements/dev.txt requirements/dev.in
Expand Down Expand Up @@ -104,3 +105,8 @@ dummy_translations: ## generate dummy translation (.po) files
build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files

validate_translations: build_dummy_translations detect_changed_source_translations ## validate translations

## Docker in this repo is only supported for running tests locally
## as an alternative to virtualenv natively - johnnagro 2023-09-06
test-shell: ## Run a shell, as root, on the specified service container
docker-compose run -u 0 test-shell env TERM=$(TERM) /bin/bash
10 changes: 7 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ edx-arch-experiments
|pypi-badge| |ci-badge| |codecov-badge| |pyversions-badge|
|license-badge|

A plugin to include applications under development by the architecture team at 2U.
A plugin to include applications under development by and useful utility scripts for the architecture team at 2U.

Overview
------------------------

This plugin is meant to house experimental and in-development applications from the edX architecture team at 2U that are either not appropriate (i.e. 2U-specific) or not yet ready for community consumption.

It also includes some one-off scripts meant to reduce toil for the team.

Development Workflow
--------------------
Expand All @@ -28,7 +28,11 @@ One Time Setup
Local testing
~~~~~~~~~~~~~
To test your changes locally, you will need to install the package from your local branch into edx-platform. For example, if using devstack, copy or clone your branch into <devstack-parent>/src/edx-arch-experiments. Then, in an lms or cms shell, run ``pip install -e /edx/src/edx-arch-experiments``. The plug-in configuration will automatically be picked up once installed, and changes will be hot reloaded.
Two options are available for testing changes locally:

First, via `make test-shell` a dockerized development envrionment can be launched to run `pytest` and do basic migration work.

Second, a local copy of the package can be installed into edx-platform. For example, if using devstack, copy or clone your branch into <devstack-parent>/src/edx-arch-experiments. Then, in an lms or cms shell, run ``pip install -e /edx/src/edx-arch-experiments``. The plug-in configuration will automatically be picked up once installed, and changes will be hot reloaded.


Every time you develop something in this repo
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Docker in this repo is only supported for running tests locally
# as an alternative to virtualenv natively - johnnagro 2023-09-06
version: "2.1"
services:
test-shell:
build:
context: .
dockerfile: Dockerfile
container_name: arch-experiments.test.app
hostname: app.test.arch-experiments
volumes:
- .:/edx/app/edx-arch-experiments

networks:
- devstack_default
# Allows attachment to this container using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
DJANGO_SETTINGS_MODULE: test_settings

networks:
devstack_default:
external: true
2 changes: 1 addition & 1 deletion edx_arch_experiments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
A plugin to include applications under development by the architecture team at 2U.
"""

__version__ = '1.1.4'
__version__ = '3.1.1'
20 changes: 20 additions & 0 deletions edx_arch_experiments/config_watcher/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
App for reporting configuration changes to Slack for operational awareness.
"""

from django.apps import AppConfig


class ConfigWatcher(AppConfig):
"""
Django application to report configuration changes to operators.
"""
name = 'edx_arch_experiments.config_watcher'

# Mark this as a plugin app
plugin_app = {}

def ready(self):
from .signals import receivers # pylint: disable=import-outside-toplevel

receivers.connect_receivers()
Loading

0 comments on commit 3b86322

Please sign in to comment.