tapsoob 0.7.6 → 0.7.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: '025843acb6117da8a287d8045d29ee44acd503294df67d994df3340922d64202'
4
- data.tar.gz: 3633cee55115b8c561f858e430d58296ac98fd549ceaba7027d71cd1b6fcb9fc
3
+ metadata.gz: 8f457ea6567a88cb17db0cec3be46b52442d69b649db311092370af258bfead4
4
+ data.tar.gz: e2280ec6a52db877689eb292a27a31bb2dbdb5b7c1d2031611f351d6c637821d
5
5
  SHA512:
6
- metadata.gz: 1a9e68a0faf27687651a60df90e7eeccdc4235df1a4854ac1d8a2d01acdc3270a6fed3aa296c5c07cc3f292dc5754a4619cf2299f44b6f4b708a2941f2e7548c
7
- data.tar.gz: f7824a83d062c93bd339ae92c47fa74f666cb53e2e6bd77791d35a24d73438f7e48bdc73813030b2cf3dbc95fe0aafd0e26e7a5f12c57d4321cff1c4e08ed7f9
6
+ metadata.gz: 5c8e4bd03a2f55ba0594c48de850029bfcceffe82a421726fe2622bddf63e5f3253fafee4d3f747cad1aeb087877c882ef404159dda46c453c77dacd4d9ccf3f
7
+ data.tar.gz: 30f5b3000f161271665dd508a2d88b96c4bfe6917561f3d4e1706d1d80cc3ebab44d24b70a1e79b7062949e7460c67321e2a4311fb8ba52acccc8b65c639f500
data/.gitlab-ci.yml CHANGED
@@ -1,6 +1,15 @@
1
+ default:
2
+ retry:
3
+ max: 2
4
+ when:
5
+ - runner_system_failure
6
+ - stuck_or_timeout_failure
7
+ - script_failure
8
+
1
9
  stages:
2
10
  - build
3
11
  - publish
12
+ - cleanup
4
13
 
5
14
  build-jar:
6
15
  stage: build
@@ -9,16 +18,44 @@ build-jar:
9
18
  - linux
10
19
  - docker
11
20
  before_script:
12
- - apt-get update && apt-get install -y git ca-certificates
13
- - update-ca-certificates
21
+ - apt-get update && apt-get install -y git curl jq
14
22
  - gem install rake
15
23
  - mkdir -p config dist
16
24
  - echo "$WARBLE_CONFIG" > config/warble.rb
17
25
  script:
26
+ - VERSION=${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}
27
+ - |
28
+ # Find all packages with this version
29
+ echo "Checking for existing packages with version ${VERSION}..."
30
+ PACKAGES=$(curl -s --header "JOB-TOKEN: $CI_JOB_TOKEN" \
31
+ "${GITLAB_INTERNAL_API}/projects/${CI_PROJECT_ID}/packages?package_name=tapsoob&per_page=100")
32
+
33
+ # Get package IDs matching this version
34
+ MATCHING_IDS=$(echo "$PACKAGES" | jq -r --arg v "$VERSION" '.[] | select(.version == $v) | .id')
35
+ COUNT=$(echo "$MATCHING_IDS" | grep -c . || true)
36
+
37
+ echo "Found $COUNT package(s) with version ${VERSION}"
38
+
39
+ if [ "$COUNT" -gt 1 ]; then
40
+ echo "Multiple packages found, cleaning up duplicates..."
41
+ # Keep the first one, delete the rest
42
+ KEEP_ID=$(echo "$MATCHING_IDS" | head -n 1)
43
+ echo "$MATCHING_IDS" | tail -n +2 | while read -r ID; do
44
+ echo "Deleting duplicate package ID: $ID"
45
+ curl -s --request DELETE --header "JOB-TOKEN: $CI_JOB_TOKEN" \
46
+ "${GITLAB_INTERNAL_API}/projects/${CI_PROJECT_ID}/packages/${ID}"
47
+ done
48
+ echo "Kept package ID: $KEEP_ID, skipping build"
49
+ exit 0
50
+ elif [ "$COUNT" -eq 1 ]; then
51
+ echo "Package tapsoob-${VERSION}.jar already exists, skipping build"
52
+ exit 0
53
+ fi
54
+
55
+ echo "No existing package found, proceeding with build..."
18
56
  - bundle install
19
57
  - bundle exec rake jar
20
- - VERSION=${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}
21
- - 'curl --fail --verbose --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file dist/tapsoob.jar "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/tapsoob/${VERSION}/tapsoob-${VERSION}.jar"'
58
+ - 'curl --fail --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file dist/tapsoob.jar "${GITLAB_INTERNAL_API}/projects/${CI_PROJECT_ID}/packages/generic/tapsoob/${VERSION}/tapsoob-${VERSION}.jar"'
22
59
 
23
60
  publish-gem:
24
61
  stage: publish
@@ -27,8 +64,7 @@ publish-gem:
27
64
  - linux
28
65
  - docker
29
66
  before_script:
30
- - apt-get update && apt-get install -y git ca-certificates
31
- - update-ca-certificates
67
+ - apt-get update && apt-get install -y git
32
68
  - mkdir -p ~/.gem
33
69
  - |
34
70
  cat > ~/.gem/credentials << EOF
@@ -49,8 +85,7 @@ publish-gem-jruby:
49
85
  - linux
50
86
  - docker
51
87
  before_script:
52
- - apt-get update && apt-get install -y git ca-certificates
53
- - update-ca-certificates
88
+ - apt-get update && apt-get install -y git
54
89
  - mkdir -p ~/.gem
55
90
  - |
56
91
  cat > ~/.gem/credentials << EOF
@@ -62,4 +97,40 @@ publish-gem-jruby:
62
97
  - gem build tapsoob.gemspec
63
98
  - gem push tapsoob-*.gem
64
99
  rules:
65
- - if: $CI_COMMIT_TAG
100
+ - if: $CI_COMMIT_TAG
101
+
102
+ cleanup-packages:
103
+ stage: cleanup
104
+ image: alpine:latest
105
+ tags:
106
+ - linux
107
+ - docker
108
+ rules:
109
+ - if: $CI_PIPELINE_SOURCE == "schedule"
110
+ - when: manual
111
+ allow_failure: true
112
+ script:
113
+ - apk add --no-cache curl jq
114
+ - |
115
+ echo "Fetching packages..."
116
+ PACKAGES=$(curl -s --header "JOB-TOKEN: $CI_JOB_TOKEN" \
117
+ "${GITLAB_INTERNAL_API}/projects/${CI_PROJECT_ID}/packages?per_page=100")
118
+
119
+ # Get latest nightly (8 hex chars = commit SHA)
120
+ LATEST_NIGHTLY=$(echo "$PACKAGES" | jq -r '[.[] | select(.version | test("^[0-9a-f]{8}$"))] | sort_by(.created_at) | reverse | .[0].version // empty')
121
+ echo "Latest nightly to keep: $LATEST_NIGHTLY"
122
+
123
+ # Process each package
124
+ echo "$PACKAGES" | jq -r '.[] | "\(.id) \(.version)"' | while read -r ID VERSION; do
125
+ if echo "$VERSION" | grep -qE '^[0-9a-f]{8}$'; then
126
+ if [ "$VERSION" = "$LATEST_NIGHTLY" ]; then
127
+ echo "Keeping latest nightly: $VERSION"
128
+ else
129
+ echo "Deleting old nightly: $VERSION (ID: $ID)"
130
+ curl -s --request DELETE --header "JOB-TOKEN: $CI_JOB_TOKEN" \
131
+ "${GITLAB_INTERNAL_API}/projects/${CI_PROJECT_ID}/packages/${ID}"
132
+ fi
133
+ else
134
+ echo "Keeping tagged release: $VERSION"
135
+ fi
136
+ done
@@ -23,6 +23,7 @@ module Tapsoob
23
23
  option :"indexes", type: :boolean, default: false
24
24
  option :"same-db", type: :boolean, default: false
25
25
  option :parallel, desc: "Number of parallel workers for table processing (default: 1)", default: 1, type: :numeric, aliases: "-j"
26
+ option :"no-split", desc: "Disable automatic intra-table parallelization", default: false, type: :boolean
26
27
  option :progress, desc: "Show progress", default: true, type: :boolean
27
28
  option :debug, desc: "Enable debug messages", default: false, type: :boolean
28
29
  def pull(dump_path, database_url)
@@ -92,6 +93,7 @@ module Tapsoob
92
93
  # Pull only options
93
94
  opts[:indexes] = options[:"indexes"] if options.key?(:"indexes")
94
95
  opts[:same_db] = options[:"same-db"] if options.key?(:"same-db")
96
+ opts[:no_split] = options[:"no-split"] if options.key?(:"no-split")
95
97
 
96
98
  # Push only options
97
99
  opts[:purge] = options[:purge] if options.key?(:purge)
@@ -154,6 +154,9 @@ module Tapsoob
154
154
  # (no dump_path means we're outputting JSON directly, which can't be safely parallelized)
155
155
  return 1 if dump_path.nil?
156
156
 
157
+ # Disable intra-table parallelization when --no-split is passed
158
+ return 1 if opts[:no_split]
159
+
157
160
  # TEMPORARILY RE-ENABLED for debugging
158
161
  # return 1 if self.is_a?(Tapsoob::Operation::Push)
159
162
 
@@ -40,7 +40,7 @@ module Tapsoob
40
40
  end
41
41
 
42
42
  def pull_schema
43
- log.info "Receiving schema"
43
+ log.info "Receiving schema" if opts[:progress]
44
44
  Tapsoob::ProgressEvent.schema_start(tables.size)
45
45
 
46
46
  progress = opts[:progress] ? Tapsoob::Progress::Bar.new('Schema', tables.size) : nil
@@ -60,9 +60,9 @@ module Tapsoob
60
60
  end
61
61
 
62
62
  def pull_data
63
- log.info "Receiving data"
63
+ log.info "Receiving data" if opts[:progress]
64
64
 
65
- log.info "#{tables.size} tables, #{format_number(record_count)} records"
65
+ log.info "#{tables.size} tables, #{format_number(record_count)} records" if opts[:progress]
66
66
  Tapsoob::ProgressEvent.data_start(tables.size, record_count)
67
67
 
68
68
  if parallel?
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.7.6".freeze
3
+ VERSION = "0.7.8".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapsoob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Félix Bellanger
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-12-07 00:00:00.000000000 Z
12
+ date: 2026-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel