Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add atlas pull with global settings | FC-0012 #964

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

OmarIthawi
Copy link
Contributor

@OmarIthawi OmarIthawi commented Dec 15, 2023

Add atlas default variables for other plugins to use.

I chose to make it simple.

Another option I've had is to enable a third variable:

ATLAS_BRANCH: "main"
ATLAS_REPOSITORY: "openedx/openedx-translations"
ATLAS_OPTIONS: "--repository={{ ATLAS_REPOSITORY }} --branch={{ ATLAS_BRANCH }}"

This is useful to allow the languages and add other atlas arguments. I'm open to suggestions.

TODO

  • Add docs
  • Test the build
git status after Docker build
$ docker run -it docker.io/overhangio/openedx:17.0.0-nightly bash
app@######:~/edx-platform$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   cms/static/js/i18n/ar/djangojs.js
	modified:   cms/static/js/i18n/da/djangojs.js
	modified:   cms/static/js/i18n/de-de/djangojs.js
	modified:   cms/static/js/i18n/el/djangojs.js
	modified:   cms/static/js/i18n/es-419/djangojs.js
	modified:   cms/static/js/i18n/es-es/djangojs.js
	modified:   cms/static/js/i18n/he/djangojs.js
	modified:   cms/static/js/i18n/hi/djangojs.js
	modified:   cms/static/js/i18n/id/djangojs.js
	modified:   cms/static/js/i18n/it-it/djangojs.js
	modified:   cms/static/js/i18n/pt-br/djangojs.js
	modified:   cms/static/js/i18n/pt-pt/djangojs.js
	modified:   cms/static/js/i18n/ru/djangojs.js
	modified:   cms/static/js/i18n/th/djangojs.js
	modified:   cms/static/js/i18n/tr-tr/djangojs.js
	modified:   cms/static/js/i18n/uk/djangojs.js
	modified:   cms/static/js/i18n/zh-cn/djangojs.js
	modified:   conf/locale/ar/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/ar/LC_MESSAGES/djangojs.po
	modified:   conf/locale/de_DE/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/de_DE/LC_MESSAGES/djangojs.po
	modified:   conf/locale/el/LC_MESSAGES/django.mo
	modified:   conf/locale/el/LC_MESSAGES/django.po
	modified:   conf/locale/el/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/el/LC_MESSAGES/djangojs.po
	modified:   conf/locale/en/LC_MESSAGES/django.po
	modified:   conf/locale/en/LC_MESSAGES/djangojs.po
	modified:   conf/locale/es_419/LC_MESSAGES/django.mo
	modified:   conf/locale/es_419/LC_MESSAGES/django.po
	modified:   conf/locale/es_419/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/es_419/LC_MESSAGES/djangojs.po
	modified:   conf/locale/he/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/he/LC_MESSAGES/djangojs.po
	modified:   conf/locale/hi/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/hi/LC_MESSAGES/djangojs.po
	modified:   conf/locale/id/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/id/LC_MESSAGES/djangojs.po
	modified:   conf/locale/it_IT/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/it_IT/LC_MESSAGES/djangojs.po
	modified:   conf/locale/pt_BR/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/pt_BR/LC_MESSAGES/djangojs.po
	modified:   conf/locale/pt_PT/LC_MESSAGES/django.mo
	modified:   conf/locale/pt_PT/LC_MESSAGES/django.po
	modified:   conf/locale/pt_PT/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/pt_PT/LC_MESSAGES/djangojs.po
	modified:   conf/locale/ru/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/ru/LC_MESSAGES/djangojs.po
	modified:   conf/locale/th/LC_MESSAGES/django.mo
	modified:   conf/locale/th/LC_MESSAGES/django.po
	modified:   conf/locale/th/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/th/LC_MESSAGES/djangojs.po
	modified:   conf/locale/tr_TR/LC_MESSAGES/django.mo
	modified:   conf/locale/tr_TR/LC_MESSAGES/django.po
	modified:   conf/locale/tr_TR/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/tr_TR/LC_MESSAGES/djangojs.po
	modified:   conf/locale/uk/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/uk/LC_MESSAGES/djangojs.po
	modified:   conf/locale/zh_CN/LC_MESSAGES/django.mo
	modified:   conf/locale/zh_CN/LC_MESSAGES/django.po
	modified:   conf/locale/zh_CN/LC_MESSAGES/djangojs.mo
	modified:   conf/locale/zh_CN/LC_MESSAGES/djangojs.po
	modified:   lms/static/js/i18n/ar/djangojs.js
	modified:   lms/static/js/i18n/da/djangojs.js
	modified:   lms/static/js/i18n/de-de/djangojs.js
	modified:   lms/static/js/i18n/el/djangojs.js
	modified:   lms/static/js/i18n/es-419/djangojs.js
	modified:   lms/static/js/i18n/es-es/djangojs.js
	modified:   lms/static/js/i18n/he/djangojs.js
	modified:   lms/static/js/i18n/hi/djangojs.js
	modified:   lms/static/js/i18n/id/djangojs.js
	modified:   lms/static/js/i18n/it-it/djangojs.js
	modified:   lms/static/js/i18n/pt-br/djangojs.js
	modified:   lms/static/js/i18n/pt-pt/djangojs.js
	modified:   lms/static/js/i18n/ru/djangojs.js
	modified:   lms/static/js/i18n/th/djangojs.js
	modified:   lms/static/js/i18n/tr-tr/djangojs.js
	modified:   lms/static/js/i18n/uk/djangojs.js
	modified:   lms/static/js/i18n/zh-cn/djangojs.js
  • Test the variables
Variables test
$ tutor config printvalue ATLAS_REVISION
main
$ tutor config printvalue ATLAS_REPOSITORY
openedx/openedx-translations
$ tutor config printvalue ATLAS_OPTIONS
--repository='openedx/openedx-translations' --branch 'main'

This pull request is part of the FC-0012 project which implements the Translation Infrastructure update OEP-58.

@OmarIthawi
Copy link
Contributor Author

cc: @regisb

@regisb
Copy link
Contributor

regisb commented Dec 18, 2023

Can we merge this PR and #950 in a single one?

@@ -2,6 +2,8 @@
# This file includes all Tutor setting defaults. Settings that do not have a
# default value, such as passwords, should be stored in base.yml.
# This must be defined early
ATLAS_BRANCH: "main"
ATLAS_REPOSITORY: "openedx/openedx-translations"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how atlas works at the moment. There's an open issue to support non-GitHub repositories but that's not planned yet:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that's a restriction that must be documented in the Tutor docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@regisb where should we add the section for Atlas docs?

Copy link
Contributor

@regisb regisb Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should go somewhere in this page: https://docs.tutor.edly.io/configuration.html

@@ -2,6 +2,8 @@
# This file includes all Tutor setting defaults. Settings that do not have a
# default value, such as passwords, should be stored in base.yml.
# This must be defined early
ATLAS_BRANCH: "main"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "ATLAS_REVISION" and it should be "main" only in nightly, based on the value of "OPENEDX_COMMON_VERSION".

@OmarIthawi OmarIthawi changed the title feat: add atlas default settings | FC-0012 feat: add atlas pull -- with global settings | FC-0012 Dec 19, 2023
@OmarIthawi
Copy link
Contributor Author

OmarIthawi commented Dec 19, 2023

@shadinaif @regisb would you mind reviewing this pull request based on the latest refactoring?

Please note that this pull request replaces #950

I'll continue improving the pull request and testing it on my machine and post screenshot. Meanwhile, I'd love a quick validation of the approach and the breaking changes.

@@ -158,7 +158,9 @@ The error produced should help you better understand what is happening.
The chosen default language does not display properly
-----------------------------------------------------

By default, Open edX comes with a `limited set <https://github.com/openedx/edx-platform/blob/master/conf/locale/config.yaml>` of translation/localization files. To complement these languages, we add locales from the `openedx-i18n project <https://github.com/openedx/openedx-i18n/blob/master/edx-platform/locale/config-extra.yaml>`_. But not all supported locales are downloaded. In some cases, the chosen default language will not display properly because it was not packaged in either edx-platform or openedx-i18n. If you feel like your language should be packaged, please `open an issue on the openedx-i18n project <https://github.com/openedx/openedx-i18n/issues>`_.
By default, Open edX comes with a `limited set <https://github.com/openedx/openedx-translations/tree/main/translations/edx-platform/conf/locale>` of translation/localization files. To complement these languages, we add locales from the `openedx-i18n project <https://github.com/openedx/openedx-i18n/blob/master/edx-platform/locale/config-extra.yaml>`_.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph should not contain references to openedx-i18n anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, removed!

# and we need to do a pass ourselves. Also, we need to compile the djangojs.js files for
# the downloaded locales.
# Pull latest translations via atlas
RUN atlas pull {{ ATLAS_OPTIONS }} translations/edx-platform/conf/locale:conf/locale
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that ATLAS_OPTIONS should be empty by default, and we should explicitely pass --repository='{{ ATLAS_REPOSITORY }}' --branch '{{ ATLAS_REVISION }}' to all atlas pull commands. Like so:

RUN atlas pull --repository='{{ ATLAS_REPOSITORY }}' --branch '{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} translations/edx-platform/conf/locale:conf/locale

Otherwise, users need to be smart about properly setting the upstream repository whenever they want to customise atlas options.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems appropriate. done.

@@ -2,6 +2,9 @@
# This file includes all Tutor setting defaults. Settings that do not have a
# default value, such as passwords, should be stored in base.yml.
# This must be defined early
ATLAS_REVISION: "{% if OPENEDX_COMMON_VERSION == 'master' %}main{% else %}{{ OPENEDX_COMMON_VERSION }}{% endif %}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect to maintain "open-release/xxx.master" branches and "open-release/xxx.y" tags? I see that the openedx-translations repo does not have an openedx.yaml file.

Copy link
Contributor Author

@OmarIthawi OmarIthawi Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect to maintain "open-release/xxx.master" branches and "open-release/xxx.y" tags?

Not really.

We don't have a plan for exactly that, but the intention is to keep a single open-release/redwood.master (or release/redwood, depending on the BTR group naming convention) branch for example but not open-release/xxx.y tags because we need operators to stay up to date with the release translations.

How do you recommend we proceed with this variable?

I see that the openedx-translations repo does not have an openedx.yaml file.

I'm a bit behind on that front. I've created an issue and asked Brian Smith to follow up:

@OmarIthawi
Copy link
Contributor Author

Can we merge this PR and #950 in a single one?

Yes, we can close #950.

@OmarIthawi OmarIthawi changed the title feat: add atlas pull -- with global settings | FC-0012 feat: add atlas pull with global settings | FC-0012 Jan 2, 2024
@OmarIthawi
Copy link
Contributor Author

@regisb this pull request has been tested pretty well and I think it's ready to be merged.

For reproducible builds and release branches, I've created a decision to discuss that:

Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for this important contribution Omar. Let's just keep in mind that we'll need release branches and tags in time for Redwood openedx/openedx-translations#3183

@regisb regisb merged commit 53ebfd4 into overhangio:nightly Jan 8, 2024
1 check passed
@OmarIthawi
Copy link
Contributor Author

Awesome! Thanks for this important contribution Omar. Let's just keep in mind that we'll need release branches and tags in time for Redwood openedx/openedx-translations#3183

We will, I'll need to conclude that decision and handover the work to the BTR Working Group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants