Skip to content

Commit fce56f9

Browse files
authored
Merge pull request #601 from elezar/post-release-tooling-fix
[no-relnote] Fix release tooling
2 parents d51cee6 + 832fcba commit fce56f9

File tree

4 files changed

+72
-13
lines changed

4 files changed

+72
-13
lines changed

hack/create-release.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ REPOSITORY=NVIDIA/nvidia-container-toolkit
3030

3131
echo "Creating draft release"
3232
./hack/generate-changelog.sh --version ${VERSION} | \
33-
grep -v "### Version v" | \
34-
echo gh release create ${VERSION} --notes-file "-" \
33+
gh release create ${VERSION} --notes-file "-" \
3534
--draft \
3635
--title "${VERSION}" \
3736
-R "${REPOSITORY}" \
@@ -43,5 +42,7 @@ echo "Uploading release artifacts for ${VERSION}"
4342
PACKAGE_ROOT=release-${VERSION}-${REPO}
4443

4544
gh release upload ${VERSION} \
46-
${PACKAGE_ROOT}/nvidia-container-toolkit-${VERSION}.*.tar.gz \
45+
${PACKAGE_ROOT}/nvidia-container-toolkit_${VERSION#v}_*.tar.gz \
46+
${PACKAGE_ROOT}/nvidia-container-toolkit_${VERSION#v}_checksums.txt \
47+
--clobber \
4748
-R ${REPOSITORY}

hack/generate-changelog.sh

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ remote=$( git remote -v | grep -E "NVIDIA/nvidia-container-toolkit(\.git)?\s" |
6666
>&2 echo "Detected remote as '${remote}'"
6767
git fetch ${remote} --tags
6868

69+
git tag | grep ${VERSION} > /dev/null
70+
if [[ $? -ne 0 ]]; then
71+
>&2 echo "${VERSION} is not a valid git reference, using HEAD"
72+
VERSION=HEAD
73+
fi
74+
6975
# if REFERENCE is not set, get the latest tag
7076
if [ -z "$REFERENCE" ]; then
7177
most_recent_tag=$(git tag --sort=-creatordate | head -1)
@@ -79,9 +85,26 @@ fi
7985
>&2 echo "Using ${REFERENCE} as previous version"
8086

8187
# Print the changelog
82-
echo "# Changelog"
88+
echo "## What's Changed"
8389
echo ""
84-
echo "## $VERSION"
85-
8690
# Iterate over the commit messages and ignore the ones that start with "Merge" or "Bump"
87-
git log --pretty=format:"%s" $REFERENCE..@ | grep -Ev "(^Merge )|(^Bump)|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
91+
git log --pretty=format:"%s" $REFERENCE..$VERSION -- ':!deployments/container' ':!tools' | grep -Ev "(^Merge )|(^Bump)|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
92+
93+
echo ""
94+
echo "### Changes in the Toolkit Container"
95+
echo ""
96+
git log --pretty=format:"%s" $REFERENCE..$VERSION -- deployments/container tools | grep -Ev "(^Merge )|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
97+
98+
LIB_NVIDIA_CONTAINER_REFERENCE=$( git ls-tree $REFERENCE third_party/libnvidia-container --object-only )
99+
LIB_NVIDIA_CONTAINER_VERSION=$( git ls-tree $VERSION third_party/libnvidia-container --object-only )
100+
101+
echo ""
102+
if [[ $(git -C third_party/libnvidia-container log --pretty=format:"%s" $LIB_NVIDIA_CONTAINER_REFERENCE..$LIB_NVIDIA_CONTAINER_VERSION | grep -Ev "(^Merge )|(^Bump)|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g' | wc -l) -gt 0 ]]; then
103+
echo "### Changes in libnvidia-container"
104+
echo ""
105+
git -C third_party/libnvidia-container log --pretty=format:"%s" $LIB_NVIDIA_CONTAINER_REFERENCE..$LIB_NVIDIA_CONTAINER_VERSION | grep -Ev "(^Merge )|(^Bump)|(no-rel-?note)|(^---)" | sed 's/^\(.*\)/- \1/g'
106+
fi
107+
108+
echo ""
109+
echo "**Full Changelog**: https://github.com/NVIDIA/nvidia-container-toolkit/compare/${REFERENCE}...${VERSION}"
110+
echo ""

hack/prepare-artifacts.sh

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,42 @@ PACKAGE_ROOT=release-${VERSION}-${REPO}
4747
PACKAGE_VERSION=${VERSION/-/\~}
4848
PACKAGE_VERSION=${PACKAGE_VERSION#v}
4949

50-
tar -czvf ${PACKAGE_ROOT}/nvidia-container-toolkit-${VERSION}.deb.amd64.tar.gz ${PACKAGE_ROOT}/packages/ubuntu18.04/amd64/*_${PACKAGE_VERSION}-1_amd64.deb
51-
tar -czvf ${PACKAGE_ROOT}/nvidia-container-toolkit-${VERSION}.deb.arm64.tar.gz ${PACKAGE_ROOT}/packages/ubuntu18.04/arm64/*_${PACKAGE_VERSION}-1_arm64.deb
52-
tar -czvf ${PACKAGE_ROOT}/nvidia-container-toolkit-${VERSION}.rpm.aarch64.tar.gz ${PACKAGE_ROOT}/packages/centos7/aarch64/*-${PACKAGE_VERSION}-1.aarch64.rpm
53-
tar -czvf ${PACKAGE_ROOT}/nvidia-container-toolkit-${VERSION}.rpm.x86_64.tar.gz ${PACKAGE_ROOT}/packages/centos7/x86_64/*-${PACKAGE_VERSION}-1.x86_64.rpm
50+
tar -czvf ${PACKAGE_ROOT}/nvidia-container-toolkit_${VERSION#v}_deb_amd64.tar.gz ${PACKAGE_ROOT}/packages/ubuntu18.04/amd64/*_${PACKAGE_VERSION}-1_amd64.deb
51+
tar -czvf ${PACKAGE_ROOT}/nvidia-container-toolkit_${VERSION#v}_deb_arm64.tar.gz ${PACKAGE_ROOT}/packages/ubuntu18.04/arm64/*_${PACKAGE_VERSION}-1_arm64.deb
52+
tar -czvf ${PACKAGE_ROOT}/nvidia-container-toolkit_${VERSION#v}_rpm_aarch64.tar.gz ${PACKAGE_ROOT}/packages/centos7/aarch64/*-${PACKAGE_VERSION}-1.aarch64.rpm
53+
tar -czvf ${PACKAGE_ROOT}/nvidia-container-toolkit_${VERSION#v}_rpm_x86_64.tar.gz ${PACKAGE_ROOT}/packages/centos7/x86_64/*-${PACKAGE_VERSION}-1.x86_64.rpm
54+
55+
is_command() (
56+
command -v "$1" >/dev/null
57+
)
58+
59+
hash_sha256() (
60+
TARGET=${1:-/dev/stdin}
61+
if is_command gsha256sum; then
62+
hash=$(gsha256sum "$TARGET") || return 1
63+
echo "$hash" | cut -d ' ' -f 1
64+
elif is_command sha256sum; then
65+
hash=$(sha256sum "$TARGET") || return 1
66+
echo "$hash" | cut -d ' ' -f 1
67+
elif is_command shasum; then
68+
hash=$(shasum -a 256 "$TARGET" 2>/dev/null) || return 1
69+
echo "$hash" | cut -d ' ' -f 1
70+
elif is_command openssl; then
71+
hash=$(openssl -dst openssl dgst -sha256 "$TARGET") || return 1
72+
echo "$hash" | cut -d ' ' -f a
73+
else
74+
log_err "hash_sha256 unable to find command to compute sha-256 hash"
75+
return 1
76+
fi
77+
)
78+
79+
files=$( ls ${PACKAGE_ROOT}/nvidia-container-toolkit_${VERSION#v}_*.tar.gz )
80+
81+
CHECKSUM_FILE=${PACKAGE_ROOT}/nvidia-container-toolkit_${VERSION#v}_checksums.txt
82+
rm -f ${CHECKSUM_FILE}
83+
84+
set -e
85+
for f in ${files}; do
86+
hash_f=$(hash_sha256 $f)
87+
echo "${hash_f} $f" >> $CHECKSUM_FILE
88+
done

scripts/archive-packages.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ PACKAGE_CACHE=release-${VERSION}-${REPO}
6161
REMOVE_PACKAGE_CACHE=no
6262
if [ ! -d ${PACKAGE_CACHE} ]; then
6363
echo "Fetching packages with SHA '${SHA}' as tag '${VERSION}' to ${PACKAGE_CACHE}"
64-
${SCRIPTS_DIR}/pull-packages.sh \
64+
${SCRIPTS_DIR}/../hack/pull-packages.sh \
6565
${PACKAGE_IMAGE_NAME}:${PACKAGE_IMAGE_TAG} \
6666
${PACKAGE_CACHE}
6767
REMOVE_PACKAGE_CACHE=yes
@@ -113,7 +113,7 @@ function upload_archive() {
113113

114114
for var in "CI_PROJECT_ID" "CI_PIPELINE_ID" "CI_JOB_ID" "CI_JOB_URL" "CI_PROJECT_PATH"; do
115115
if [ -n "${!var}" ]; then
116-
optionally_add_property "${var}" "${!var}"
116+
props+=("${property}=${value}")
117117
fi
118118
done
119119
local PROPS=$(join_by ";" "${props[@]}")

0 commit comments

Comments
 (0)