Pipeline Configuration
Pipeline Configuration
EmbedOps images that execute the pipeline stages (e.g. build, quality, test) use CI/CD provider repository variables, environment variables and settings from EmbedOps YAML Config files.
In general, any setting that is required for a given pipeline stage to function properly will be included in your pipeline YAML template when configuring your pipeline in the EmbedOps Web UI or communicated to you directly when your project is onboarded to the platform.
What Is An EmbedOps YAML Config File?
EmbedOps YAML Config files are YAML files that are distinct from pipeline YAML files (e.g. .gitlab-ci.yml
, bitbucket-pipelines.yml
). EmbedOps YAML Config files contain configuration settings that are available across all CI/CD pipeline stages. There is one main EmbedOps YAML Config file and other EmbedOps YAML Config files that configure specific EmbedOps docker images for pipeline stages such as cppcheck
.
All EmbedOps YAML Config files must exist under the .embedops/
directory in the root of the project repository.
EmbedOps Main YAML Config
Each EmbedOps pipeline stage inspects the EmbedOps Main YAML Config file for settings and pipeline environment variable overrides. Any setting that exists in this config file is, essentially, an override to a repository or pipeline environment variable, but can include custom variables needed for project-specific use cases. The EmbedOps Main YAML Config file must exist at <repo_root>/.embedops/config.yml
.
Built-In Variables
Some of the variables outlined in the table, below, are not typically seen in CI/CD providers such as Bitbucket or Gitlab, but are useful in embedded systems projects. These variables can be set as repository or pipeline environment variables depending on the desired scope of the variable, and come with hard-coded defaults if not defined as a repository, environment or EmbedOps Main YAML Config variable.
Variable | Default Value on Bitbucket | Default Value on Gitlab |
PROJECT_NAME |
$BITBUCKET_PROJECT_KEY |
$CI_PROJECT_NAME |
PREPROCESSOR_SYMBOL |
STM32L476xx |
STM32L476xx |
SRC_DIR |
src |
src |
Variable Definition And Override Precedence
For each configuration setting, there are several ways to define and override them. Most CI/CD pipeline providers have their own methods for defining environment variables that get injected to the pipeline run-time environment such as repository, pipeline, group, deployment, etc. variables and they also have their own order of precedence with regards to how one overrides the other.
For EmbedOps YAML Config files, the order of precedence from highest to lowest for these variables is as follows:
- Settings in the EmbedOps YAML Config file (
<repo_root>/.embedops/config.yml
) - Any repository or pipeline environment variable
- Hardcoded defaults
Example A
Variable Scope | Variable | Value | Behavior |
Repository | SRC_DIR |
foo |
Variable visible by all pipeline stages |
Pipeline | SRC_DIR |
fie |
Overrides repository variable |
Main Config | SRC_DIR |
foe |
Overrides pipeline variable |
Result | SRC_DIR |
foe |
Final value when pipeline is executed |
Example B
Variable Scope | Variable | Value | Behavior |
Repository | SRC_DIR |
foo |
Variable visible by all pipeline stages |
Pipeline | SRC_DIR |
fie |
Overrides repository variable |
Main Config | Not specified | Nothing overridden | |
Result | SRC_DIR |
fie |
Final value when pipeline is executed |
Example C
Variable Scope | Variable | Value | Behavior |
Repository | Not specified | |
|
Pipeline | Not specified | |
|
Main Config | SRC_DIR |
fie |
First occurrence of variable, nothing to override |
Result | SRC_DIR |
fie |
Final value when pipeline is executed |
Example Main Config File
# <repo_root>/.embedops/config.yml
---
PROJECT_NAME: ExampleProject
PREPROCESSOR_SYMBOL: STM32L476xx
SRC_DIR: embedded_src
Expansion Variables in YAML Config Files
If present, any GNU Shell/Bash style variable present in any <repo_root>/.embedops/**/config.yml
file will be replaced with the corresponding value.
For example, if you have a repository variable MY_PROJECT_VARIABLE = abc123
and <repo_root>/.embedops/config.yml
file with:
# <repo_root>/.embedops/config.yml
---
PROJECT_NAME: $MY_PROJECT_VARIABLE
The PROJECT_NAME
for all pipeline stages will be abc123
.
EmbedOps Cppcheck YAML Config
EmbedOps will parse the file <repo_root>/.embedops/cppcheck/config.yml
and run cppcheck
according to these settings. Then the results of the cppcheck
analysis will be printed to the pipeline console.
Variable | Default | YAML Type | Description |
CPPCHECK_OUTPUT_DIR |
cppcheckReport |
string | directory used for cppcheck reports |
CPPCHECK_JOB_NAME |
cppcheck-2.8 |
string | The embedops job name for reporting purposes. |
CPPCHECK_INCLUDES |
src/main.c |
list | cppcheck include paths ( -I ). Ignored if CPPCHECK_CMAKE_TARGETS is set. |
CPPCHECK_CMAKE_TARGETS |
N/A | list | cppcheck include paths ( -I ) grabbed from CMake. Takes precedence over CPPCHECK_INCLUDES .Each target requires an ARGS field that specifies what arguments to pass to CMake and a BUILD_DIR field that specifies where the files that CMake generated are located. Example: CPPCHECK_CMAKE_TARGETS: - ARGS: -B build/stm/debug -DCMAKE_TOOLCHAIN_FILE=toolchain/cross/stm32l152xc.cmake -DCMAKE_BUILD_TYPE=Debug . BUILD_DIR: build/stm/debug<br> |
CPPCHECK_RELATIVE_PATHS |
N/A |
list | cppcheck relative directory paths ( -rp/--relative-paths ) |
CPPCHECK_SUPRESSES |
N/A |
list | cppcheck messages to supress ( --supress ) |
CPPCHECK_INFORMATION_THRESHOLD |
10 |
integer | cppcheck info message threshold. If this threshold is exceeded, the pipeline stage will result in a failure. |
CPPCHECK_PORTABILITY_THRESHOLD |
10 |
integer | cppcheck portability message threshold. If this threshold is exceeded, the pipeline stage will result in a failure. |
CPPCHECK_PERFORMANCE_THRESHOLD |
10 |
integer | cppcheck performance message threshold. If this threshold is exceeded, the pipeline stage will result in a failure. |
CPPCHECK_STYLE_THRESHOLD |
10 |
integer | cppcheck style message threshold. If this threshold is exceeded, the pipeline stage will result in a failure. |
CPPCHECK_WARNINGS_THRESHOLD |
10 |
integer | cppcheck warning message threshold. If this threshold is exceeded, the pipeline stage will result in a failure. |
CPPCHECK_ERRORS_THRESHOLD |
10 |
integer | cppcheck error message threshold. If this threshold is exceeded, the pipeline stage will result in a failure. |
Example Cppcheck Config File
# <repo_root>/.embedops/cppcheck/config.yml
---
CPPCHECK_JOB_NAME: cppcheck-2.8
CPPCHECK_INFORMATION_THRESHOLD: 5
CPPCHECK_PORTABILITY_THRESHOLD: 0
CPPCHECK_PERFORMANCE_THRESHOLD: 0
CPPCHECK_STYLE_THRESHOLD: 120
CPPCHECK_WARNINGS_THRESHOLD: 2
CPPCHECK_ERRORS_THRESHOLD: 1
CPPCHECK_OUTPUT_DIR: cppcheckReport
CPPCHECK_RELATIVE_PATHS:
- ${SRC_DIR}/Src
- ${SRC_DIR}/tests
CPPCHECK_INCLUDES:
- ${SRC_DIR}/Include
- ${SRC_DIR}/LoRaWAN/Inc
- ${SRC_DIR}/FreeRTOS
- ${SRC_DIR}/FreeRTOS/Source/include
CPPCHECK_SUPRESSES:
- unusedFunction
- preprocessorErrorDirective:${SRC_DIR}/Src/main.h:31
EmbedOps Googletest YAML Config
EmbedOps will parse the file <repo_root>/.embedops/googletest/config.yml
and run the tests according to these settings. Then the test results will be printed to the pipeline console.
Variable | Default | YAML Type | Description |
GOOGLETEST_JOB_NAME |
googletest |
string | The embedops job name for reporting purposes. |
GOOGLETEST_DIRECTORY |
. |
string | The working directory required for tests to run. The GOOGLETEST_COMMAND will be run from this directory relative the the <repo_root> directory. |
GOOGLETEST_BUILD_COMMAND |
test/run.sh |
string | The command to use for building and/or running the googletest binary. |
Example Googletest Config File
# <repo_root>/.embedops/googletest/config.yml
---
GOOGLETEST_JOB_NAME: ${EMBEDOPS_JOB_NAME}
GOOGLETEST_BUILD_COMMAND: test/build_and_test.sh
GOOGLETEST_DIRECTORY: src
EmbedOps IAR YAML Config
EmbedOps will parse the file <repo_root>/.embedops/iar/config.yml
and configure IAR tools according to these settings.
Variable | Default | YAML Type | Description |
IAR_BUILD_TARGETS |
N/A | list | All targets specified in this list will be built with the iarbuild command in the order provided.Each item in the list is a YAML mapping that specifies an IAR project file and a configuration in that project file.Example: |
IAR_BUILD_TARGETS:
- PROJECT_FILE: arm/componentA.ewp
CONFIGURATION: Debug
Example IAR Config File
# <repo_root>/.embedops/iar/config.yml
---
IAR_BUILD_TARGETS:
- PROJECT_FILE: arm/componentA.ewp
CONFIGURATION: Debug
EmbedOps Administrative YAML Configs
Administrative configs are intended solely for EmbedOps usage. These configs should never be edited by EmbedOps users unless instructed to do so by an EmbedOps Admin.
Repository Identifier
File Path | Variable | Default | YAML Type | Description |
<repo_root>/.embedops/repo_id.yml |
REPO_ID |
N/A | string-uuid |
Unique identifier for code repository. |