Skip to content

Commit

Permalink
Merge branch 'master' into upgrade-django-history
Browse files Browse the repository at this point in the history
  • Loading branch information
awais786 authored Jul 28, 2023
2 parents cb50ec0 + b94b0a8 commit 7e42475
Show file tree
Hide file tree
Showing 89 changed files with 2,630 additions and 723 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,35 @@ jobs:
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
if: github.event_name == 'push'

strategy:
matrix:
variant:
- "lms_dev"
- "cms_dev"
- "cms"
- "lms"

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build and Push docker image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push lms base docker image
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run : make docker_push
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run : make docker_tag_build_push_${{matrix.variant}}

34 changes: 16 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Do things in edx-platform
.PHONY: base-requirements check-types clean \
compile-requirements detect_changed_source_translations dev-requirements \
docker_auth docker_build docker_push docker_tag docs extract_translations \
docker_auth docker_build docker_tag_build_push_lms docker_tag_build_push_lms_dev \
docker_tag_build_push_cms docker_tag_build_push_cms_dev docs extract_translations \
guides help lint-imports local-requirements migrate migrate-lms migrate-cms \
pre-requirements pull pull_translations push_translations requirements shell swagger \
technical-docs test-requirements ubuntu-requirements upgrade-package upgrade
Expand Down Expand Up @@ -100,6 +101,7 @@ REQ_FILES = \
requirements/edx/doc \
requirements/edx/testing \
requirements/edx/development \
requirements/edx/assets \
scripts/xblock/requirements

define COMMON_CONSTRAINTS_TEMP_COMMENT
Expand Down Expand Up @@ -144,30 +146,26 @@ upgrade-package: ## update just one package to the latest usable release
check-types: ## run static type-checking tests
mypy

docker_build:
docker_auth:
echo "$$DOCKERHUB_PASSWORD" | docker login -u "$$DOCKERHUB_USERNAME" --password-stdin

docker_build: docker_auth
DOCKER_BUILDKIT=1 docker build . --build-arg SERVICE_VARIANT=lms --build-arg SERVICE_PORT=8000 --target development -t openedx/lms-dev
DOCKER_BUILDKIT=1 docker build . --build-arg SERVICE_VARIANT=lms --build-arg SERVICE_PORT=8000 --target production -t openedx/lms
DOCKER_BUILDKIT=1 docker build . --build-arg SERVICE_VARIANT=cms --build-arg SERVICE_PORT=8010 --target development -t openedx/cms-dev
DOCKER_BUILDKIT=1 docker build . --build-arg SERVICE_VARIANT=cms --build-arg SERVICE_PORT=8010 --target production -t openedx/cms

docker_tag: docker_build
docker tag openedx/lms openedx/lms:${GITHUB_SHA}
docker tag openedx/lms-dev openedx/lms-dev:${GITHUB_SHA}
docker tag openedx/cms openedx/cms:${GITHUB_SHA}
docker tag openedx/cms-dev openedx/cms-dev:${GITHUB_SHA}
docker_tag_build_push_lms: docker_auth
docker buildx build -t openedx/lms:latest -t openedx/lms:${GITHUB_SHA} --platform linux/amd64,linux/arm64 --build-arg SERVICE_VARIANT=lms --build-arg SERVICE_PORT=8000 --target production --push .

docker_auth:
echo "$$DOCKERHUB_PASSWORD" | docker login -u "$$DOCKERHUB_USERNAME" --password-stdin
docker_tag_build_push_lms_dev: docker_auth
docker buildx build -t openedx/lms-dev:latest -t openedx/lms-dev:${GITHUB_SHA} --platform linux/amd64,linux/arm64 --build-arg SERVICE_VARIANT=lms --build-arg SERVICE_PORT=8000 --target development --push .

docker_tag_build_push_cms: docker_auth
docker buildx build -t openedx/cms:latest -t openedx/cms:${GITHUB_SHA} --platform linux/amd64,linux/arm64 --build-arg SERVICE_VARIANT=cms --build-arg SERVICE_PORT=8010 --target production --push .

docker_push: docker_tag docker_auth ## push to docker hub
docker push "openedx/lms:latest"
docker push "openedx/lms:${GITHUB_SHA}"
docker push "openedx/lms-dev:latest"
docker push "openedx/lms-dev:${GITHUB_SHA}"
docker push "openedx/cms:latest"
docker push "openedx/cms:${GITHUB_SHA}"
docker push "openedx/cms-dev:latest"
docker push "openedx/cms-dev:${GITHUB_SHA}"
docker_tag_build_push_cms_dev: docker_auth
docker buildx build -t openedx/cms-dev:latest -t openedx/cms-dev:${GITHUB_SHA} --platform linux/amd64,linux/arm64 --build-arg SERVICE_VARIANT=cms --build-arg SERVICE_PORT=8010 --target development --push .

lint-imports:
lint-imports
Expand Down
14 changes: 0 additions & 14 deletions cms/djangoapps/contentstore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
from xmodule.modulestore.django import modulestore

from cms.djangoapps.models.settings.course_grading import CourseGradingModel
from common.djangoapps.student import auth
from common.djangoapps.student.roles import CourseCreatorRole, OrgContentCreatorRole
import openedx.core.djangoapps.content_staging.api as content_staging_api

from .utils import reverse_course_url, reverse_library_url, reverse_usage_url
Expand Down Expand Up @@ -377,15 +375,3 @@ def is_item_in_course_tree(item):
ancestor = ancestor.get_parent()

return ancestor is not None


def is_content_creator(user, org):
"""
Check if the user has the role to create content.
This function checks if the User has role to create content
or if the org is supplied, it checks for Org level course content
creator.
"""
return (auth.user_has_role(user, CourseCreatorRole()) or
auth.user_has_role(user, OrgContentCreatorRole(org=org)))
19 changes: 19 additions & 0 deletions cms/djangoapps/contentstore/toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,25 @@ def use_new_problem_editor():
return ENABLE_NEW_PROBLEM_EDITOR_FLAG.is_enabled()


# .. toggle_name: new_editors.add_game_block_button
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .. toggle_description: This flag enables the creation of the new games block
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2023-07-26
# .. toggle_target_removal_date: 2023-09-31
# .. toggle_tickets: TNL-10924
# .. toggle_warning:
ENABLE_ADD_GAME_BLOCK_FLAG = WaffleFlag('new_editors.add_game_block_button', __name__)


def use_add_game_block():
"""
Returns a boolean if add game block button is enabled
"""
return ENABLE_ADD_GAME_BLOCK_FLAG.is_enabled()


# .. toggle_name: contentstore.individualize_anonymous_user_id
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
Expand Down
5 changes: 2 additions & 3 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,13 +972,12 @@ def get_subsections_by_assignment_type(course_key):
return subsections_by_assignment_type


def update_course_discussions_settings(course_key):
def update_course_discussions_settings(course):
"""
Updates course provider_type when new course is created
"""
provider = DiscussionsConfiguration.get(context_key=course_key).provider_type
provider = DiscussionsConfiguration.get(context_key=course.id).provider_type
store = modulestore()
course = store.get_course(course_key)
course.discussions_settings['provider_type'] = provider
store.update_item(course, course.published_by)

Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
has_course_author_access,
has_studio_read_access,
has_studio_write_access,
has_studio_advanced_settings_access
has_studio_advanced_settings_access,
is_content_creator,
)
from common.djangoapps.student.roles import (
CourseInstructorRole,
Expand Down Expand Up @@ -118,7 +119,6 @@
update_course_discussions_settings,
)
from .component import ADVANCED_COMPONENT_TYPES
from ..helpers import is_content_creator
from cms.djangoapps.contentstore.xblock_storage_handlers.view_handlers import (
create_xblock_info,
)
Expand Down Expand Up @@ -996,7 +996,7 @@ def create_new_course(user, org, number, run, fields):
store_for_new_course = modulestore().default_modulestore.get_modulestore_type()
new_course = create_new_course_in_store(store_for_new_course, user, org, number, run, fields)
add_organization_course(org_data, new_course.id)
update_course_discussions_settings(new_course.id)
update_course_discussions_settings(new_course)

# Enable certain fields rolling forward, where configured
if default_enable_flexible_peer_openassessments(new_course.id):
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/views/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
STUDIO_VIEW_USERS,
get_user_permissions,
has_studio_read_access,
has_studio_write_access
has_studio_write_access,
)
from common.djangoapps.student.roles import (
CourseInstructorRole,
Expand Down
10 changes: 5 additions & 5 deletions cms/envs/bok_choy.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
"BULK_EMAIL_DEFAULT_FROM_EMAIL": "[email protected]",
"CACHES": {
"celery": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_celery",
"LOCATION": [
"localhost:11211"
]
},
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "sandbox_default",
"LOCATION": [
"localhost:11211"
]
},
"general": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "sandbox_general",
"LOCATION": [
"localhost:11211"
]
},
"mongo_metadata_inheritance": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_mongo_metadata_inheritance",
"LOCATION": [
"localhost:11211"
]
},
"staticfiles": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_static_files",
"LOCATION": [
Expand Down
11 changes: 5 additions & 6 deletions cms/envs/bok_choy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ BUGS_EMAIL: [email protected]
BULK_EMAIL_DEFAULT_FROM_EMAIL: [email protected]
CACHES:
celery:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_celery
LOCATION: ['localhost:11211']
default:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_default
LOCATION: ['localhost:11211']
general:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_general
LOCATION: ['localhost:11211']
mongo_metadata_inheritance:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_mongo_metadata_inheritance
LOCATION: ['localhost:11211']
staticfiles:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_static_files
LOCATION: ['localhost:11211']
Expand Down Expand Up @@ -128,4 +128,3 @@ XQUEUE_INTERFACE:
url: http://localhost:18040
ZENDESK_API_KEY: ''
ZENDESK_USER: ''

10 changes: 5 additions & 5 deletions cms/envs/bok_choy_docker.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
"BULK_EMAIL_DEFAULT_FROM_EMAIL": "[email protected]",
"CACHES": {
"celery": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_celery",
"LOCATION": [
"edx.devstack.memcached:11211"
]
},
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "sandbox_default",
"LOCATION": [
"edx.devstack.memcached:11211"
]
},
"general": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "sandbox_general",
"LOCATION": [
"edx.devstack.memcached:11211"
]
},
"mongo_metadata_inheritance": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_mongo_metadata_inheritance",
"LOCATION": [
"edx.devstack.memcached:11211"
]
},
"staticfiles": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_static_files",
"LOCATION": [
Expand Down
11 changes: 5 additions & 6 deletions cms/envs/bok_choy_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ BUGS_EMAIL: [email protected]
BULK_EMAIL_DEFAULT_FROM_EMAIL: [email protected]
CACHES:
celery:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_celery
LOCATION: ['edx.devstack.memcached:11211']
default:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_default
LOCATION: ['edx.devstack.memcached:11211']
general:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_general
LOCATION: ['edx.devstack.memcached:11211']
mongo_metadata_inheritance:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_mongo_metadata_inheritance
LOCATION: ['edx.devstack.memcached:11211']
staticfiles:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_static_files
LOCATION: ['edx.devstack.memcached:11211']
Expand Down Expand Up @@ -125,4 +125,3 @@ XQUEUE_INTERFACE:
url: http://localhost:18040
ZENDESK_API_KEY: ''
ZENDESK_USER: ''

Loading

0 comments on commit 7e42475

Please sign in to comment.