Skip to content

Commit 6ff6d7a

Browse files
committed
ci: backport master changes to 6.0
1 parent 5ecafbf commit 6ff6d7a

File tree

14 files changed

+126
-1342
lines changed

14 files changed

+126
-1342
lines changed

.gitlab-ci.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
workflow:
2-
rules:
3-
# Disable those non-protected push triggered pipelines
4-
- if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_COMMIT_TAG !~ /^qa-test/ && $CI_PIPELINE_SOURCE == "push"'
5-
when: never
6-
# merged result pipelines
7-
- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
8-
variables:
9-
PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
10-
# else
11-
- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA == null || $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA == ""
12-
variables:
13-
PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA
14-
- when: always
15-
161
# Place the default settings in `.gitlab/ci/common.yml` instead
172

183
include:
4+
- project: "ci/actions/common"
5+
file:
6+
- "templates/stable/default-workflow.yml"
7+
- "templates/idf/deploy-github.yml"
8+
- "templates/idf/deploy-docs.yml"
199
- ".gitlab/ci/danger.yml"
2010
- ".gitlab/ci/common.yml"
2111
- ".gitlab/ci/rules.yml"

.gitlab/ci/build.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.build_template:
22
stage: build
33
extends:
4-
- .before_script:build
54
- .after_script:build
65
image: $ESP_ENV_IMAGE
76
tags: [build, shiny]
@@ -155,21 +154,17 @@ build_child_pipeline:
155154
job: generate_build_child_pipeline
156155
strategy: depend
157156

158-
generate_disabled_apps_report:
157+
generate_prebuild_report:
159158
extends:
160159
- .build_template
161160
tags: [fast_run, shiny]
162-
dependencies: # set dependencies to null to avoid missing artifacts issue
163161
needs:
164162
- pipeline_variables
165-
- job: baseline_manifest_sha
166-
optional: true
167163
artifacts:
168164
paths:
169-
- disabled_report.html
165+
- prebuild_report.html
170166
expire_in: 1 week
171167
when: always
172168
script:
173-
- pip install dominate idf-build-apps
174-
- run_cmd python tools/ci/gen_disabled_report.py --output disabled_report.html --verbose --enable-preview-targets
175-
- echo "Report generated at https://${CI_PAGES_HOSTNAME}:${CI_SERVER_PORT}/-/esp-idf/-/jobs/${CI_JOB_ID}/artifacts/disabled_report.html"
169+
- run_cmd idf-ci build collect --format html -o prebuild_report.html
170+
- echo "Report generated at https://${CI_PAGES_HOSTNAME}:${CI_SERVER_PORT}/-/esp-idf/-/jobs/${CI_JOB_ID}/artifacts/prebuild_report.html"

.gitlab/ci/common.yml

Lines changed: 4 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ variables:
3434
# since we're using merged-result pipelines, the last commit should work for most cases
3535
# --prune --prune-tags: in case remote branch or tag is force pushed
3636
GIT_FETCH_EXTRA_FLAGS: "--no-recurse-submodules --prune --prune-tags"
37-
# we're using .cache folder for caches
38-
GIT_CLEAN_FLAGS: -ffdx -e .cache/
37+
3938
LATEST_GIT_TAG: v6.0-rc1
4039

4140
SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
@@ -168,9 +167,6 @@ variables:
168167
# Done after sourcing export.sh so that we could easily invoke the right pip
169168
section_start "upgrade_ci_dependencies" "Upgrading CI dependencies"
170169
pip install --upgrade --upgrade-strategy=eager -r $IDF_PATH/tools/requirements/requirements.ci.txt -c ~/.espressif/${CI_PYTHON_CONSTRAINT_FILE}
171-
if [[ "${CI_JOB_STAGE}" == "target_test" ]]; then
172-
pip install --upgrade --upgrade-strategy=eager -r $IDF_PATH/tools/requirements/requirements.test-specific.txt -c ~/.espressif/${CI_PYTHON_CONSTRAINT_FILE}
173-
fi
174170
section_end "upgrade_ci_dependencies"
175171

176172
REEXPORT_NEEDED=0
@@ -245,155 +241,20 @@ variables:
245241
before_script:
246242
- *common-before_scripts
247243

248-
.before_script:build:
249-
before_script:
250-
- *common-before_scripts
251-
- *setup_tools_and_idf_python_venv
252-
- add_gitlab_ssh_keys
253-
- fetch_submodules
254-
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
255-
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}
256-
257244
.after_script:build:
258245
after_script:
259246
- source tools/ci/utils.sh
260247
- *show_ccache_statistics
261248
- *upload_failed_job_log_artifacts
262249

263-
##############################
264-
# Git Strategy Job Templates #
265-
##############################
266-
.git_init: &git_init |
267-
mkdir -p "${CI_PROJECT_DIR}"
268-
cd "${CI_PROJECT_DIR}"
269-
git init
270-
271-
.git_fetch_from_mirror_url_if_exists: &git_fetch_from_mirror_url_if_exists |
272-
# check if set mirror
273-
if [ -n "${LOCAL_GITLAB_HTTPS_HOST:-}" ] && [ -n "${ESPCI_TOKEN:-}" ]; then
274-
MIRROR_REPO_URL="https://bot:${ESPCI_TOKEN}@${LOCAL_GITLAB_HTTPS_HOST}/${CI_PROJECT_PATH}"
275-
elif [ -n "${LOCAL_GIT_MIRROR:-}" ]; then
276-
MIRROR_REPO_URL="${LOCAL_GIT_MIRROR}/${CI_PROJECT_PATH}"
277-
fi
278-
279-
# fetch from mirror first if set
280-
if [ -n "${MIRROR_REPO_URL:-}" ]; then
281-
if git remote -v | grep origin; then
282-
git remote set-url origin "${MIRROR_REPO_URL}"
283-
else
284-
git remote add origin "${MIRROR_REPO_URL}"
285-
fi
286-
# mirror url may fail with authentication issue
287-
git fetch origin --no-recurse-submodules || true
288-
fi
289-
290-
# set remote url to CI_REPOSITORY_URL
291-
if git remote -v | grep origin; then
292-
git remote set-url origin "${CI_REPOSITORY_URL}"
293-
else
294-
git remote add origin "${CI_REPOSITORY_URL}"
295-
fi
296-
297-
.git_checkout_ci_commit_sha: &git_checkout_ci_commit_sha |
298-
git checkout $CI_COMMIT_SHA
299-
eval "git clean ${GIT_CLEAN_FLAGS}"
300-
301-
# git diff requires two commits, with different CI env var
302-
#
303-
# By default, we use git strategy "clone" with depth 1 to speed up the clone process.
304-
# But for jobs requires running `git diff`, we need to fetch more commits to get the correct diffs.
305-
#
306-
# Since there's no way to get the correct git_depth before the job starts,
307-
# we can't set `GIT_DEPTH` in the job definition.
308-
#
309-
# Set git strategy to "none" and fetch manually instead.
310-
.before_script:fetch:git_diff:
311-
variables:
312-
GIT_STRATEGY: none
313-
before_script:
314-
- *git_init
315-
- *git_fetch_from_mirror_url_if_exists
316-
- |
317-
# Store the diff output in a temporary file
318-
TEMP_FILE=$(mktemp)
319-
# merged results pipelines, by default
320-
if [[ -n $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA ]]; then
321-
git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_SHA
322-
git fetch origin $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
323-
324-
git diff --name-only $CI_MERGE_REQUEST_TARGET_BRANCH_SHA...$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA > "$TEMP_FILE"
325-
GIT_DIFF_OUTPUT=$(cat "$TEMP_FILE")
326-
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
327-
# merge request pipelines, when the mr got conflicts
328-
elif [[ -n $CI_MERGE_REQUEST_DIFF_BASE_SHA ]]; then
329-
git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
330-
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
331-
git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA > "$TEMP_FILE"
332-
GIT_DIFF_OUTPUT=$(cat "$TEMP_FILE")
333-
# other pipelines, like the protected branches pipelines
334-
elif [[ "$CI_COMMIT_BEFORE_SHA" != "0000000000000000000000000000000000000000" ]]; then
335-
git fetch origin $CI_COMMIT_BEFORE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
336-
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
337-
git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA > "$TEMP_FILE"
338-
GIT_DIFF_OUTPUT=$(cat "$TEMP_FILE")
339-
else
340-
# pipeline source could be web, scheduler, etc.
341-
git fetch origin $CI_COMMIT_SHA --depth=2 ${GIT_FETCH_EXTRA_FLAGS}
342-
git diff --name-only $CI_COMMIT_SHA~1 $CI_COMMIT_SHA > "$TEMP_FILE"
343-
GIT_DIFF_OUTPUT=$(cat "$TEMP_FILE")
344-
fi
345-
- *git_checkout_ci_commit_sha
346-
- *common-before_scripts
347-
- *setup_tools_and_idf_python_venv
348-
- add_gitlab_ssh_keys
349-
350-
# target test runners may locate in different places
351-
# for runners set git mirror, we fetch from the mirror first, then fetch the HEAD commit
352-
.before_script:fetch:target_test:
353-
variables:
354-
GIT_STRATEGY: none
355-
before_script:
356-
- *git_init
357-
- *git_fetch_from_mirror_url_if_exists
358-
- eval "git fetch --depth=1 ${GIT_FETCH_EXTRA_FLAGS} origin ${CI_COMMIT_SHA}"
359-
- *git_checkout_ci_commit_sha
360-
- *common-before_scripts
361-
- *setup_tools_and_idf_python_venv
362-
- add_gitlab_ssh_keys
363-
# no submodules
364-
365250
.brew-macos-settings:
366251
variables:
367-
GIT_STRATEGY: none # we do manual git clone to use local mirror
252+
GIT_STRATEGY: fetch
368253
IDF_CCACHE_ENABLE: "0"
369254
CCACHE_DIR: "/var/tmp/cache/idf_ccache"
370255
tags:
371256
- macos-tart
372257
image: macos-sequoia-idf-v6.0
373-
cache: [] # pip cache is created under amd64, and submodules are downloaded with brew mirror, so disable cache here
374-
before_script:
375-
# assert LOCAL_GIT_MIRROR is set
376-
- echo -e "section_start:`date +%s`:check_out\r\e[0Kchecking out from local git mirror, then reset to CI_COMMIT_SHA"
377-
- |
378-
if [ -z "${LOCAL_GIT_MIRROR:-}" ]; then
379-
echo "Error: LOCAL_GIT_MIRROR not set, cannot clone from mirror."
380-
exit 1
381-
fi
382-
- MIRROR_REPO_URL="${LOCAL_GIT_MIRROR}/${CI_PROJECT_PATH}"
383-
- cd "${CI_PROJECT_DIR}"
384-
# since .cache exists in CI_PROJECT_DIR, so can't direct `git clone .`
385-
- git clone -b ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_COMMIT_BRANCH}} --depth=1 --recursive --shallow-submodules "${MIRROR_REPO_URL}" tmp
386-
- mv tmp/.git ./
387-
- rm -rf tmp
388-
- git reset --hard
389-
# set remote url back
390-
- git remote set-url origin "${CI_REPOSITORY_URL}"
391-
- eval "git fetch --depth=1 ${GIT_FETCH_EXTRA_FLAGS} origin ${CI_COMMIT_SHA}"
392-
- git checkout FETCH_HEAD
393-
- git submodule update --init --recursive --depth=1
394-
- echo -e "section_end:`date +%s`:check_out\r\e[0K"
395-
- *common-before_scripts
396-
- *setup_tools_and_idf_python_venv
397258
after_script: [] # ccache now is disabled for macos brew runners
398259
timeout: 30m
399260

@@ -421,16 +282,5 @@ default:
421282
- *setup_tools_and_idf_python_venv
422283
- add_gitlab_ssh_keys
423284
- fetch_submodules
424-
# gitlab bug, setting them here doesn't work
425-
# - expire_in: https://gitlab.com/gitlab-org/gitlab/-/issues/404563
426-
# - when: https://gitlab.com/gitlab-org/gitlab/-/issues/440672
427-
# artifacts:
428-
# expire_in: 1 week
429-
# when: always
430-
retry:
431-
max: 2
432-
when:
433-
# In case of a runner failure we could hop to another one, or a network error could go away.
434-
- runner_system_failure
435-
# Job execution timeout may be caused by a network issue.
436-
- job_execution_timeout
285+
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
286+
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}

.gitlab/ci/deploy.yml

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,6 @@
33
image: $ESP_ENV_IMAGE
44
tags: [ deploy ]
55

6-
check_submodule_sync:
7-
extends:
8-
- .deploy_job_template
9-
- .rules:test:submodule
10-
stage: test_deploy
11-
tags: [ brew, github_sync ]
12-
retry: 2
13-
variables:
14-
GIT_STRATEGY: fetch # use brew local mirror first
15-
SUBMODULES_TO_FETCH: "none"
16-
PUBLIC_IDF_URL: "https://github.com/espressif/esp-idf.git"
17-
dependencies: []
18-
script:
19-
- git submodule deinit --force .
20-
- rm -rf .git/modules # remove all the cached metadata
21-
# setting the default remote URL to the public one, to resolve relative location URLs
22-
- git config remote.origin.url ${PUBLIC_IDF_URL}
23-
# check if all submodules are correctly synced to public repository
24-
- git submodule init
25-
- git config --get-regexp '^submodule\..*\.url$' || true
26-
- git submodule update --recursive
27-
- echo "IDF was cloned from ${PUBLIC_IDF_URL} completely"
28-
29-
push_to_github:
30-
extends:
31-
- .deploy_job_template
32-
- .before_script:minimal
33-
- .rules:protected:deploy
34-
needs:
35-
# submodule must be synced before pushing to github
36-
- check_submodule_sync
37-
tags: [ brew, github_sync ]
38-
variables:
39-
GIT_STRATEGY: fetch # use brew local mirror first
40-
GIT_DEPTH: 0 # github needs full record of commits
41-
script:
42-
- add_github_ssh_keys
43-
- git remote remove github &>/dev/null || true
44-
- git remote add github git@github.com:espressif/esp-idf.git
45-
- tools/ci/push_to_github.sh
46-
environment:
47-
name: push_to_github_production
48-
deployment_tier: production
49-
url: "https://github.com/espressif/esp-idf"
50-
516
deploy_update_SHA_in_esp-dockerfiles:
527
extends:
538
- .deploy_job_template
@@ -64,21 +19,3 @@ deploy_update_SHA_in_esp-dockerfiles:
6419
environment:
6520
name: deploy_update_SHA_in_esp-dockerfiles_production
6621
deployment_tier: production
67-
68-
upload_junit_report:
69-
extends:
70-
- .deploy_job_template
71-
tags: [ fast_run, shiny ]
72-
needs:
73-
- pipeline_variables
74-
- job: build_child_pipeline
75-
artifacts: false
76-
script:
77-
- run_cmd idf-ci gitlab download-artifacts --type junit
78-
rules:
79-
- when: always
80-
artifacts:
81-
reports:
82-
junit: XUNIT_RESULT_*.xml
83-
expire_in: 1 week
84-
when: always

0 commit comments

Comments
 (0)