debian-mirror-gitlab/doc/development/jh_features_review.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

99 lines
3.8 KiB
Markdown
Raw Normal View History

2021-06-08 01:23:25 +05:30
---
stage: none
group: unassigned
2022-04-04 11:22:00 +05:30
info: https://jihulab.com/gitlab-cn/gitlab
2021-06-08 01:23:25 +05:30
---
# Guidelines for reviewing JiHu (JH) Edition related merge requests
We have two kinds of changes related to JH:
- Inside `jh/`
- This is beyond EE repository and not the intention for this documentation.
- Outside `jh/`
- These will have to sit in EE repository, so reviewers and maintainers for
EE repository will have to review and maintain. This includes codes like
`Gitlab.jh?`, and how it attempts to load codes under `jh/` just like we
have codes which will load codes under `ee/`.
- This documentation intended to guide how those codes should look like, so
we'll have better understanding what are the changes needed for looking up
codes under `jh/`.
- We will generalize this so both EE and JH can share the same mechanism,
then we wouldn't have to treat them differently.
2022-04-04 11:22:00 +05:30
If needed, review the corresponding JH merge request located at [JH repository](https://jihulab.com/gitlab-cn/gitlab).
2021-06-08 01:23:25 +05:30
2021-12-11 22:18:48 +05:30
## When to merge files to the GitLab Inc. repository
2022-04-04 11:22:00 +05:30
Files that are added to the GitLab JH repository outside of `jh/` must be mirrored in the GitLab Inc. repository.
2021-12-11 22:18:48 +05:30
2022-04-04 11:22:00 +05:30
If code that is added to the GitLab Inc. repository references (for example, `render_if_exists`) any GitLab JH file that does not
2021-12-11 22:18:48 +05:30
exist in the GitLab Inc. codebase, add a comment with a link to the JiHu merge request or file. This is to prevent
the reference from being misidentified as a missing partial and subsequently deleted in the `gitlab` codebase.
2021-09-04 01:27:46 +05:30
## Process overview
See the [merge request process](https://about.gitlab.com/handbook/ceo/chief-of-staff-team/jihu-support/#merge-request-process)
on the JiHu Support handbook.
This page is the single source of truth for JiHu-related processes.
2021-09-30 23:02:18 +05:30
## Act as EE when `jh/` does not exist or when `EE_ONLY=1`
2021-06-08 01:23:25 +05:30
- In the case of EE repository, `jh/` does not exist so it should just act like EE (or CE when the license is absent)
- In the case of JH repository, `jh/` does exist but `EE_ONLY` environment variable can be set to force it run under EE mode.
2021-09-30 23:02:18 +05:30
## Act as FOSS when `FOSS_ONLY=1`
- In the case of JH repository, `jh/` does exist but `FOSS_ONLY` environment variable can be set to force it run under FOSS (CE) mode.
2021-06-08 01:23:25 +05:30
## CI pipelines in a JH context
EE repository does not have `jh/` directory therefore there is no way to run
2022-04-04 11:22:00 +05:30
JH pipelines in the EE repository. All JH tests should go to [JH repository](https://jihulab.com/gitlab-cn/gitlab).
2021-06-08 01:23:25 +05:30
The top-level JH CI configuration is located at `jh/.gitlab-ci.yml` (which
does not exist in EE repository) and it'll include EE CI configurations
accordingly. Sometimes it's needed to update the EE CI configurations for JH
to customize more easily.
### JH features based on CE or EE features
For features that build on existing CE/EE features, a module in the `JH`
namespace injected in the CE/EE class/module is needed. This aligns with
what we're doing with EE features.
2022-08-27 11:52:29 +05:30
See [Extend CE features with EE backend code](ee_features.md#extend-ce-features-with-ee-backend-code)
for more details.
2021-06-08 01:23:25 +05:30
For example, to prepend a module into the `User` class you would use
the following approach:
```ruby
class User < ActiveRecord::Base
# ... lots of code here ...
end
User.prepend_mod
```
Under EE, `User.prepend_mod` will attempt to:
- Load EE module
Under JH, `User.prepend_mod` will attempt to:
- Load EE module, and:
- Load JH module
Do not use methods such as `prepend`, `extend`, and `include`. Instead, use
`prepend_mod`, `extend_mod`, or `include_mod`. These methods will try to find
the relevant EE and JH modules by the name of the receiver module.
If reviewing the corresponding JH file is needed, it should be found at
2022-04-04 11:22:00 +05:30
[JH repository](https://jihulab.com/gitlab-cn/gitlab).
2021-06-08 01:23:25 +05:30
### General guidance for writing JH extensions
See [Guidelines for implementing Enterprise Edition features](ee_features.md)
for general guidance.