Merge pull request #9638 from BbolroC/use-fixed-len-git-hash-explicitly

CI: Use `--abbrev=9` explicitly for abbreviated commit hash
This commit is contained in:
Steve Horsman 2024-05-15 16:55:07 +01:00 committed by GitHub
commit 19ca1a6656
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -186,7 +186,7 @@ install_cached_tarball_component() {
fi fi
local component="${1}" local component="${1}"
local current_version="${2}-$(git log -1 --pretty=format:"%h" ${repo_root_dir}/tools/packaging/kata-deploy/local-build)" local current_version="${2}-$(git log -1 --abbrev=9 --pretty=format:"%h" ${repo_root_dir}/tools/packaging/kata-deploy/local-build)"
local current_image_version="${3}" local current_image_version="${3}"
local component_tarball_name="${4}" local component_tarball_name="${4}"
local component_tarball_path="${5}" local component_tarball_path="${5}"
@ -798,7 +798,7 @@ install_ovmf_sev() {
} }
install_agent() { install_agent() {
latest_artefact="$(git log -1 --pretty=format:"%h" ${repo_root_dir}/src/agent)" latest_artefact="$(git log -1 --abbrev=9 --pretty=format:"%h" ${repo_root_dir}/src/agent)"
latest_builder_image="$(get_agent_image_name)" latest_builder_image="$(get_agent_image_name)"
install_cached_tarball_component \ install_cached_tarball_component \
@ -901,7 +901,7 @@ install_script_helper() {
install_tools_helper() { install_tools_helper() {
tool=${1} tool=${1}
latest_artefact="$(git log -1 --pretty=format:"%h" ${repo_root_dir}/src/tools/${tool})" latest_artefact="$(git log -1 --abbrev=9 --pretty=format:"%h" ${repo_root_dir}/src/tools/${tool})"
latest_builder_image="$(get_tools_image_name)" latest_builder_image="$(get_tools_image_name)"
install_cached_tarball_component \ install_cached_tarball_component \
@ -1117,7 +1117,7 @@ handle_build() {
esac esac
pushd ${workdir} pushd ${workdir}
echo "${latest_artefact}-$(git log -1 --pretty=format:"%h" ${repo_root_dir}/tools/packaging/kata-deploy/local-build)" > ${build_target}-version echo "${latest_artefact}-$(git log -1 --abbrev=9 --pretty=format:"%h" ${repo_root_dir}/tools/packaging/kata-deploy/local-build)" > ${build_target}-version
echo "${latest_builder_image}" > ${build_target}-builder-image-version echo "${latest_builder_image}" > ${build_target}-builder-image-version
sha256sum "${final_tarball_name}" > ${build_target}-sha256sum sha256sum "${final_tarball_name}" > ${build_target}-sha256sum

View File

@ -113,7 +113,7 @@ get_last_modification() {
dirty="" dirty=""
[ $(git status --porcelain | grep "${file#${repo_root_dir}/}" | wc -l) -gt 0 ] && dirty="-dirty" [ $(git status --porcelain | grep "${file#${repo_root_dir}/}" | wc -l) -gt 0 ] && dirty="-dirty"
echo "$(git log -1 --pretty=format:"%h" ${file})${dirty}" echo "$(git log -1 --abbrev=9 --pretty=format:"%h" ${file})${dirty}"
popd &> /dev/null popd &> /dev/null
} }