From 2b7ca7affe5ec2e02e31d8e0bb0b7ee37b45b167 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 26 Aug 2024 18:00:32 +0300 Subject: [PATCH 01/35] add --depth=$DEPTH --- start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index 86787f3..fa9a724 100644 --- a/start.sh +++ b/start.sh @@ -198,10 +198,10 @@ if [ -d "$CLONE_DIR" ]; then git clean -df git gc --force git_retry git remote prune origin - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" --depth=$DEPTH echo "Fetching the updates from origin" - git_retry git fetch --tags + git_retry git fetch --tags --depth=$DEPTH git remote set-head origin --auto if [ -n "$REVISION" ]; then From ea61ac211e11144f6aa018f71823433fc6ab6a6a Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 26 Aug 2024 18:05:30 +0300 Subject: [PATCH 02/35] bump --- service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service.yaml b/service.yaml index 65c948d..efcf655 100644 --- a/service.yaml +++ b/service.yaml @@ -1 +1 @@ -version: 10.1.28 +version: 10.1.29 From 59fd3e769dbe40222c6178d2d7c2fc38ef1cffb3 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Wed, 28 Aug 2024 16:53:26 +0300 Subject: [PATCH 03/35] test2 --- start.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index fa9a724..c038c7a 100644 --- a/start.sh +++ b/start.sh @@ -198,10 +198,21 @@ if [ -d "$CLONE_DIR" ]; then git clean -df git gc --force git_retry git remote prune origin - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" --depth=$DEPTH + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" echo "Fetching the updates from origin" - git_retry git fetch --tags --depth=$DEPTH + # Set remote branches only if REVISION is defined + if [ -n "$REVISION" ]; then + git_retry git remote set-branches origin "$REVISION" + fi + + # Fetch updates using depth only if DEPTH is defined + if [ -n "$DEPTH" ]; then + git_retry git fetch origin ${REVISION:+$REVISION} --depth=$DEPTH + else + git_retry git fetch origin ${REVISION:+$REVISION} + fi + git remote set-head origin --auto if [ -n "$REVISION" ]; then From ccebd4a48355d574e0e021f1821a8ba81a8aa598 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 21:51:08 +0300 Subject: [PATCH 04/35] test3 --- start.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/start.sh b/start.sh index c038c7a..ac2d172 100644 --- a/start.sh +++ b/start.sh @@ -198,21 +198,25 @@ if [ -d "$CLONE_DIR" ]; then git clean -df git gc --force git_retry git remote prune origin - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" - - echo "Fetching the updates from origin" - # Set remote branches only if REVISION is defined - if [ -n "$REVISION" ]; then - git_retry git remote set-branches origin "$REVISION" + # Check if DEPTH is set (and non-zero) to decide on the fetch strategy + if [ -n "$DEPTH" ]; then + echo "Fetching updates with depth $DEPTH" + git_retry git fetch --depth=$DEPTH origin --tags --prune "+refs/tags/*:refs/tags/*" + else + echo "Fetching full updates" + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" fi - # Fetch updates using depth only if DEPTH is defined + echo "Fetching the updates from origin" if [ -n "$DEPTH" ]; then - git_retry git fetch origin ${REVISION:+$REVISION} --depth=$DEPTH + git_retry git fetch --depth=$DEPTH --tags else - git_retry git fetch origin ${REVISION:+$REVISION} + git_retry git fetch --tags fi + + echo "Fetching the updates from origin" + git_retry git fetch --tags git remote set-head origin --auto if [ -n "$REVISION" ]; then From dd7febe045a8d00f5b96023fef183a0918d2fb49 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 22:01:25 +0300 Subject: [PATCH 05/35] test4 --- start.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/start.sh b/start.sh index ac2d172..edfe955 100644 --- a/start.sh +++ b/start.sh @@ -214,9 +214,6 @@ if [ -d "$CLONE_DIR" ]; then git_retry git fetch --tags fi - - echo "Fetching the updates from origin" - git_retry git fetch --tags git remote set-head origin --auto if [ -n "$REVISION" ]; then From ed4e4e8d8fe06ad40530bb0a52bed3591f2fb9b2 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 22:21:17 +0300 Subject: [PATCH 06/35] test5 --- start.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/start.sh b/start.sh index edfe955..c3643ef 100644 --- a/start.sh +++ b/start.sh @@ -207,13 +207,6 @@ if [ -d "$CLONE_DIR" ]; then git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" fi - echo "Fetching the updates from origin" - if [ -n "$DEPTH" ]; then - git_retry git fetch --depth=$DEPTH --tags - else - git_retry git fetch --tags - fi - git remote set-head origin --auto if [ -n "$REVISION" ]; then From 47189ea572730920492efdd1b5c7fabd74c61ae3 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 22:45:41 +0300 Subject: [PATCH 07/35] test6 --- start.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/start.sh b/start.sh index c3643ef..5c96ed6 100644 --- a/start.sh +++ b/start.sh @@ -198,15 +198,10 @@ if [ -d "$CLONE_DIR" ]; then git clean -df git gc --force git_retry git remote prune origin - # Check if DEPTH is set (and non-zero) to decide on the fetch strategy - if [ -n "$DEPTH" ]; then - echo "Fetching updates with depth $DEPTH" - git_retry git fetch --depth=$DEPTH origin --tags --prune "+refs/tags/*:refs/tags/*" - else - echo "Fetching full updates" - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" - fi + echo "Fetching the updates from origin" + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" + git_retry git fetch --tags git remote set-head origin --auto if [ -n "$REVISION" ]; then From fd13aea6ef905b60b236b6e8496164bdc420c046 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 22:59:25 +0300 Subject: [PATCH 08/35] test7 --- start.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/start.sh b/start.sh index 5c96ed6..ac12d70 100644 --- a/start.sh +++ b/start.sh @@ -201,7 +201,6 @@ if [ -d "$CLONE_DIR" ]; then echo "Fetching the updates from origin" git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" - git_retry git fetch --tags git remote set-head origin --auto if [ -n "$REVISION" ]; then From 9bd128237215e2853eec818c2e5c9417ec0797e9 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 23:07:38 +0300 Subject: [PATCH 09/35] test8 --- start.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/start.sh b/start.sh index ac12d70..d758100 100644 --- a/start.sh +++ b/start.sh @@ -200,7 +200,12 @@ if [ -d "$CLONE_DIR" ]; then git_retry git remote prune origin echo "Fetching the updates from origin" - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" +# git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" + if [ -n "$DEPTH" ]; then + git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" --depth=$DEPTH + else + git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" + fi git remote set-head origin --auto if [ -n "$REVISION" ]; then From a4fdd4423676a936138a264cb708269e9598b693 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 23:14:14 +0300 Subject: [PATCH 10/35] test9 --- start.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/start.sh b/start.sh index d758100..03ea348 100644 --- a/start.sh +++ b/start.sh @@ -199,11 +199,13 @@ if [ -d "$CLONE_DIR" ]; then git gc --force git_retry git remote prune origin - echo "Fetching the updates from origin" + # git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" if [ -n "$DEPTH" ]; then + echo "Fetching the updates from origin with depth $DEPTH" git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" --depth=$DEPTH else + echo "Fetching the updates from origin" git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" fi git remote set-head origin --auto From bd7264ad36b401da3865a2fb77613e853d4c7c99 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 23:18:24 +0300 Subject: [PATCH 11/35] test10 --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 03ea348..43234de 100644 --- a/start.sh +++ b/start.sh @@ -203,7 +203,7 @@ if [ -d "$CLONE_DIR" ]; then # git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" if [ -n "$DEPTH" ]; then echo "Fetching the updates from origin with depth $DEPTH" - git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" --depth=$DEPTH + git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" --depth=$DEPTH --no-tags else echo "Fetching the updates from origin" git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" From 1930769d7877581f49933162deb0ba1d7649db21 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 23:24:37 +0300 Subject: [PATCH 12/35] test11 --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 43234de..c053a88 100644 --- a/start.sh +++ b/start.sh @@ -203,7 +203,7 @@ if [ -d "$CLONE_DIR" ]; then # git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" if [ -n "$DEPTH" ]; then echo "Fetching the updates from origin with depth $DEPTH" - git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" --depth=$DEPTH --no-tags + git_retry git fetch origin --prune --depth=$DEPTH --no-tags else echo "Fetching the updates from origin" git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" From 209d664c310eb30136fe3b3e75c409e463a1a3f6 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 23:34:49 +0300 Subject: [PATCH 13/35] test12 --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index c053a88..c23fa49 100644 --- a/start.sh +++ b/start.sh @@ -203,7 +203,7 @@ if [ -d "$CLONE_DIR" ]; then # git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" if [ -n "$DEPTH" ]; then echo "Fetching the updates from origin with depth $DEPTH" - git_retry git fetch origin --prune --depth=$DEPTH --no-tags + git_retry git fetch origin $REVISION --prune --depth=$DEPTH --no-tags else echo "Fetching the updates from origin" git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" From ce1ec84dddb81b99397b2fcd04567e6415a63f96 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Thu, 29 Aug 2024 23:57:52 +0300 Subject: [PATCH 14/35] test13 --- start.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/start.sh b/start.sh index c23fa49..9f2785c 100644 --- a/start.sh +++ b/start.sh @@ -199,15 +199,10 @@ if [ -d "$CLONE_DIR" ]; then git gc --force git_retry git remote prune origin + echo "Fetching the updates from origin with${DEPTH:+ depth $DEPTH}" + + git_retry git fetch origin ${REVISION:-'HEAD'} --prune --depth=${DEPTH:-0} --no-tags -# git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" - if [ -n "$DEPTH" ]; then - echo "Fetching the updates from origin with depth $DEPTH" - git_retry git fetch origin $REVISION --prune --depth=$DEPTH --no-tags - else - echo "Fetching the updates from origin" - git_retry git fetch origin --prune "+refs/tags/*:refs/tags/*" - fi git remote set-head origin --auto if [ -n "$REVISION" ]; then From f181fb85b4c39ea7ac23f574a9c49b313f436db5 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Sun, 1 Sep 2024 17:44:10 +0300 Subject: [PATCH 15/35] lint --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 9f2785c..6f11809 100644 --- a/start.sh +++ b/start.sh @@ -214,7 +214,7 @@ if [ -d "$CLONE_DIR" ]; then # If the revision is identical to the current branch we can just reset it to the latest changes. This isn't needed when running detached if [ "$REVISION" == "$CURRENT_BRANCH" ]; then - echo 'Resetting current branch $REVISION to latest changes...' + echo "Resetting current branch $REVISION to latest changes..." git reset --hard origin/$REVISION fi fi From 7f8ed9a48d58e6d7d8203a658d70e52859d07efb Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 16:20:31 +0300 Subject: [PATCH 16/35] add SKIP_TAGS_ON_UPDATE --- start.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index 6f11809..e527b03 100644 --- a/start.sh +++ b/start.sh @@ -199,9 +199,14 @@ if [ -d "$CLONE_DIR" ]; then git gc --force git_retry git remote prune origin - echo "Fetching the updates from origin with${DEPTH:+ depth $DEPTH}" + if [ -n "$SKIP_TAGS_ON_UPDATE" ]; then + echo "Fetching updates from origin with${DEPTH:+ a depth of $DEPTH}, skipping tags" + git_retry git fetch origin ${REVISION:-'HEAD'} --prune --depth=${DEPTH:-0} --no-tags + else + echo "Fetching updates from origin with${DEPTH:+ a depth of $DEPTH}, including tags" + git_retry git fetch origin ${REVISION:-'HEAD'} --depth=${DEPTH:-0} --tags --prune "+refs/tags/*:refs/tags/*" + fi - git_retry git fetch origin ${REVISION:-'HEAD'} --prune --depth=${DEPTH:-0} --no-tags git remote set-head origin --auto From 773e7d4b375cc7afe0d0257b547043a2fedb8c5a Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 17:27:35 +0300 Subject: [PATCH 17/35] update cmd --- start.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/start.sh b/start.sh index e527b03..c4e52e6 100644 --- a/start.sh +++ b/start.sh @@ -200,11 +200,11 @@ if [ -d "$CLONE_DIR" ]; then git_retry git remote prune origin if [ -n "$SKIP_TAGS_ON_UPDATE" ]; then - echo "Fetching updates from origin with${DEPTH:+ a depth of $DEPTH}, skipping tags" - git_retry git fetch origin ${REVISION:-'HEAD'} --prune --depth=${DEPTH:-0} --no-tags + echo "Fetching updates from origin, skipping tags" + git_retry git fetch origin --prune --no-tags else - echo "Fetching updates from origin with${DEPTH:+ a depth of $DEPTH}, including tags" - git_retry git fetch origin ${REVISION:-'HEAD'} --depth=${DEPTH:-0} --tags --prune "+refs/tags/*:refs/tags/*" + echo "Fetching updates from origin" + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" fi From 1359bda70152815b5fe2e842f2e58a6c33a37a5d Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 18:06:53 +0300 Subject: [PATCH 18/35] update cmd with depth --- start.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/start.sh b/start.sh index c4e52e6..03a8c87 100644 --- a/start.sh +++ b/start.sh @@ -200,14 +200,15 @@ if [ -d "$CLONE_DIR" ]; then git_retry git remote prune origin if [ -n "$SKIP_TAGS_ON_UPDATE" ]; then - echo "Fetching updates from origin, skipping tags" - git_retry git fetch origin --prune --no-tags + echo "Fetching updates from origin ${DEPTH:+ with depth $DEPTH}, skipping tags" + git_retry git fetch origin --prune --no-tags ${DEPTH:+ --depth=$DEPTH} else - echo "Fetching updates from origin" - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" + echo "Fetching updates from origin" + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" fi + git remote set-head origin --auto if [ -n "$REVISION" ]; then From 65165f3b28cd1c0ac2f09c2e4016c7ec36ebcbc8 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 18:07:37 +0300 Subject: [PATCH 19/35] update cmd with depth --- start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index 03a8c87..953fd02 100644 --- a/start.sh +++ b/start.sh @@ -203,8 +203,8 @@ if [ -d "$CLONE_DIR" ]; then echo "Fetching updates from origin ${DEPTH:+ with depth $DEPTH}, skipping tags" git_retry git fetch origin --prune --no-tags ${DEPTH:+ --depth=$DEPTH} else - echo "Fetching updates from origin" - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" + echo "Fetching updates from origin ${DEPTH:+ with depth $DEPTH}" + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} fi From a83ee5d1ae6f427d02b13b859fa7e70cf8a557e1 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 18:21:59 +0300 Subject: [PATCH 20/35] ${REVISION:+$REVISION} --- start.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/start.sh b/start.sh index 953fd02..820e5ad 100644 --- a/start.sh +++ b/start.sh @@ -200,10 +200,10 @@ if [ -d "$CLONE_DIR" ]; then git_retry git remote prune origin if [ -n "$SKIP_TAGS_ON_UPDATE" ]; then - echo "Fetching updates from origin ${DEPTH:+ with depth $DEPTH}, skipping tags" - git_retry git fetch origin --prune --no-tags ${DEPTH:+ --depth=$DEPTH} + echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}, skipping tags" + git_retry git fetch origin ${REVISION:+$REVISION} --prune --no-tags ${DEPTH:+ --depth=$DEPTH} else - echo "Fetching updates from origin ${DEPTH:+ with depth $DEPTH}" + echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}" git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} fi From 1b87da4973e7efa8fffd306fb9b16d6d83deb1fc Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 18:40:38 +0300 Subject: [PATCH 21/35] lint --- start.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/start.sh b/start.sh index 820e5ad..86fffd6 100644 --- a/start.sh +++ b/start.sh @@ -207,8 +207,6 @@ if [ -d "$CLONE_DIR" ]; then git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} fi - - git remote set-head origin --auto if [ -n "$REVISION" ]; then From fa6f3f0b28a08924782de189c2fe87f2e58c3c7a Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 18:52:12 +0300 Subject: [PATCH 22/35] add comment --- start.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index 86fffd6..37320fa 100644 --- a/start.sh +++ b/start.sh @@ -203,8 +203,11 @@ if [ -d "$CLONE_DIR" ]; then echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}, skipping tags" git_retry git fetch origin ${REVISION:+$REVISION} --prune --no-tags ${DEPTH:+ --depth=$DEPTH} else - echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}" - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} + # in order to not change logic that already working we not specifying depth & origin + # it will be better to use this cmd, but with the new flag it will work as the following without tags as well + # git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} + echo "Fetching updates from origin" + git_retry git fetch --tags --prune "+refs/tags/*:refs/tags/*" fi git remote set-head origin --auto From b0041e21a23f9e955c77a446eecee4425ea71f9a Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 19:04:52 +0300 Subject: [PATCH 23/35] git fetch --tags --- start.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/start.sh b/start.sh index 37320fa..c761a41 100644 --- a/start.sh +++ b/start.sh @@ -203,11 +203,11 @@ if [ -d "$CLONE_DIR" ]; then echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}, skipping tags" git_retry git fetch origin ${REVISION:+$REVISION} --prune --no-tags ${DEPTH:+ --depth=$DEPTH} else - # in order to not change logic that already working we not specifying depth & origin - # it will be better to use this cmd, but with the new flag it will work as the following without tags as well - # git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} + # In order to not change logic that already working im keeping git_retry git fetch --tags + # This command fetches updates from all configured remotes in your repository, not just from "origin". echo "Fetching updates from origin" - git_retry git fetch --tags --prune "+refs/tags/*:refs/tags/*" + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" + git fetch --tags fi git remote set-head origin --auto From 5124cd858fc65b0c8478b6186d59ffa34b8ca456 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 19:05:30 +0300 Subject: [PATCH 24/35] git fetch --tags --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index c761a41..bbee0a3 100644 --- a/start.sh +++ b/start.sh @@ -203,7 +203,7 @@ if [ -d "$CLONE_DIR" ]; then echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}, skipping tags" git_retry git fetch origin ${REVISION:+$REVISION} --prune --no-tags ${DEPTH:+ --depth=$DEPTH} else - # In order to not change logic that already working im keeping git_retry git fetch --tags + # In order to not change logic that already working we keeping git_retry git fetch --tags # This command fetches updates from all configured remotes in your repository, not just from "origin". echo "Fetching updates from origin" git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" From f7fea1060c92f78e92e7c4cd97fea10d5227c48a Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 19:07:09 +0300 Subject: [PATCH 25/35] git_retry git fetch --tags --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index bbee0a3..cce4e08 100644 --- a/start.sh +++ b/start.sh @@ -207,7 +207,7 @@ if [ -d "$CLONE_DIR" ]; then # This command fetches updates from all configured remotes in your repository, not just from "origin". echo "Fetching updates from origin" git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" - git fetch --tags + git_retry git fetch --tags fi git remote set-head origin --auto From 9f1ea5414f384c8a46222ed3e9094ba67da8d14c Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 2 Sep 2024 19:16:51 +0300 Subject: [PATCH 26/35] git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" --- start.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/start.sh b/start.sh index cce4e08..b232aee 100644 --- a/start.sh +++ b/start.sh @@ -203,11 +203,8 @@ if [ -d "$CLONE_DIR" ]; then echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}, skipping tags" git_retry git fetch origin ${REVISION:+$REVISION} --prune --no-tags ${DEPTH:+ --depth=$DEPTH} else - # In order to not change logic that already working we keeping git_retry git fetch --tags - # This command fetches updates from all configured remotes in your repository, not just from "origin". echo "Fetching updates from origin" git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" - git_retry git fetch --tags fi git remote set-head origin --auto From 88eb361a85abccdcf56fc821527d868f3782b5fa Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Tue, 3 Sep 2024 09:54:29 +0300 Subject: [PATCH 27/35] remove --prune --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index b232aee..77e2c59 100644 --- a/start.sh +++ b/start.sh @@ -201,7 +201,7 @@ if [ -d "$CLONE_DIR" ]; then if [ -n "$SKIP_TAGS_ON_UPDATE" ]; then echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}, skipping tags" - git_retry git fetch origin ${REVISION:+$REVISION} --prune --no-tags ${DEPTH:+ --depth=$DEPTH} + git_retry git fetch origin ${REVISION:+$REVISION} --no-tags ${DEPTH:+ --depth=$DEPTH} else echo "Fetching updates from origin" git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" From f02cc877b70254e9b08fddad265e6d5a3e8f1177 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Tue, 3 Sep 2024 14:34:14 +0300 Subject: [PATCH 28/35] add ${DEPTH:+ --depth=$DEPTH} --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 77e2c59..2e18b79 100644 --- a/start.sh +++ b/start.sh @@ -204,7 +204,7 @@ if [ -d "$CLONE_DIR" ]; then git_retry git fetch origin ${REVISION:+$REVISION} --no-tags ${DEPTH:+ --depth=$DEPTH} else echo "Fetching updates from origin" - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" + git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} fi git remote set-head origin --auto From d3555beeb62117fdfd432fd38229dc452f3f0d5a Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Tue, 10 Sep 2024 09:18:03 +0300 Subject: [PATCH 29/35] add logs --- start.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index 2e18b79..946b7e5 100644 --- a/start.sh +++ b/start.sh @@ -2,10 +2,12 @@ exit_trap () { local lc="$BASH_COMMAND" rc=$? + echo "Exit trap triggered with command: [$lc] and exit code [$rc]" if [ "$rc" = 0 ]; then return fi if [ "$CLEAN_GIT_LOCK_FILES" = "true" ] && [ "$IS_RETRY" != "true" ]; then + echo "Cleaning git lock files and retrying the script..." retry_script exit $? fi @@ -15,13 +17,15 @@ exit_trap () { retry_script () { echo "Retrying git clone operation..." cd ../ - rm -rf $CLONE_DIR + rm -rf "$CLONE_DIR" export IS_RETRY=true - $0 $@ + echo "Re-executing script with arguments: $@" + $0 "$@" } git_retry () { # Retry git on exit code 128 +echo "Executing git command with retry logic: $@" ( set +e RETRY_ON_SIGNAL=128 @@ -205,6 +209,7 @@ if [ -d "$CLONE_DIR" ]; then else echo "Fetching updates from origin" git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} + echo "DONE Fetching updates from origin" fi git remote set-head origin --auto From c986adc0ee2a0e47192a72bd06ce7073f3923617 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Tue, 10 Sep 2024 09:21:18 +0300 Subject: [PATCH 30/35] bump --- service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service.yaml b/service.yaml index efcf655..1727721 100644 --- a/service.yaml +++ b/service.yaml @@ -1 +1 @@ -version: 10.1.29 +version: 10.1.30 From 756c08e6e22b9dcb1dc61487049e1c50367a6793 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Tue, 10 Sep 2024 09:24:31 +0300 Subject: [PATCH 31/35] lint --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 946b7e5..57bd3da 100644 --- a/start.sh +++ b/start.sh @@ -17,7 +17,7 @@ exit_trap () { retry_script () { echo "Retrying git clone operation..." cd ../ - rm -rf "$CLONE_DIR" + rm -rf $CLONE_DIR export IS_RETRY=true echo "Re-executing script with arguments: $@" $0 "$@" From 45f222b9e0eb00afde9a55697c5b0c94c4f06afe Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Tue, 10 Sep 2024 09:39:55 +0300 Subject: [PATCH 32/35] add more logs --- start.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/start.sh b/start.sh index 57bd3da..1fdd082 100644 --- a/start.sh +++ b/start.sh @@ -34,18 +34,31 @@ echo "Executing git command with retry logic: $@" until [[ "$TRY_NUM" -ge "$MAX_TRIES" ]]; do "${COMMAND[@]}" # Use "${COMMAND[@]}" to preserve arguments with quotes EXIT_CODE=$? + + # Log the command output and error messages + echo "Command output (stdout):" + cat "$OUTPUT_LOG" + echo "Command error (stderr):" + cat "$ERROR_LOG" + if [[ $EXIT_CODE == 0 ]]; then + echo "Command succeeded on attempt $TRY_NUM." break elif [[ $EXIT_CODE == "$RETRY_ON_SIGNAL" ]]; then echo "Failed with Exit Code $EXIT_CODE - try $TRY_NUM " TRY_NUM=$(( ${TRY_NUM} + 1 )) sleep $RETRY_WAIT else + echo "Command failed with exit code $EXIT_CODE. No retry configured for this code." + echo "Failed command: ${COMMAND[*]}" + echo "Exit Code: $EXIT_CODE" + echo "Output Log: $OUTPUT_LOG" + echo "Error Log: $ERROR_LOG" break fi - done - return $EXIT_CODE - ) + done + return $EXIT_CODE + ) } upsert_remote_alias () { From 25b7ecef32aae5455fbff6d9453083438133226e Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Sun, 15 Sep 2024 17:27:58 +0300 Subject: [PATCH 33/35] test with REVISION --- start.sh | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/start.sh b/start.sh index 1fdd082..b93fc73 100644 --- a/start.sh +++ b/start.sh @@ -2,12 +2,10 @@ exit_trap () { local lc="$BASH_COMMAND" rc=$? - echo "Exit trap triggered with command: [$lc] and exit code [$rc]" if [ "$rc" = 0 ]; then return fi if [ "$CLEAN_GIT_LOCK_FILES" = "true" ] && [ "$IS_RETRY" != "true" ]; then - echo "Cleaning git lock files and retrying the script..." retry_script exit $? fi @@ -19,13 +17,11 @@ retry_script () { cd ../ rm -rf $CLONE_DIR export IS_RETRY=true - echo "Re-executing script with arguments: $@" - $0 "$@" + $0 $@ } git_retry () { # Retry git on exit code 128 -echo "Executing git command with retry logic: $@" ( set +e RETRY_ON_SIGNAL=128 @@ -34,31 +30,18 @@ echo "Executing git command with retry logic: $@" until [[ "$TRY_NUM" -ge "$MAX_TRIES" ]]; do "${COMMAND[@]}" # Use "${COMMAND[@]}" to preserve arguments with quotes EXIT_CODE=$? - - # Log the command output and error messages - echo "Command output (stdout):" - cat "$OUTPUT_LOG" - echo "Command error (stderr):" - cat "$ERROR_LOG" - if [[ $EXIT_CODE == 0 ]]; then - echo "Command succeeded on attempt $TRY_NUM." break elif [[ $EXIT_CODE == "$RETRY_ON_SIGNAL" ]]; then echo "Failed with Exit Code $EXIT_CODE - try $TRY_NUM " TRY_NUM=$(( ${TRY_NUM} + 1 )) sleep $RETRY_WAIT else - echo "Command failed with exit code $EXIT_CODE. No retry configured for this code." - echo "Failed command: ${COMMAND[*]}" - echo "Exit Code: $EXIT_CODE" - echo "Output Log: $OUTPUT_LOG" - echo "Error Log: $ERROR_LOG" break fi - done - return $EXIT_CODE - ) + done + return $EXIT_CODE + ) } upsert_remote_alias () { @@ -220,9 +203,8 @@ if [ -d "$CLONE_DIR" ]; then echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}, skipping tags" git_retry git fetch origin ${REVISION:+$REVISION} --no-tags ${DEPTH:+ --depth=$DEPTH} else - echo "Fetching updates from origin" - git_retry git fetch origin --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} - echo "DONE Fetching updates from origin" + echo "Fetching updates from origin${DEPTH:+ with depth $DEPTH}" + git_retry git fetch origin ${REVISION:+$REVISION} --tags --prune "+refs/tags/*:refs/tags/*" ${DEPTH:+ --depth=$DEPTH} fi git remote set-head origin --auto From b0755ade08ae5cba8adc6bfd88db00e505e5d9d6 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 16 Sep 2024 14:20:10 +0300 Subject: [PATCH 34/35] fix fetch cmd --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index b93fc73..4ebbeac 100644 --- a/start.sh +++ b/start.sh @@ -233,7 +233,7 @@ if [ -d "$CLONE_DIR" ]; then if [ -n "$REVISION" ]; then if [ -n "$DEPTH" ]; then git_retry git remote set-branches origin "*" - git_retry git origin $REVISION fetch --depth=$DEPTH + git_retry git fetch origin $REVISION --depth=$DEPTH fi git_checkout fi From 319d2e574559385ee19d64affa79c6f355e38609 Mon Sep 17 00:00:00 2001 From: eti-codefresh Date: Mon, 16 Sep 2024 15:48:15 +0300 Subject: [PATCH 35/35] Empty commit