daytona 0.126.0.alpha.6 → 0.126.0.alpha.7

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: 87e4e236cdd77c62a8f852bd7c29a0b81355fd4e43607a058cb8f60f20e9f849
4
- data.tar.gz: 686a9704d43e9888cf5232f5e7ec5a90b7f52e56279b70ea36006df7e576ca7c
3
+ metadata.gz: 2a2b373aa6722a81aaed92298ca4f706bb15c40ba99e18139bc9b08fb769aec2
4
+ data.tar.gz: f0bff8ea9b560aa0e4bd8c4ea5fdb04f2109dd015b30b85756f527279d1eec6a
5
5
  SHA512:
6
- metadata.gz: 4d9a28f1a6c1b3b1b22ec6b443767d5206fd8986102377fb6e61982a1a1fd73c870c394f5b24e6fcc9cad6e9c7f5d9f5f2bdb5d93a80c91316c42a0d6bef8214
7
- data.tar.gz: 0e25b5912fcb92c1c009ac8864bc5bfb79c5468cabac18dc60bc378d4be9d29242a5adb1015905077b3f47f1068f301e0ed91e7591986d79edfd6f00e8fa226b
6
+ metadata.gz: d93167c5fe2380a5a66ef43843b5bf5d8061d981d5742d3139977cd240b4f4fb900f0a49a2936be040930de1cd0706906afb5d274d7c4d7a57c3995440d5f4d6
7
+ data.tar.gz: 66c8ba030240184e1128704e6f96eb345dff24701c8f9456f573140c7f4a6e0f6d3c57046248a7b56e480e83765b5bcefc05e8d404f788897cb9bb3889384a49
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Daytona
4
4
  module Sdk
5
- VERSION = '0.126.0.alpha.6'
5
+ VERSION = '0.126.0.alpha.7'
6
6
  end
7
7
  end
@@ -99,7 +99,8 @@ module Daytona
99
99
 
100
100
  snapshot = snapshots_api.create_snapshot(create_snapshot_req)
101
101
 
102
- snapshot = stream_logs(snapshot, on_logs:) if on_logs
102
+ # Always wait for snapshot to be ready, regardless of on_logs
103
+ snapshot = wait_for_snapshot(snapshot, on_logs:)
103
104
 
104
105
  if [DaytonaApiClient::SnapshotState::ERROR, DaytonaApiClient::SnapshotState::BUILD_FAILED].include?(snapshot.state)
105
106
  raise Sdk::Error, "Failed to create snapshot #{snapshot.name}, reason: #{snapshot.error_reason}"
@@ -148,10 +149,13 @@ module Daytona
148
149
  # @return [DaytonaApiClient::ObjectStorageApi, nil] The object storage API client
149
150
  attr_reader :object_storage_api
150
151
 
152
+ # Wait for snapshot to reach a terminal state (ACTIVE, ERROR, or BUILD_FAILED)
153
+ # Optionally streams logs if on_logs callback is provided
154
+ #
151
155
  # @param snapshot [DaytonaApiClient::SnapshotDto]
152
- # @param on_logs [Proc]
156
+ # @param on_logs [Proc, nil]
153
157
  # @return [DaytonaApiClient::SnapshotDto]
154
- def stream_logs(snapshot, on_logs:) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
158
+ def wait_for_snapshot(snapshot, on_logs:) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
155
159
  terminal_states = [
156
160
  DaytonaApiClient::SnapshotState::ACTIVE,
157
161
  DaytonaApiClient::SnapshotState::ERROR,
@@ -160,13 +164,25 @@ module Daytona
160
164
 
161
165
  thread = nil
162
166
  previous_state = snapshot.state
167
+
168
+ # Log initial state if callback provided
169
+ on_logs&.call("Creating snapshot #{snapshot.name} (#{snapshot.state})")
170
+
163
171
  until terminal_states.include?(snapshot.state)
164
172
  Sdk.logger.debug("Waiting for snapshot to be created: #{snapshot.state}")
165
- if thread.nil? && snapshot.state != DaytonaApiClient::SnapshotState::BUILD_PENDING
173
+
174
+ # Start log streaming thread if callback provided and snapshot is building
175
+ if on_logs && thread.nil? && snapshot.state != DaytonaApiClient::SnapshotState::PENDING
166
176
  thread = start_log_streaming(snapshot, on_logs:)
167
177
  end
168
178
 
169
- on_logs.call("Creating snapshot #{snapshot.name} (#{snapshot.state})") if previous_state != snapshot.state
179
+ # Log state changes if callback provided
180
+ if on_logs && previous_state != snapshot.state
181
+ if snapshot.state != DaytonaApiClient::SnapshotState::PENDING && thread.nil?
182
+ thread = start_log_streaming(snapshot, on_logs:)
183
+ end
184
+ on_logs.call("Creating snapshot #{snapshot.name} (#{snapshot.state})")
185
+ end
170
186
 
171
187
  sleep(1)
172
188
  previous_state = snapshot.state
@@ -175,7 +191,7 @@ module Daytona
175
191
 
176
192
  thread&.join
177
193
 
178
- if snapshot.state == DaytonaApiClient::SnapshotState::ACTIVE
194
+ if on_logs && snapshot.state == DaytonaApiClient::SnapshotState::ACTIVE
179
195
  on_logs.call("Created snapshot #{snapshot.name} (#{snapshot.state})")
180
196
  end
181
197
 
data/project.json CHANGED
@@ -53,7 +53,11 @@
53
53
  "executor": "nx:run-commands",
54
54
  "options": {
55
55
  "cwd": "{projectRoot}",
56
- "command": "gem push daytona-*.gem --key rubygems --host https://rubygems.org"
56
+ "commands": [
57
+ "mkdir -p ~/.gem && echo \":rubygems: $RUBYGEMS_API_KEY\" > ~/.gem/credentials && chmod 0600 ~/.gem/credentials",
58
+ "gem push daytona-*.gem --key rubygems --host https://rubygems.org"
59
+ ],
60
+ "parallel": false
57
61
  },
58
62
  "dependsOn": [
59
63
  {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daytona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.126.0.alpha.6
4
+ version: 0.126.0.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daytona Platforms Inc.
@@ -29,28 +29,28 @@ dependencies:
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 0.126.0.alpha.6
32
+ version: 0.126.0.alpha.7
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 0.126.0.alpha.6
39
+ version: 0.126.0.alpha.7
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: daytona_toolbox_api_client
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 0.126.0.alpha.6
46
+ version: 0.126.0.alpha.7
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 0.126.0.alpha.6
53
+ version: 0.126.0.alpha.7
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: dotenv
56
56
  requirement: !ruby/object:Gem::Requirement