cfhighlander 0.13.7 → 0.13.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84d2f975929576c861a532fc889c1ebd5d17c035100f38723228e6c15d54bf3c
4
- data.tar.gz: '0949d27682a0713fa4e70bf8e3e45125c37cdeddc46a28d4a38d25576cf90bc6'
3
+ metadata.gz: 9e99bfdd32db2b3787a3ff8df606c22a7e96b20b09abcc2d5b6dfeee96777a9b
4
+ data.tar.gz: fa14fff206c44be0d5f852f656d84d9efdf77920f415a752ee9486271ee33c5a
5
5
  SHA512:
6
- metadata.gz: dac8a3f8f1e2b7352a8b87d4c90163edc3f5c592d109611d6afc86032a3185b990500ce0f4eb003113e89d96859df1d6eb8bc84e154c9e487f5f7d2fb0e89fe1
7
- data.tar.gz: 9bd7dba75a816a6a34ae4310e6bf2f757d7103a33ff8fe053d51beae1e89238c12f8588a0c4c4c31ad2691977c2a26ecbc9588e6b2164c1cd2bacfbb0e67e56d
6
+ metadata.gz: e9d26a287eeb4da12dde26b51542a95ac82aeeee7f67cdada3ca05098503ddf48c5cd62ff05f631b5ffd47e8967b1a570fe8168c8a3b7acc82cf42ff85a79a58
7
+ data.tar.gz: 0d2b98c38cb3940992dc94f2c3cab6027c02f8413acacdff03c27d2927f374f6d265cfc62ca2eeae728c378ed86cb8552fef05623c226cc58e8a24fb2e8f7f72
data/README.md CHANGED
@@ -987,6 +987,12 @@ generated files are placed
987
987
  `CFHIGHLANDER_AWS_RETRY_LIMIT` - defaults to 10. Number of retries for AWS SDK before giving up.
988
988
  AWS SDK uses exponential backoff to make the API calls
989
989
 
990
+ `CFHIGHLANDER_COMPONENT_FETCH_RETRIES` - defaults to 3. Number of retries when fetching a
991
+ component from git before giving up. Uses exponential backoff between attempts.
992
+
993
+ `CFHIGHLANDER_COMPONENT_FETCH_RETRY_DELAY` - defaults to 1. Base delay in seconds used for the
994
+ exponential backoff between component fetch retries (delay doubles with each retry).
995
+
990
996
 
991
997
 
992
998
  ## Testing components
@@ -73,7 +73,24 @@ module Cfhighlander
73
73
  puts "Trying to load #{component_name}/#{component_version} from #{git_url}##{branch} ... "
74
74
  clone_opts = { depth: 1 }
75
75
  clone_opts[:branch] = branch if not (branch.nil? or branch.empty?)
76
- Git.clone git_url, cache_path, clone_opts
76
+
77
+ max_retries = parse_non_negative_int(ENV['CFHIGHLANDER_COMPONENT_FETCH_RETRIES'], 3)
78
+ retry_delay = parse_non_negative_int(ENV['CFHIGHLANDER_COMPONENT_FETCH_RETRY_DELAY'], 1)
79
+
80
+ attempt = 0
81
+ begin
82
+ Git.clone git_url, cache_path, clone_opts
83
+ rescue StandardError => clone_error
84
+ attempt += 1
85
+ if attempt <= max_retries
86
+ delay = retry_delay * (2**(attempt - 1))
87
+ STDERR.puts "Component fetch failed (attempt #{attempt}/#{max_retries}), retrying in #{delay}s: #{clone_error}"
88
+ sleep delay
89
+ retry
90
+ else
91
+ raise clone_error
92
+ end
93
+ end
77
94
  puts "\t .. cached in #{cache_path}\n"
78
95
  # return from cache once it's cloned
79
96
  return findTemplateGit(cache_path, component_name, component_version, git_url, branch)
@@ -247,6 +264,20 @@ module Cfhighlander
247
264
  template_location: template_location)
248
265
  end
249
266
 
267
+ private
268
+
269
+ # Parses a value (typically from an env var) as a non-negative integer,
270
+ # falling back to the given default when the value is nil, empty,
271
+ # non-numeric or negative.
272
+ def parse_non_negative_int(value, default)
273
+ return default if value.nil? || value.to_s.strip.empty?
274
+
275
+ parsed = Integer(value)
276
+ parsed >= 0 ? parsed : default
277
+ rescue ArgumentError, TypeError
278
+ default
279
+ end
280
+
250
281
  end
251
282
 
252
283
  end
@@ -1,3 +1,3 @@
1
1
  module Cfhighlander
2
- VERSION="0.13.7".freeze
2
+ VERSION="0.13.8".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfhighlander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.7
4
+ version: 0.13.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Tosic
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-02-20 00:00:00.000000000 Z
13
+ date: 2026-09-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline