I have started looking into how to speed up the tag creation and was wondering had you considered remote fetching.One of these days I should update the maldua zimbra-builder.sh script so that it accepts proper command line switches and that they do not suppose that you have to have an installer-build directory. Some kind of hybrid between what you have done and what I have done. I'll have to think carefully about it but it's not something for the short term.
Code:
# Function to fetch and sort version tags from a remote repository accuratelyfetch_ordered_tags() { local repository_url=$1 # URL of the git repository local tag_pattern=$2 # Version pattern to filter tags, e.g., '9.0' # Fetch and format the tags tag_list=$(git ls-remote --sort=version:refname --tags $repository_url | \ grep "refs/tags/$tag_pattern" | \ grep -v '\^{}' | \ awk '{print $2}' | \ sed 's#refs/tags/##g' | \ tac | \ tr '\n' ',' | \ sed 's/,$//') echo "$tag_list"}repository_url="https://github.com/Zimbra/zm-mailbox.git"tag_list=$(fetch_ordered_tags "$repository_url" "9.0")echo "Ordered tags: $tag_list"
I also did this should the repository be cloned locally.
Code:
# This requires that the repository has already been cloned and you are working from this repository# cd zm-mailbox for example;fetch_ordered_tags_from_clone() { local tag_pattern=$1 # The version pattern to filter tags, e.g., '9.0' # Fetch and format the tags tag_list=$(git for-each-ref --sort=creatordate --format '%(refname:short)' refs/tags | \ grep "${tag_pattern//./\\.}" | \ tac | \ tr '\n' ',' | \ sed 's/,$//') # Convert to comma-separated list and remove trailing comma echo "$tag_list" }
Jim
Statistics: Posted by JDunphy — Thu May 02, 2024 6:16 pm