From 609c0354134adf5aadf2bc01dc61d5c74ee5898c Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Tue, 9 Jul 2024 19:33:09 +0800 Subject: [PATCH 1/2] chore(dockerfiles/cd/utils/release): pretty output for offline package steps Signed-off-by: wuhuizuo --- packages/offline-packages.yaml.tmpl | 2 -- packages/scripts/build-package-artifacts.sh.tmpl | 2 +- packages/scripts/compose-offline-packages-artifacts.sh.tmpl | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/offline-packages.yaml.tmpl b/packages/offline-packages.yaml.tmpl index 66fc874e..aa66cab8 100644 --- a/packages/offline-packages.yaml.tmpl +++ b/packages/offline-packages.yaml.tmpl @@ -363,7 +363,6 @@ editions: if: {{ semver.CheckConstraint ">=7.6.0-0" .Release.version }} os: [linux] arch: [amd64, arm64] - profile: [enterprise] artifacts: - name: "tidb-enterprise-server-{{ .Release.version }}-{{ .Release.os }}-{{ .Release.arch }}" desc: enterprise offline server package @@ -498,7 +497,6 @@ editions: if: {{ semver.CheckConstraint ">=7.5.0-0, <7.6.0-0" .Release.version }} os: [linux] arch: [amd64, arm64] - profile: [enterprise] artifacts: - name: "tidb-enterprise-server-{{ .Release.version }}-{{ .Release.os }}-{{ .Release.arch }}" desc: enterprise offline server package diff --git a/packages/scripts/build-package-artifacts.sh.tmpl b/packages/scripts/build-package-artifacts.sh.tmpl index a55b9f33..bb99c10e 100644 --- a/packages/scripts/build-package-artifacts.sh.tmpl +++ b/packages/scripts/build-package-artifacts.sh.tmpl @@ -91,7 +91,7 @@ function fetch_file_from_oci_artifact() { local repo="$(echo $destination | cut -d ':' -f 1)" # get the file blob digest. - oras manifest fetch $destination | yq -e --prettyPrint ".layers | filter(.annotations[\"org.opencontainers.image.title\"] | test \"$to_match_file\") | .[0]" >blob.yaml + oras manifest fetch $destination | yq -e --prettyPrint -oy ".layers | filter(.annotations[\"org.opencontainers.image.title\"] | test \"$to_match_file\") | .[0]" >blob.yaml # download file file="$(yq .annotations[\"org.opencontainers.image.title\"] blob.yaml)" diff --git a/packages/scripts/compose-offline-packages-artifacts.sh.tmpl b/packages/scripts/compose-offline-packages-artifacts.sh.tmpl index 852aab51..7c759050 100644 --- a/packages/scripts/compose-offline-packages-artifacts.sh.tmpl +++ b/packages/scripts/compose-offline-packages-artifacts.sh.tmpl @@ -76,7 +76,7 @@ function fetch_file_from_oci_artifact() { local repo="$(echo $destination | cut -d ':' -f 1)" # get the file blob digest. - oras manifest fetch $destination | yq --prettyPrint ".layers | filter(.annotations[\"org.opencontainers.image.title\"] | test \"$to_match_file\") | .[0]" >blob.yaml + oras manifest fetch $destination | yq --prettyPrint -oy ".layers | filter(.annotations[\"org.opencontainers.image.title\"] | test \"$to_match_file\") | .[0]" >blob.yaml # download file file="$(yq .annotations[\"org.opencontainers.image.title\"] blob.yaml)" @@ -92,7 +92,7 @@ function check_file_in_oci_artifact() { oras manifest fetch -o oci_manifest.json $destination # get the file blob digest. - yq -e --prettyPrint ".layers | filter(.annotations[\"org.opencontainers.image.title\"] | test \"$to_match_file\") | length > 0" oci_manifest.json + yq -e --prettyPrint -oy ".layers | filter(.annotations[\"org.opencontainers.image.title\"] | test \"$to_match_file\") | length > 0" oci_manifest.json > /dev/null } function pre_check() { From 78d8678f49cc8198de9c5bf35180a8880843a02c Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Tue, 9 Jul 2024 20:26:00 +0800 Subject: [PATCH 2/2] fix(packages/scripts): update to adjust new oras version From oras v1.2.0, there's a break change for cli option of sub command `discover`. Ref: https://github.com/oras-project/oras/releases/tag/v1.2.0 Signed-off-by: wuhuizuo --- packages/scripts/build-package-artifacts.sh.tmpl | 2 +- packages/scripts/compose-offline-packages-artifacts.sh.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/scripts/build-package-artifacts.sh.tmpl b/packages/scripts/build-package-artifacts.sh.tmpl index bb99c10e..ebbf5557 100644 --- a/packages/scripts/build-package-artifacts.sh.tmpl +++ b/packages/scripts/build-package-artifacts.sh.tmpl @@ -256,7 +256,7 @@ function write_push_results() { # Login steps: # local registry=$(echo "${destination}" | cut -d/ -f) # oras login -u ${ORAS_USER} -p ${ORAS_PASSWD} ${registry} - digest="$(oras discover "${destination}" --distribution-spec v1.1-referrers-tag -o tree | cut -d@ -f2)" + digest="$(oras discover "${destination}" --distribution-spec v1.1-referrers-tag --format tree | cut -d@ -f2)" cat < "$result_file" oci: diff --git a/packages/scripts/compose-offline-packages-artifacts.sh.tmpl b/packages/scripts/compose-offline-packages-artifacts.sh.tmpl index 7c759050..68e2966f 100644 --- a/packages/scripts/compose-offline-packages-artifacts.sh.tmpl +++ b/packages/scripts/compose-offline-packages-artifacts.sh.tmpl @@ -280,7 +280,7 @@ function write_push_results() { # Login steps: # local registry=$(echo "${destination}" | cut -d/ -f) # oras login -u ${ORAS_USER} -p ${ORAS_PASSWD} ${registry} - digest="$(oras discover "${destination}" --distribution-spec v1.1-referrers-tag -o tree | cut -d@ -f2)" + digest="$(oras discover "${destination}" --distribution-spec v1.1-referrers-tag --format tree | cut -d@ -f2)" cat < "$result_file" oci: