From 2afba05e3e77261c687d4bd62071e81d54131981 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Sat, 4 Dec 2021 13:23:09 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[Bug][Build]:=20fix=20the=20file=20not=20fo?= =?UTF-8?q?und=20issue=20caused=20by=20the=20relative=20pat=E2=80=A6=20(#9?= =?UTF-8?q?443)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the nodesource.list cannot read issue, it is cased by the full path not used. ``` 2021-12-03T06:59:26.0019306Z Removing intermediate container 77cfe980cd36 2021-12-03T06:59:26.0020872Z ---> 528fd40e60f6 2021-12-03T06:59:26.0021457Z Step 81/81 : RUN post_run_buildinfo 2021-12-03T06:59:26.0841136Z ---> Running in d804bd7e1b06 2021-12-03T06:59:29.1626594Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. 2021-12-03T06:59:34.2960105Z /usr/bin/sed: can't read nodesource.list: No such file or directory 2021-12-03T06:59:34.5094880Z The command '/bin/sh -c post_run_buildinfo' returned a non-zero code: 2 ``` Co-authored-by: Ubuntu --- .azure-pipelines/docker-sonic-slave.yml | 1 + src/sonic-build-hooks/scripts/buildinfo_base.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/docker-sonic-slave.yml b/.azure-pipelines/docker-sonic-slave.yml index 2ea217bb8f34..22f793ab1ff7 100644 --- a/.azure-pipelines/docker-sonic-slave.yml +++ b/.azure-pipelines/docker-sonic-slave.yml @@ -22,6 +22,7 @@ pr: - sonic-slave-jessie - sonic-slave-stretch - sonic-slave-buster + - src/sonic-build-hooks parameters: - name: 'arches' diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index a6b5e0855e18..ddeadc508d54 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -71,7 +71,7 @@ set_reproducible_mirrors() expression="s/^deb.*$REPR_MIRROR_URL_PATTERN/#\0/" fi - local mirrors="/etc/apt/sources.list $(ls /etc/apt/sources.list.d/)" + local mirrors="/etc/apt/sources.list $(find /etc/apt/sources.list.d/ -type f)" for mirror in $mirrors; do sed -i "$expression" "$mirror" done From 82bcd589c1346b6c186f725e55f50ef3783afeca Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Wed, 13 Apr 2022 11:40:06 +0800 Subject: [PATCH 2/4] [Build]: Fix pip version constraint conflict issue (#10525) Why I did it [Build]: Fix pip version constraint conflict issue When a version is specified in the constraint file, if upgrading the version in build script, it will have conflict issue. How I did it If a specified version has specified in pip command line, then the version constraint will be skipped. --- src/sonic-build-hooks/scripts/buildinfo_base.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index ddeadc508d54..593e5752e06f 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -163,6 +163,10 @@ run_pip_command() elif [[ "$para" == *.whl ]]; then package_name=$(echo $para | cut -d- -f1 | tr _ .) sed "/^${package_name}==/d" -i $tmp_version_file + elif [[ "$para" == *==* ]]; then + # fix pip package constraint conflict issue + package_name=$(echo $para | cut -d= -f1) + sed "/^${package_name}==/d" -i $tmp_version_file fi done From 61ea2c2a33f1f80f02d72e9a8141233026d0b18c Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Tue, 22 Mar 2022 21:57:15 -0700 Subject: [PATCH 3/4] Check to see that the py2 and py3 version files exist before trying to sort them (#10325) For Bullseye, Python 2 isn't present at all. This means that in certain build cases (such as building something only for Bullseye), the version file may not exist, and so the sort command would fail. For most normal build commands, this probably won't be an issue, because the SONiC build will start with Buster (which has both Python 2 and Python 3 wheels built), and so the py2 and py3 files will be present even during the Bullseye builds. Signed-off-by: Saikrishna Arcot --- src/sonic-build-hooks/scripts/collect_version_files | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sonic-build-hooks/scripts/collect_version_files b/src/sonic-build-hooks/scripts/collect_version_files index 570883701e98..a4b33eeaa897 100755 --- a/src/sonic-build-hooks/scripts/collect_version_files +++ b/src/sonic-build-hooks/scripts/collect_version_files @@ -20,7 +20,11 @@ dpkg-query -W -f '${Package}==${Version}\n' >> "${TARGET_PATH}/versions-deb-${DI ## Print the unique and sorted result sort -u "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" -sort -u "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" -sort -u "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" +if [ -e "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" ]; then + sort -u "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" +fi +if [ -e "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" ]; then + sort -u "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" +fi exit 0 From 5e4f78542e26e37d14040813d5c2a9a070e771fa Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Thu, 23 Dec 2021 16:16:55 +0800 Subject: [PATCH 4/4] [Build]: Support reproducible build for release branches (#9426) [Build]: Support reproducible build for release branches #9426 --- .azure-pipelines/azure-pipelines-UpgrateVersion.yml | 6 +++++- .azure-pipelines/azure-pipelines-repd-build-variables.yml | 5 +++++ .azure-pipelines/official-build-cache.yml | 4 +++- .azure-pipelines/official-build.yml | 6 +++--- .github/workflows/label.yml | 2 ++ azure-pipelines.yml | 6 +++--- 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 .azure-pipelines/azure-pipelines-repd-build-variables.yml diff --git a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml index b749a3f33576..35506c35230c 100644 --- a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml +++ b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml @@ -11,7 +11,11 @@ schedules: displayName: Daily Build branches: include: - - 202012 + - 20???? + exclude: + - 200??? + - 201??? + - 202006 always: true resources: diff --git a/.azure-pipelines/azure-pipelines-repd-build-variables.yml b/.azure-pipelines/azure-pipelines-repd-build-variables.yml new file mode 100644 index 000000000000..7e831109e2ad --- /dev/null +++ b/.azure-pipelines/azure-pipelines-repd-build-variables.yml @@ -0,0 +1,5 @@ +variables: + ${{ if and(ge(variables['Build.SourceBranchName'], '202012'), le(variables['Build.SourceBranchName'], '299999')) }}: + VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker' + ${{ if or(lt(variables['Build.SourceBranchName'], '202012'), gt(variables['Build.SourceBranchName'], '299999')) }}: + VERSION_CONTROL_OPTIONS: '' diff --git a/.azure-pipelines/official-build-cache.yml b/.azure-pipelines/official-build-cache.yml index b3c9c6c8767d..4019dbba4f97 100644 --- a/.azure-pipelines/official-build-cache.yml +++ b/.azure-pipelines/official-build-cache.yml @@ -18,7 +18,9 @@ stages: - stage: Build pool: sonicbld variables: - CACHE_MODE: cache + - name: CACHE_MODE + value: cache + - template: azure-pipelines-repd-build-variables.yml jobs: - template: azure-pipelines-build.yml parameters: diff --git a/.azure-pipelines/official-build.yml b/.azure-pipelines/official-build.yml index 74f94d0db011..ce73048b77c0 100644 --- a/.azure-pipelines/official-build.yml +++ b/.azure-pipelines/official-build.yml @@ -37,9 +37,9 @@ stages: - stage: Build pool: sonicbld variables: - CACHE_MODE: wcache - ${{ if eq(variables['Build.SourceBranchName'], '202012') }}: - VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web' + - name: CACHE_MODE + value: wcache + - template: azure-pipelines-repd-build-variables.yml jobs: - template: azure-pipelines-build.yml parameters: diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index f8ae8e7199a2..5f8c0279b7e1 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -13,6 +13,8 @@ on: - reopened branches: - '202012' + - '202[1-9][0-9][0-9]' + - '20[3-9][0-9][0-9][0-9]' paths: - 'files/build/versions/**' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0d8a72bec795..456218264034 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -47,9 +47,9 @@ stages: - stage: Build pool: sonicbld variables: - CACHE_MODE: rcache - ${{ if eq(variables['Build.SourceBranchName'], '202012') }}: - VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker' + - template: .azure-pipelines/azure-pipelines-repd-build-variables.yml + - name: CACHE_MODE + value: rcache jobs: - template: .azure-pipelines/azure-pipelines-build.yml parameters: