|
|
2 лет назад | |
|---|---|---|
| .. | ||
| dependencies | 2 лет назад | |
| README.md | 2 лет назад | |
| build.yml | 2 лет назад | |
| common.yml | 2 лет назад | |
| default-build-test-rules.yml | 2 лет назад | |
| deploy.yml | 2 лет назад | |
| docs.yml | 2 лет назад | |
| host-test.yml | 2 лет назад | |
| integration_test.yml | 2 лет назад | |
| pre_check.yml | 2 лет назад | |
| rules.yml | 2 лет назад | |
| static-code-analysis.yml | 2 лет назад | |
| target-test.yml | 2 лет назад | |
| upload_cache.yml | 2 лет назад | |
detached pipeline without pushing new commits?rules.yml?Job?Rules Template?if Anchor?tools/ci/utils.shdetached pipeline will be created.If you found a job that is not running as expected with some file changes, a git commit to improve the pattern will be appreciated.
target-test jobs, please use it as few as possible. Our final goal is to remove all the labels and let the file changes decide everything!buildbuild_docscomponent_ut[_esp32/esp32s2/...]custom_test[_esp32/esp32s2/...]dockerdocsdocs_full, triggers a full docs build, regardless of files changedexample_test[_esp32/esp32s2/...]fuzzer_testhost_testintegration_testiperf_stress_testmacosmacos_testnvs_coveragesubmodulewindowsThere are two general labels (not recommended since these two labels will trigger a lot of jobs)
target_test: includes all target for example_test, custom_test, component_ut, integration_testall_test: includes all test labelsdetached pipeline without pushing new commits?Go to MR web page -> Pipelines tab -> click Run pipeline button.
In very rare case, this tab will not show up because no merge_request pipeline is created before. Please use web API then.
curl -X POST --header "PRIVATE-TOKEN: [YOUR PERSONAL ACCESS TOKEN]" [GITLAB_SERVER]/api/v4/projects/103/merge_requests/[MERGE_REQUEST_IID]/pipelines
rules.yml?pattern: Defined in an array. A GitLab job will be created if the changed files in this MR matched one of the patterns. For example:
.patterns-python-files: &patterns-python-files
- "**/*.py"
label: Defined in an if clause, similar as the previous bot command. A GitLab job will be created if the pipeline variables contains variables in BOT_LABEL_xxx format (DEPRECATED) or included in the MR labels. For example:
.if-label-build_docs: &if-label-build_docs
if: '$BOT_LABEL_BUILD_DOCS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*build_docs(?:,[^,\n\r]+)*$/i'
rule: A combination of various patterns, and labels. It will be used by GitLab YAML extends keyword to tell GitLab in what conditions will this job be created. For example:
.rules:build:docs:
rules:
- <<: *if-protected
- <<: *if-label-build_docs
- <<: *if-label-docs
- <<: *if-dev-push
changes: *patterns-docs
An example for GitLab job on how to use extends:
```yaml
check_docs_lang_sync:
extends:
- .pre_check_template
- .rules:build:docs
script:
- cd docs
- ./check_lang_folder_sync.sh
```
Job?check if there's a suitable .rules:<rules-you-need> template
extends. All done, now you can close this window. (extends could be array or string)Rules Template?, create a suitable oneRules Template?check if this rule is related to labels, patterns
check if there's a suitable .if-<if-anchor-you-need> anchor
if there is, create a rule following rules Template Naming Rules.For detail information, please refer to GitLab Documentation rules-if. Here's an example.
.rules:patterns:python-files:
rules:
- <<: *if-protected
- <<: *if-dev-push
changes: *patterns-python-files
if there isn't
if Anchor?, create a suitable oneif Anchor?Create an if anchor following if Anchors Naming Rules. For detailed information about how to write the condition clause, please refer to GitLab Documentation `only/except (advanced). Here's an example.
.if-schedule: &if-schedule:
if: '$CI_PIPELINE_SOURCE == "schedule"'
if a phrase has multi words, use _ to concatenate them.
e.g.
regular_test
if a name has multi phrases, use - to concatenate them.
e.g.
regular_test-example_test
if Anchors Naming Rules.if-label-<label_name>.if-ref-<ref_name>.if-branch-<branch_name>.if-tag-<tag_name>.if-ref-<release_name>-branch-<branch_name>Common Phrases/Abbreviations
- `no_label`
`$BOT_TRIGGER_WITH_LABEL == null`
- `protected`
`($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)`
- `target_test`
a combination of `example_test`, `custom_test`, `component_ut`, `integration_test` and all targets
rules Template Naming Rules.rules:tag:<tag_1>-<tag_2>.rules:labels:<label_1>-<label_2>.rules:test:<test_type>.rules:build:<build_type>.rules:patterns:<patterns>tools/ci/utils.shIt is used to put all the reusable shell scripts as small functions. If you want to set before_script: [] for you job, now you can set extends: .before_script_slim instead. it will only run source tools/ci/utils.sh
If you're developing CI shell scripts, you can use these functions without source them. They're already included in all before_script
To run these commands in shell script locally, place source tools/ci/utils.sh at the very beginning.
add_gitlab_ssh_keysadd_github_ssh_keysadd_doc_server_ssh_keysfetch_submodulesget_all_submoduleserror: log in red colorwarning: log in orange colorinfo: log in green colorrun_cmd: run the command with duration seconds inforetry_failed: run the command with duration seconds info, retry when failed.build-test-rules.yml file is a manifest file to control if the CI is running the build and test job or not. The Supported Targets table in README.md for apps would be auto-generated by pre-commit from the app's .build-test-rules.yml.
We're using the latest version of idf-build-apps. Please refer to their documentation
In ESP-IDF CI, there's a few more special rules are additionally supported to disable the check app dependencies feature:
BUILD_AND_TEST_ALL_APPSIf you don't have access to the internal Minio server, you can still download the artifacts from the shared link in the job log.
The log will look like this:
Pipeline ID : 587355
Job name : build_clang_test_apps_esp32
Job ID : 40272275
Created archive file: 40272275.zip, uploading as 587355/build_dir_without_map_and_elf_files/build_clang_test_apps_esp32/40272275.zip
Please download the archive file includes build_dir_without_map_and_elf_files from [INTERNAL_URL]
Minio takes these env vars to connect to the server:
IDF_S3_SERVERIDF_S3_ACCESS_KEYIDF_S3_SECRET_KEYIDF_S3_BUCKETThe artifacts types and corresponding file patterns are defined in tools/ci/artifacts_handler.py, inside ArtifactType and TYPE_PATTERNS_DICT.
python tools/ci/artifacts_handler.py upload
will upload the files that match the file patterns to minio object storage with name:
<pipeline_id>/<artifact_type>/<job_name>/<job_id>.zip
For example, job 39043328 will upload these four files:
575500/map_and_elf_files/build_pytest_examples_esp32/39043328.zip575500/build_dir_without_map_and_elf_files/build_pytest_examples_esp32/39043328.zip575500/logs/build_pytest_examples_esp32/39043328.zip575500/size_reports/build_pytest_examples_esp32/39043328.zipYou may run
python tools/ci/artifacts_handler.py download --pipeline_id <pipeline_id>
to download all files of the pipeline, or
python tools/ci/artifacts_handler.py download --pipeline_id <pipeline_id> --job_name <job_name_or_pattern>
to download all files with the specified job name or pattern, or
python tools/ci/artifacts_handler.py download --pipeline_id <pipeline_id> --job_name <job_name_or_pattern> --type <artifact_type> <artifact_type> ...
to download all files with the specified job name or pattern and artifact type(s).
You may check all detailed documentation with python tools/ci/artifacts_handler.py download -h