RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
Table of Contents | ||
---|---|---|
|
In order to contribute code, first-time users are requested to agree to the license at wiki.rdkcentral. As an unaffiliated individual, you must sign the Contributor License Agreement (CLA). You can complete that process online.
The Contributor License Agreement is necessary mainly because you own the copyright to your changes, even after your contribution becomes part of our codebase, so we need your permission to use and distribute your code. We also need to be sure of various other things — for instance that you‘ll tell us if you know that your code infringes on other people’s patents.
You don‘t have to sign the CLA until after you’ve submitted your code for review and a member has approved it, but you must do it before we can put your code into our codebase. Before you start working on a larger contribution, get in touch with us to discuss your idea so that we can help out and possibly guide you. Early coordination makes it much easier to avoid frustration later on.
All submissions, including submissions by project members, require review. We use both Gerrit (Gerrit Code Review) and Github (Github Code Review) depending on where the repo is hosted. Currently, team-member submissions are reviewed privately, and external submissions go through public reviews.
The following steps explain the submission process:
git push command
to upload the review to code.rdkcentral.git commit --amend
to add them to the existing commit. Then return to step 2.The RDK CLA facilitates the acceptance and sharing of RDK contributions within the community.
When you contribute to an RDK open source project on GitHub via a new pull request, a bot will evaluate whether you have signed the CLA. The bot will comment on the pull request, including a link to accept the agreement.
CLA assistant enables contributors to sign CLAs from within a pull request. The CLA is stored as a GitHub Gist file and linked with the repository/organization in CLA assistant.
Note - CLA assistant is provided by SAP as a free hosted offering under: cla-assistant.io
The Code Contribution Workflow is designed to facilitate community involvement in the development of RDK components. The structured process ensures that contributions are reviewed, validated and integrated effectively, maintaining high standards of quality throughout.
Product Branch:
Monthly Sprint Branch (rdk-dev-yymm):
Regression Branch:
draw.io Diagram | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Component owners/reviewers/approvers, defined as specific groups in Gerrit, will be added to the review by default. You may request additional feedback by specifically adding reviewers via the Gerrit web GUI.
This section describes the general RDK development work-flow and related topics. The general pattern for successfully accepting a change is as follows:
For a detailed step by step description, please refer: Gerrit Development Workflow.
On a periodic basis, RDK code is tested and released to the community as CMF releases. This will be generic RDK code without dependency to any platform. CMF code can be built for raspberry-pi or can be ported to a specific platform (RDK Porting). And once the component owner approves this change, it will be available to the community in RDK central.
While working with CMF stack, one might find ways to enhance RDK code by adding new features or bug fixes as RDK contribution. The general CMF contribution workflow is as follows:
draw.io Diagram | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Detailed information on contributing code changes to RDK can be found here: Code Management Documentation
Support tickets can be raised to get request support from RDK Community Support team. This can be for the bugs you face, doubts you have or any code contributions which you think might enhance RDK. RDK Support ticket can be raised here:support@rdkcentral.
A Snap shot for how to create a JIRA.
Issue type corresponds to the type of contributions we are making. The following issue types can be possible for patches contribution
√ Incident - Build failure incident issues with the code verification steps such as Black duck scan, Jenkins verification etc.
√ Bug - Bugs in existing component code. To report a bug, users must create a ticket with type Bug and provide as much information as possible, including:
√ Task - An individual task which may be part of enhancement of existing feature, etc.
√ Improvement - Improvements such as code refactoring or enhancements in current code.
Summary and Descriptions are mandatory fields need to be filled.
Click on Create button to Create a new JIRA. Sample example is provided below.
Note: To know more about how to refresh the patches click here.
A feature contribution should follow after creating an appropriate JIRA project. This will present a clear picture about the architecture, testing details and other information which will be helpful during the acceptance process of the contribution.
Code Block | ||
---|---|---|
| ||
Brief introduction on what the current system lacks & what needs to be done: 1. Individual task/highlighted point #1 brief description. 2. Individual task/highlighted point #2 brief description. |
Code Block | ||
---|---|---|
| ||
The following items should be considered/addressed in the documentation for any RDK design initiative JIRA Update Checklist ----------------------- The following JIRA fields MUST be filled in to be considered "Definition Complete": * RDK SoC, RDK OEM - populate these fields for any user story where we have dependency on OEM and/or SoC to perform work in the completion of this user story. Select all that apply, or “None” if there is no dependency. * OEM/SoC Impact Details - description of impact (or "see Solution Overview" if included in the architecture specification) * Platforms - ensure correct list of devices * Validation - type of testing * Regression - is regression required? * Impacted Party - Comcast Only, Syndication, etc. * Dependency - Internal/External * Description - Solution Overview and Architecture Checklist Testing impact/Guidance ------------------------ * Impacted modules * Test process Automated Testing ------------------ * Automation test procedure. Diagnostics, Telemetry and Logging ----------------------------------- * N/A Outbound Network Connections ------------------------------ * Does this component make outbound connection requests? * If yes, do the connection requests retry in the case of failure? ** Do the repeated requests use an exponential back-off? ** If a maximum back-off has been defined, is it greater than 10 minutes? Security ---------- * For Security Review - Do feature elements: ** make any changes to network port assignments? ** change iptables rules? ** require credentials, passwords, secret data? ** make any changes to our network connections? ** connect to new services or servers? ** use data input from users or external tools? ** use any cryptographic functions? ** create or disclose proprietary or sensitive Co. or device data? ** properly log operational and configuration changes? ** If possible describe what could happen if feature elements are: *** spoofed? *** tampered with? *** used by an unauthorized actor? ** Advanced questions (optional) *** what happens if a record of actions taken is destroyed? *** what happens if an attacker attempts to DOS with the feature? SI Concerns ------------- * Yes/No/Any Performance expectations ------------------------- * Yes/No/Any Timing consideration ---------------------- * If Any. |
In order to contribute code, first-time users are requested to agree to the license at wiki.rdkcentral.
RDK components are hosted at code.rdkcentral. You can submit your code changes for review via that site using the workflow outlined below.
Clone the component repository from the Gerrit server code.rdkcentral into a local workspace
Clone with commit-msg hook (to add Change-ID footer to commit messages)
Code Block |
---|
git clone https://code.rdkcentral.com/r/<component-name> <component-name> -b <branch-name> cd <component-name> gitdir=$(git rev-parse --git-dir); curl -o ${gitdir}/hooks/commit-msg https://code.rdkcentral.com/r/tools/hooks/commit-msg ; chmod +x ${gitdir}/hooks/commit-msg |
Click here to find the details about <component-name> & <branch-name> for code submission.
Note: The commit-msg hook is installed in the local Git repository and is a prerequisite for Gerrit to accept commits. The inclusion of the unique Change-ID in the commit message allows Gerrit to automatically associate a new version of a change back to its original review.
Note: You may need to configure your Git identity on the cloned repository. The email address that your local Git uses should match the email address listed in Gerrit.
Note |
---|
|
Example commands to run are as follows:
Code Block |
---|
$ git config user.name "John Doe" $ git config user.email "john.doe@example.org" |
Each commit constitutes a change in Gerrit and must be approved separately. It is recommended to squash several commits into one that represents a change to the project.
If necessary, it is possible to squash a series of commits into a single commit before publishing them, using interactive rebase:
Code Block |
---|
$ git rebase --interactive |
It is important to preserve the Change-Id line when editing and there should only be one "pick" entry at the end of this process. The end result is to submit one change to Gerrit.
Commits will be BLOCKED if the format of the commit message does not comply with the standard. You will see a warning as to why the commit was blocked.
Mandatory Information in Commit Message
Code Block |
---|
$ git commit --amend |
<Add your commit message in below format>
Code Block |
---|
<JIRA TICKET #1>, <JIRA TICKET #2>, <JIRA TICKET #n> : <one line summary of change> <empty line> Reason for change: <explanation of change> Test Procedure: < test procedure> Risks: <side effects and other considerations> [Note: state None if there are no other considerations] <empty line> Signed-off-by: Your Name <your_name@email.com> |
Submit your code changes for review
Code Block |
---|
$ git push origin HEAD:refs/for/<branch> |
When interfacing with Gerrit you push to a virtual branch /refs/for/<branch>, representing "code review before submission to branch". Gerrit will subsequently assign a unique URL for the change, to facilitate access and review via the web UI.
Notes:
Component owners/reviewers/approvers, defined as specific groups in Gerrit, will be added to the review by default. You may request additional feedback by specifically adding reviewers via the Gerrit web GUI.
BlackDuck, copyright scanning and build jobs will be triggered automatically from CMF Jenkins. The output of these jobs is integrated into the Gerrit voting process via custom labels and will reflect any 'red flag' in a file that has new code changes, whether introduced in the new change/patch-set or not. Scans will post any findings as comments in the Gerrit review. Build jobs also do that, but in addition will upload the build log to the corresponding JIRA ticket (if there is one) as an attachment.
Reviewers can comment on and score a given change.
The default set of rules for enabling a code change for submission requires:
The result of the scoring process and validation rules is to enable the Submit action on the Gerrit Web UI and subsequent merge capability to the target branch.
Label: Code Review (Highlighted in yellow color) For a change to be mergeable, the latest patch set must have a '+2' value approval in this category or label, and no '-2 Do not submit'. Thus -2 on any patch set can block a submit, while +2 on the latest patch set enables it for merging.
Labels: Blackduck/Copyright/Component-Build (Highlighted in yellow color) For a change to be mergeable, the change must have a '+1' score on these labels, and no '-1 Fails'. Thus, '-1 Fails' can block a submit, while '+1' enables a submit.
Note |
---|
Review input is generally referred to as labelling with a positive/negative score. |
Only authorized users, i.e. component owners, component approvers or admins, can submit the change allowing Gerrit to merge it to the target branch as soon as possible. A change can be submitted, having satisfied the approval conditions described earlier, by clicking the 'Submit Patch Set n' button within the Gerrit UI. When a change has been Submitted, it is automatically merged to the target branch by Gerrit.
Depending on the review outcome, it might be decided to abandon the change. The component owner or an authorised user may abandon the change by clicking the "Abandon Change" button. The abandoned changes are not removed from the Gerrit database and can be restored at a later stage.
If a change depends on another change that is still in review, it will enter this state. It will be merged automatically by Gerrit once all its dependencies are submitted and merged.
If you need to rework a change, you need to push another commit with the same Change-ID as the original in its commit message.
This is the mechanism Gerrit uses to associate or link the two items. The `--amend` option to the Git commit command prevents a new Change-ID being generated by the commit-msg hook.
The basic steps are outlined below.
First, fetch the change. If you still have the checkout that was used to push the original change, you can skip this step.
Code Block |
---|
$ git fetch https://user@code.rdkcentral.com/r/component1 refs/changes/02/2/1 && git checkout FETCH_HEAD |
where the numbering scheme for fetching the changes is as follows:
refs/changes/<last two digits of change number> <change number> <patch set number>
Note |
---|
Gerrit will specify this fetch URL via the web UI on the 'Download' link on the review page for the change in question, you just paste it into the command line. |
Next, make any necessary source changes, and do:
Code Block |
---|
$ git commit --amend $ git push origin HEAD:refs/for/<branch> |
A new patch set is now appended to the Gerrit review item, and this will go through the same review process as before.
Note |
---|
|
Essentially this means that the remote branch has evolved since this change was started and now software conflicts with changes in the remote branch. The developer must resolve the merge conflicts in their local clone and then push another patch-set.
The process is resumed at step 4, with the important distinction of committing with the --amend option, once the developer pulls the latest changes. Note: A summary of the steps involved, assuming the local branch still exists:
Rebase the local branch to the latest state of origin/<branch>;Resolve all conflicts; Commit with the `--amend` option; Push changes to Gerrit for review. After this change a new patch set is created for the change.
Note: If the local branch no longer exists, the steps are as follows:
Code Block |
---|
$ git fetch https://user@code.rdkcentral.com/r/rdk_component_1 refs/changes/58/58/2 && git checkout FETCH_HEAD $ git rebase origin/<branch> [Edit the conflicting file, cleaning up the <<<<, ==== >>> markers surrounding the conflicting lines] $ git add <file> $ git commit --amend $ git push origin HEAD:refs/for/<branch> |
Following RDK components are hosted at code.rdkcentral. Follow the Instructions to submit your code changes.
Example of how to use git clone for meta-rdk-ext component: git clone https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/rdk-oe/meta-rdk-ext -b rdk-next
List of open-sourced and licensed repositories hosted in RDK central gerrit can be found from Source Code Repositories.
GitHub is a Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface.
GitHub Enterprise is the on-premises version of GitHub and is available on VMware, AWS, and OpenStack KVM, on your own servers or in a private cloud. GitHub Enterprise operates on your infrastructure with your existing information security controls from firewalls and VPNs, to IAM and monitoring systems.
CMF GitHub Organizations
There is one primary RDKM Code Management organizations, namely RDKcentral. This organization hosts the open-source repositories for projects pertaining to RDK-V, RDK-B and RDK-C profiles.
Please refer to this link to see all the repositories Source Code Repositories.
Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch. Anyone with read permissions to a repository can create a pull request, but you must have write permissions to create a branch. If you want to create a new branch for your pull request and don't have write permissions to the repository, you can fork the repository first. Pull requests can only be opened between two branches that are different.
A ‘fork’ is a personal copy of another user's repository that lives on your GitHub account. Forks allow you to freely make changes to a project without affecting the original. A forked project also remains attached to the original, allowing you to submit a pull request to the original's author to update with your changes, ensuring you’re always working off a recent or up-to-date codebase.
In the recent past support for direct password authentication was removed from Github. You will need to generate a Github personal token to push your code changes RDK Central Github.
To create your personal token, you have to go to github.com -> Settings -> Developer Settings -> Personal Access Token -> Generate New Token.
Note - While creating a new token, it will ask for Github configuration options selection – Select everything.
Once the Github token is generated successfull, you will need to add an entry an entry to the ~/.netrc file OR you can directly use this token as your Github password in the command line to push the code changes.
Example: how to add Github credential on ~/.netrc file
machine github.com login your-github-handle-name password ghp_BCy09kNYxg82no6OnliSJQVngGi9K1234567
Protected branches ensure that collaborators on your repository cannot make irrevocable changes to branches. Enabling protected branches also allows you to enable other optional checks and requirements, like required status checks and required reviews.
A custom CMF branch protection scheme is deployed in each repository in order to enforce the desired workflows. This scheme imposes the following rules:
Required status checks ensure that all required CI tests are passing before collaborators can make changes to a protected branch. Status checks are based on external processes, such as continuous integration builds, code compliance scanning, which run for each push you make to a repository. You can see the pending, passing, or failing state of status checks next to individual commits in your pull request.
The RDK CLA facilitates the acceptance and sharing of RDK contributions within the community.
When you contribute to an RDK open source project on GitHub via a new pull request, a bot will evaluate whether you have signed the CLA. The bot will comment on the pull request, including a link to accept the agreement.
CLA assistant enables contributors to sign CLAs from within a pull request. The CLA is stored as a GitHub Gist file and linked with the repository/organization in CLA assistant.
CLA assistant:
Note - CLA assistant is provided by SAP as a free hosted offering under: cla-assistant.io
CMF uses BlackDuck (Protex) to check incoming contributions for license compliance. BlackDuck is normally a very manual tool but a significant level of automation has been developed by the team to reduce manual intervention, but it still requires a human to oversee it.
Compliance scanning is looking for several things:
The key points are as follows:
OSS Engineer and interested parties are notified of scan failures (violations, pending identifications or reviews etc) via AWS Mailing list and Slack.
git-secrets is a tool created by AWS Labs that scans commits and commit messages and aims to prevent passwords and other sensitive information being committed to a git repository. The tool can also scan files or folders to look for secrets such as an AWS Access Key ID and AWS Secret Access Keys in a repository. git-secrets scans commits, commit messages, and merge commits to prevent adding secrets into your git repositories. If a commit, commit message, or any commit in merge history matches one of the configured prohibited regular expression patterns, then the commit is rejected.
Sign-in to GitHub with your own credentials.
Search for the Component.
Fork the component from GitHub. Forking will create a copy (i.e., your own WORKSPACE) of an original component to work.
From the file tree view on the left, select the branch dropdown menu, In the "Find or create a branch..." text field, type a unique name for your new branch, then click Create branch.
Click on the "Clone or download" button to get the clone URL from GitHub. Ensure your GitHub username present in the URL to start work with your own workspace.
Code Block |
---|
abcd123@dvm-yocto4-docker-abcd123:~/builds/meta_wan$ git clone https://github.com/Sukanya673/meta-rdk-wan.git -b new_branch_1 Cloning into 'meta-rdk-wan'... remote: Enumerating objects: 276, done. remote: Counting objects: 100% (117/117), done. remote: Compressing objects: 100% (71/71), done. remote: Total 276 (delta 95), refused 47 (delta 41), pack-reused 159 (from 1) Receiving objects: 100% (276/276), 59.05 kiB | 2.68 MiB/s, done. Resolving deltas: 100% (141/141), done. abcd123@dvm-yocto4-docker-abcd123:~/builds/meta_wan$ |
Make the code changes, and commit the changes
cd meta_wan git clone https://github.com/Sukanya673/meta-rdk-wan.git -b new_branch_1 Modify your code. $ git status $ git push After submitting your changes, follow the next step to create a PR. |
Once submitted the changes need to create pull request from GitHub for review. Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.
Once you've created a pull request, you can push commits from your workspace to add them to your existing pull request. These commits will appear in chronological order within your pull request and the changes will be visible in the "Files changed" tab.
Other contributors can review your proposed changes, add review comments, contribute to the pull request discussion, and even add commits to the pull request.
Writing documentation improves the design of your code. Talking through your API and design decisions on paper allows you to think about them in a more formalized way. A nice side effect is that it allows people to contribute code that follows your original intentions as well.
RDK component code is documented following the Doxygen standards and guidelines. Doxygen is a popular open-source tool for generating documentation from annotated C/C++ sources. Also, Doxygen supports documenting code written in other programming languages, such as Python, PHP, Java, etc.
The following tools are required to be installed in Linux machine (through apt-get install) to generate documentation with respect to various data flow diagrams.
The following are the steps to generate documentation using Doxygen tool.
Refer to below Doxygen Guideline Section for uniform style of adding Doxygen comments for the RDK system.
The purpose of this page is to provide a uniform style of Doxygen commenting for the RDK system. It will serve as a reference for current and future developers while documenting the RDK system as it evolves. Ultimately, this will establish a consistent manner of documentation to enhance the simplicity, readability, scalability, writability, reliability, and maintainability of the system.
Doxygen documentation can be generated in many formats (HTML, LaTeX, RTF, PDF, DOC). HTML generation has support for more plugins and is easier to refactor as the system changes. Doxygen style should follow a consistent format to aid development across different IDEs, reducing issues when generating documentation.
Code Block | ||||
---|---|---|---|---|
| ||||
/** * @tagname */ |
This is an example of a Java doc style Doxygen tag, since it uses the “@” symbol. Tags using the “\tagname” style are considered Qt style Doxygen tags.There should be a header file containing only Doxygen tags or a separate Doxygen file that acts as a guide for the components, classes, methods, and variables (e.g. DoxygenMainpage.h). This can be done using the @mainpage tag at the top of the file.
There should be a header file containing only Doxygen tags or a separate Doxygen file that acts as a guide for the components, classes, methods, and variables (e.g., DoxygenMainpage.h). This can be done using the @mainpage tag at the top of the file.
Code Block | ||||
---|---|---|---|---|
| ||||
/** * @mainpage Title of Document * */ |
A file should contain the @file tag at the top of the file. This supports generation of a file list tab on the main page. It also helps when files contain multiple classes.
Code Block | ||||
---|---|---|---|---|
| ||||
/** * @file FileName.h * * @brief Brief file description. * * Verbose file description. */ |
Classes can be tagged in a number of different ways, but in general they are tagged using the @brief and @class tags before the class declaration. Having the @author, @date, and @version supports tractability as the system is versioned throughout the software lifecycle. When updating classes, update comments like this:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#include <iostream> using namespace std; /** * @brief Brief class description * * Verbose description of class. * * @class Class Name */ class ClassName { public: ClassName(); ~ClassName(); int var1; /**< Comment about public member variable*/ /** *@brief Brief method description * * Verbose description of method * *@param Parameter in the method’s definition * *@return Return value of method */ int Function1(int x); protected: int var2; /**< Comment about protected member variable*/ /** *@brief Brief method description * * Verbose description of method * *@param Parameter in the method’s definition * *@return Return value of method */ int Function2(int x); private: int var3; /**< Comment about private member variable*/ /** *@brief Brief method description * * Verbose description of method * *@param Parameter in the method’s definition * *@return Return value of method */ int Function3(int x); }; |
A struct can be tagged in the same way a class, but it is best to use the @struct tag. When updating structs, update comments like this:
Code Block | ||||
---|---|---|---|---|
| ||||
/** *@brief Brief struct description * *@struct Struct Name */ |
Methods can be tagged in a number of ways, but in general the @brief, @details, @param, and @return tags are used before a method’s declaration or implementation. When updating methods, update comments like this:
Code Block | ||||
---|---|---|---|---|
| ||||
/** *@brief Brief method description * * Verbose description of method * *@param Parameter in the method’s definition * *@return Return value of method *@retval Verbose explanation of return values */ int addNumbers(int x) { int sum = 0; sum += x; return sum; } |
When updating variables, update comments like this:
Code Block | ||||
---|---|---|---|---|
| ||||
int number; /**< Comment about number*/ |
Enumerated types are tagged using the @enum. When updating enum types, update comments like this:
Code Block | ||||
---|---|---|---|---|
| ||||
/** *@brief Brief enum description * *@enum enum Name */ |
There are many tags you can use with HTML markup to create unique Doxygen documentation for a given file, class, method, or variable. The following are common tags that should be used when appropriate.
Code Block | ||||
---|---|---|---|---|
| ||||
/** *@note A brief remark about the implementation to help clarify. * *@attention An important remark that may cause code to break. * *@warning An import remark that may depend on random conditions etc. * *@see A reference to a class or a link to documentation (e.g. http://document.1a.com) */ |
Code Block | ||||
---|---|---|---|---|
| ||||
/** *@bug A remark about a known bug in the code. * *@todo A remark of what needs to be done to fix issues or remaining work. * */ |
Code Block | ||||
---|---|---|---|---|
| ||||
/** *@a Formats following word in special font (used for hyperlinks) * *@b Formats following word in bold * *@em Formats following word in italic * *@c Formats following word in monospaced typewriter font * */ |
Code Block | ||||
---|---|---|---|---|
| ||||
/** * - bulleted list item1 * - sub bulleted item1 * * - bulleted list item2 * */ |
Code Block | ||||
---|---|---|---|---|
| ||||
/** * -# numbered list item1 * -# numbered list item2 * */ |
Code Block | ||||
---|---|---|---|---|
| ||||
/** *@code i++; *@endcode */ |
Tools Required for Doxygen Documentation:
Code Block |
---|
Following Tools are need to be installed in Linux machine (through apt-get install) to generate documentation with respect to various data flow diagrams. $ sudo apt-get install "doxy*" $ sudo apt-get install graphviz $ sudo apt-get install dot $ sudo apt-get install mscgen $ sudo apt-get install perl |
Check the doxygen version by using command: $ doxygen --version
Graphviz: graphviz.org (Click the Download link on the left side of the page)