-
Notifications
You must be signed in to change notification settings - Fork 1
Update cov_docker_script/README.md #26
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||
| **Generic, reusable build system enabling Coverity static analysis for any RDK-B component.** | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| [](https://github.com/rdkcentral/docker-rdk-ci) | ||||||||||||||||||||||||||||||||||||||||||||||
| [](https://github.com/rdkcentral/moca-agent/blob/feature/cov_native_build/.github/workflows/native-build.yml) | ||||||||||||||||||||||||||||||||||||||||||||||
| [](https://docs.github.com/en/actions) | ||||||||||||||||||||||||||||||||||||||||||||||
| [](https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -27,7 +27,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||
| - [CI/CD Integration](#cicd-integration) | ||||||||||||||||||||||||||||||||||||||||||||||
| - [GitHub Actions](#github-actions-integration) | ||||||||||||||||||||||||||||||||||||||||||||||
| - [Coverity Enablement](#coverity-enablement-flow) | ||||||||||||||||||||||||||||||||||||||||||||||
| - [Migration Guide](#migration-guide) | ||||||||||||||||||||||||||||||||||||||||||||||
| - [Component Adoption Guide](#component-adoption-guide) | ||||||||||||||||||||||||||||||||||||||||||||||
| - [Governance & Rules](#governance--rules) | ||||||||||||||||||||||||||||||||||||||||||||||
| - [References](#references) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -123,16 +123,30 @@ This build system provides a **standardized native build workflow** that enables | |||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ### Quick Start | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| **For existing components with `cov_docker_script` already integrated:** | ||||||||||||||||||||||||||||||||||||||||||||||
| **For components using wrapper scripts (recommended):** | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||
| # Navigate to component root | ||||||||||||||||||||||||||||||||||||||||||||||
| cd /path/to/your-component | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # Run complete build pipeline | ||||||||||||||||||||||||||||||||||||||||||||||
| ./cov_docker_script/common_external_build.sh | ||||||||||||||||||||||||||||||||||||||||||||||
| ./cov_docker_script/run_setup_dependencies.sh | ||||||||||||||||||||||||||||||||||||||||||||||
| ./cov_docker_script/run_native_build.sh | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # Clean build (removes previous artifacts) | ||||||||||||||||||||||||||||||||||||||||||||||
| CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh | ||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| **For components with build scripts directly committed (legacy):** | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||
| # Navigate to component root | ||||||||||||||||||||||||||||||||||||||||||||||
| cd /path/to/your-component | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # Run complete build pipeline | ||||||||||||||||||||||||||||||||||||||||||||||
| ./cov_docker_script/common_external_build.sh | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # Clean build | ||||||||||||||||||||||||||||||||||||||||||||||
| CLEAN_BUILD=true ./cov_docker_script/common_external_build.sh | ||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -247,22 +261,30 @@ cd your-component | |||||||||||||||||||||||||||||||||||||||||||||
| **Copy the directory structure from reference:** | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||
| # Example structure | ||||||||||||||||||||||||||||||||||||||||||||||
| # Recommended structure with wrapper scripts | ||||||||||||||||||||||||||||||||||||||||||||||
| your-component/ | ||||||||||||||||||||||||||||||||||||||||||||||
| ├── cov_docker_script/ | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── common_build_utils.sh # Utility functions | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── setup_dependencies.sh # Dependency setup | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── build_native.sh # Component build | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── common_external_build.sh # Orchestrator | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── component_config.json # Configuration | ||||||||||||||||||||||||||||||||||||||||||||||
| │ └── configure_options.conf # Build flags (optional) | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── component_config.json # Configuration (component-specific) | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── configure_options.conf # Build flags (optional, component-specific) | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── run_setup_dependencies.sh # Wrapper: Setup & run dependencies | ||||||||||||||||||||||||||||||||||||||||||||||
| │ ├── run_native_build.sh # Wrapper: Setup & build component | ||||||||||||||||||||||||||||||||||||||||||||||
| │ └── README.md # Component-specific documentation | ||||||||||||||||||||||||||||||||||||||||||||||
| ├── source/ | ||||||||||||||||||||||||||||||||||||||||||||||
| └── ... (component files) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # Note: The following scripts are automatically downloaded by wrapper scripts: | ||||||||||||||||||||||||||||||||||||||||||||||
| # - common_build_utils.sh | ||||||||||||||||||||||||||||||||||||||||||||||
| # - setup_dependencies.sh | ||||||||||||||||||||||||||||||||||||||||||||||
| # - build_native.sh | ||||||||||||||||||||||||||||||||||||||||||||||
| # - common_external_build.sh | ||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| **Reference:** [moca-agent/cov_docker_script](https://github.com/rdkcentral/moca-agent/blob/feature/cov_native_build/cov_docker_script) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| > ⚠️ **Important:** Scripts must remain unchanged. Only JSON/conf files are modifiable. | ||||||||||||||||||||||||||||||||||||||||||||||
| > ⚠️ **Important:** | ||||||||||||||||||||||||||||||||||||||||||||||
| > - **DO NOT** manually copy build scripts (they are auto-downloaded by wrapper scripts) | ||||||||||||||||||||||||||||||||||||||||||||||
| > - **DO** customize `component_config.json` and `configure_options.conf` | ||||||||||||||||||||||||||||||||||||||||||||||
| > - **DO** create wrapper scripts (`run_*.sh`) that fetch build tools automatically | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| #### Step 3: Configure Dependencies | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -330,6 +352,177 @@ ls -la $HOME/usr/local/lib/ | |||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ### Component Wrapper Scripts (Recommended Approach) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| **Components should use wrapper scripts that automatically fetch build tools from this repository.** | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| #### Why Use Wrapper Scripts? | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| | Benefit | Description | | ||||||||||||||||||||||||||||||||||||||||||||||
| |---------|-------------| | ||||||||||||||||||||||||||||||||||||||||||||||
| | 🔄 **Always Up-to-Date** | Fetches latest scripts from build_tools_workflows | | ||||||||||||||||||||||||||||||||||||||||||||||
| | 📦 **No Script Duplication** | Avoids committing build scripts to component repos | | ||||||||||||||||||||||||||||||||||||||||||||||
| | 🛡️ **Consistent Versions** | All components use same build logic | | ||||||||||||||||||||||||||||||||||||||||||||||
| | 🔧 **Easy Maintenance** | Script updates propagate automatically | | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| #### Wrapper Script Template | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| **run_setup_dependencies.sh** - Sets up build tools and runs dependency setup: | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||||||||||||||||||||||||||||||||||||||||||||
| NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" | ||||||||||||||||||||||||||||||||||||||||||||||
| BUILD_TOOLS_REPO_URL="https://github.com/rdkcentral/build_tools_workflows" | ||||||||||||||||||||||||||||||||||||||||||||||
| BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" | ||||||||||||||||||||||||||||||||||||||||||||||
| REQUIRED_SCRIPTS=("build_native.sh" "common_build_utils.sh" "common_external_build.sh" "setup_dependencies.sh") | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # Basic logging | ||||||||||||||||||||||||||||||||||||||||||||||
| log() { echo "[INFO] $*"; } | ||||||||||||||||||||||||||||||||||||||||||||||
| ok() { echo "[OK] $*"; } | ||||||||||||||||||||||||||||||||||||||||||||||
| err() { echo "[ERROR] $*" >&2; } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "===== Setup Dependencies Pipeline =====" | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # Clone build_tools_workflows | ||||||||||||||||||||||||||||||||||||||||||||||
| if [[ -d "$BUILD_TOOLS_DIR" ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||
| log "build_tools_workflows already exists, skipping clone" | ||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||
| log "Cloning build_tools_workflows (develop)" | ||||||||||||||||||||||||||||||||||||||||||||||
| cd "$NATIVE_COMPONENT_DIR" | ||||||||||||||||||||||||||||||||||||||||||||||
| git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } | |
| if ! clone_output=$(git clone -b develop "$BUILD_TOOLS_REPO_URL" 2>&1); then | |
| status=$? | |
| if echo "$clone_output" | grep -qiE 'authentication failed|permission denied|access denied'; then | |
| err "Clone failed: authentication error while accessing '$BUILD_TOOLS_REPO_URL'." | |
| err "Ensure you have the correct credentials/SSH keys and access to the repository." | |
| elif echo "$clone_output" | grep -qiE 'not found|repository .* does not exist'; then | |
| err "Clone failed: repository not found for '$BUILD_TOOLS_REPO_URL' (branch: develop)." | |
| err "Verify that the URL and branch name are correct and that the repository exists." | |
| elif echo "$clone_output" | grep -qiE 'could not resolve host|failed to connect|network is unreachable'; then | |
| err "Clone failed: network error while trying to reach '$BUILD_TOOLS_REPO_URL'." | |
| err "Check your network connectivity and DNS settings." | |
| else | |
| err "Clone failed with exit code $status. git output:" | |
| err "$clone_output" | |
| fi | |
| exit 1 | |
| fi |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clone command uses -b develop flag to specify the branch, but the repository URL doesn't verify if the 'develop' branch exists. If the develop branch doesn't exist in the build_tools_workflows repository, this command will fail. Consider adding a fallback to 'main' or 'master' branch, or making the branch configurable via an environment variable.
| log "Cloning build_tools_workflows (develop)" | |
| cd "$NATIVE_COMPONENT_DIR" | |
| git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } | |
| ok "Repository cloned" | |
| : "${BUILD_TOOLS_BRANCH:=develop}" | |
| log "Cloning build_tools_workflows (branch: $BUILD_TOOLS_BRANCH)" | |
| cd "$NATIVE_COMPONENT_DIR" | |
| if git clone -b "$BUILD_TOOLS_BRANCH" "$BUILD_TOOLS_REPO_URL"; then | |
| ok "Repository cloned (branch: $BUILD_TOOLS_BRANCH)" | |
| else | |
| log "Branch '$BUILD_TOOLS_BRANCH' not available, attempting fallbacks ('main', then 'master')" | |
| if git ls-remote --exit-code --heads "$BUILD_TOOLS_REPO_URL" main >/dev/null 2>&1 && \ | |
| git clone -b main "$BUILD_TOOLS_REPO_URL"; then | |
| ok "Repository cloned (branch: main)" | |
| elif git ls-remote --exit-code --heads "$BUILD_TOOLS_REPO_URL" master >/dev/null 2>&1 && \ | |
| git clone -b master "$BUILD_TOOLS_REPO_URL"; then | |
| ok "Repository cloned (branch: master)" | |
| else | |
| err "Clone failed: branches '$BUILD_TOOLS_BRANCH', 'main', and 'master' are not available" | |
| exit 1 | |
| fi | |
| fi |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The run_setup_dependencies.sh wrapper script doesn't handle the case where build_tools_workflows exists but might be outdated or corrupted. Consider adding a check to verify the repository state or an option to force re-clone. Currently, it only skips cloning if the directory exists, which could lead to using stale or incomplete build tools.
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security concern: The wrapper script clones from a hardcoded GitHub URL without verifying the integrity of the downloaded scripts before executing them. An attacker who gains control of the build_tools_workflows repository or performs a man-in-the-middle attack could inject malicious code. Consider adding verification steps such as checking commit signatures, verifying checksums, or pinning to a specific commit hash instead of the 'develop' branch.
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cleanup operation uses rm -rf on a directory path constructed from variables. If any of the path components (NATIVE_COMPONENT_DIR or BUILD_TOOLS_DIR) are empty or incorrectly set, this could potentially delete unintended files. Consider adding a safety check to ensure BUILD_TOOLS_DIR is not empty and points to a valid subdirectory before deletion.
| rm -rf "$BUILD_TOOLS_DIR" | |
| ok "Cleanup completed" | |
| if [[ -n "$BUILD_TOOLS_DIR" && -d "$BUILD_TOOLS_DIR" ]]; then | |
| rm -rf "$BUILD_TOOLS_DIR" | |
| ok "Cleanup completed" | |
| else | |
| err "Skipping cleanup: BUILD_TOOLS_DIR is not set or not a directory: '$BUILD_TOOLS_DIR'" | |
| fi |
Outdated
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reference link points to a specific branch 'feature/cov_native_build' which may be temporary. If this is a feature branch that will be merged or deleted, the link will become broken. Consider updating the reference to point to the main/master branch once the feature is merged, or documenting that this is a temporary reference.
| See [moca-agent/cov_docker_script](https://github.com/rdkcentral/moca-agent/tree/feature/cov_native_build/cov_docker_script) for a complete working example. | |
| See [moca-agent/cov_docker_script](https://github.com/rdkcentral/moca-agent/tree/main/cov_docker_script) for a complete working example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reference link points to a specific branch 'feature/cov_native_build' which may be temporary. If this is a feature branch that will be merged or deleted, the link will become broken. Consider updating the reference to point to the main/master branch once the feature is merged, or documenting that this is a temporary reference.