skypilot-nightly 1.0.0.dev20250716__py3-none-any.whl → 1.0.0.dev20250717__py3-none-any.whl
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.
- sky/__init__.py +4 -2
- sky/backends/backend.py +8 -4
- sky/backends/cloud_vm_ray_backend.py +50 -1
- sky/backends/docker_utils.py +1 -1
- sky/backends/local_docker_backend.py +2 -1
- sky/catalog/common.py +60 -50
- sky/catalog/data_fetchers/fetch_gcp.py +1 -0
- sky/catalog/gcp_catalog.py +24 -7
- sky/catalog/kubernetes_catalog.py +5 -1
- sky/client/cli/command.py +180 -77
- sky/client/cli/git.py +549 -0
- sky/client/common.py +1 -1
- sky/clouds/gcp.py +1 -1
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/chunks/4869.bdd42f14b51d1d6f.js +16 -0
- sky/dashboard/out/_next/static/chunks/{webpack-3fad5d4a0541a02d.js → webpack-c3b45b7b0eaef66f.js} +1 -1
- sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
- sky/dashboard/out/clusters/[cluster].html +1 -1
- sky/dashboard/out/clusters.html +1 -1
- sky/dashboard/out/config.html +1 -1
- sky/dashboard/out/index.html +1 -1
- sky/dashboard/out/infra/[context].html +1 -1
- sky/dashboard/out/infra.html +1 -1
- sky/dashboard/out/jobs/[job].html +1 -1
- sky/dashboard/out/jobs.html +1 -1
- sky/dashboard/out/users.html +1 -1
- sky/dashboard/out/volumes.html +1 -1
- sky/dashboard/out/workspace/new.html +1 -1
- sky/dashboard/out/workspaces/[name].html +1 -1
- sky/dashboard/out/workspaces.html +1 -1
- sky/exceptions.py +5 -0
- sky/execution.py +1 -1
- sky/provision/kubernetes/utils.py +6 -0
- sky/server/common.py +4 -3
- sky/setup_files/MANIFEST.in +1 -0
- sky/setup_files/dependencies.py +2 -0
- sky/task.py +12 -2
- sky/utils/command_runner.py +144 -35
- sky/utils/controller_utils.py +4 -3
- sky/utils/git.py +9 -0
- sky/utils/git_clone.sh +460 -0
- sky/utils/schemas.py +15 -1
- {skypilot_nightly-1.0.0.dev20250716.dist-info → skypilot_nightly-1.0.0.dev20250717.dist-info}/METADATA +3 -1
- {skypilot_nightly-1.0.0.dev20250716.dist-info → skypilot_nightly-1.0.0.dev20250717.dist-info}/RECORD +50 -47
- sky/dashboard/out/_next/static/chunks/4869.c139c0124e677fc8.js +0 -16
- /sky/dashboard/out/_next/static/{gVXjeFhvtWXyOsx9xYNvM → Et5IQ5Y3WvH608nXClo4z}/_buildManifest.js +0 -0
- /sky/dashboard/out/_next/static/{gVXjeFhvtWXyOsx9xYNvM → Et5IQ5Y3WvH608nXClo4z}/_ssgManifest.js +0 -0
- {skypilot_nightly-1.0.0.dev20250716.dist-info → skypilot_nightly-1.0.0.dev20250717.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250716.dist-info → skypilot_nightly-1.0.0.dev20250717.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250716.dist-info → skypilot_nightly-1.0.0.dev20250717.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250716.dist-info → skypilot_nightly-1.0.0.dev20250717.dist-info}/top_level.txt +0 -0
sky/client/cli/git.py
ADDED
@@ -0,0 +1,549 @@
|
|
1
|
+
"""Git utilities for SkyPilot."""
|
2
|
+
import enum
|
3
|
+
import os
|
4
|
+
import re
|
5
|
+
from typing import List, Optional, Union
|
6
|
+
|
7
|
+
import git
|
8
|
+
import requests
|
9
|
+
|
10
|
+
from sky import exceptions
|
11
|
+
from sky import sky_logging
|
12
|
+
|
13
|
+
logger = sky_logging.init_logger(__name__)
|
14
|
+
|
15
|
+
|
16
|
+
class GitRefType(enum.Enum):
|
17
|
+
"""Type of git reference."""
|
18
|
+
|
19
|
+
BRANCH = 'branch'
|
20
|
+
TAG = 'tag'
|
21
|
+
COMMIT = 'commit'
|
22
|
+
|
23
|
+
|
24
|
+
class GitUrlInfo:
|
25
|
+
"""Information extracted from a git URL."""
|
26
|
+
|
27
|
+
def __init__(self,
|
28
|
+
host: str,
|
29
|
+
path: str,
|
30
|
+
protocol: str,
|
31
|
+
user: Optional[str] = None,
|
32
|
+
port: Optional[int] = None):
|
33
|
+
self.host = host
|
34
|
+
# Repository path (e.g., 'user/repo' or 'org/subgroup/repo').
|
35
|
+
# The path is the part after the host.
|
36
|
+
self.path = path
|
37
|
+
# 'https', 'ssh'
|
38
|
+
self.protocol = protocol
|
39
|
+
# SSH username
|
40
|
+
self.user = user
|
41
|
+
self.port = port
|
42
|
+
|
43
|
+
|
44
|
+
class GitCloneInfo:
|
45
|
+
"""Information about a git clone."""
|
46
|
+
|
47
|
+
def __init__(self,
|
48
|
+
url: str,
|
49
|
+
envs: Optional[dict] = None,
|
50
|
+
token: Optional[str] = None,
|
51
|
+
ssh_key: Optional[str] = None):
|
52
|
+
self.url = url
|
53
|
+
self.envs = envs
|
54
|
+
self.token = token
|
55
|
+
self.ssh_key = ssh_key
|
56
|
+
|
57
|
+
|
58
|
+
class GitRepo:
|
59
|
+
"""Git utilities for SkyPilot."""
|
60
|
+
|
61
|
+
def __init__(self,
|
62
|
+
repo_url: str,
|
63
|
+
ref: str = 'main',
|
64
|
+
git_token: Optional[str] = None,
|
65
|
+
git_ssh_key_path: Optional[str] = None):
|
66
|
+
"""Initialize Git utility.
|
67
|
+
|
68
|
+
Args:
|
69
|
+
repo_url: Git repository URL.
|
70
|
+
ref: Git reference (branch, tag, or commit hash).
|
71
|
+
git_token: GitHub token for private repositories.
|
72
|
+
git_ssh_key_path: Path to SSH private key for authentication.
|
73
|
+
"""
|
74
|
+
self.repo_url = repo_url
|
75
|
+
self.ref = ref
|
76
|
+
self.git_token = git_token
|
77
|
+
self.git_ssh_key_path = git_ssh_key_path
|
78
|
+
|
79
|
+
# Parse URL during initialization to catch format errors early
|
80
|
+
self._parsed_url = self._parse_git_url(self.repo_url)
|
81
|
+
|
82
|
+
def _parse_git_url(self, url: str) -> GitUrlInfo:
|
83
|
+
"""Parse git URL into components.
|
84
|
+
|
85
|
+
Supports various git URL formats:
|
86
|
+
- HTTPS: https://github.com/user/repo.git
|
87
|
+
- SSH: git@github.com:user/repo.git (SCP-like)
|
88
|
+
- SSH full: ssh://git@github.com/user/repo.git
|
89
|
+
- SSH with port: ssh://git@github.com:2222/user/repo.git
|
90
|
+
|
91
|
+
Args:
|
92
|
+
url: Git repository URL in any supported format.
|
93
|
+
|
94
|
+
Returns:
|
95
|
+
GitUrlInfo with parsed components.
|
96
|
+
|
97
|
+
Raises:
|
98
|
+
exceptions.GitError: If URL format is not supported.
|
99
|
+
"""
|
100
|
+
# Remove trailing .git if present
|
101
|
+
clean_url = url.rstrip('/')
|
102
|
+
if clean_url.endswith('.git'):
|
103
|
+
clean_url = clean_url[:-4]
|
104
|
+
|
105
|
+
# Pattern for HTTPS/HTTP URLs
|
106
|
+
https_pattern = r'^(https?)://(?:([^@]+)@)?([^:/]+)(?::(\d+))?/(.+)$'
|
107
|
+
https_match = re.match(https_pattern, clean_url)
|
108
|
+
|
109
|
+
if https_match:
|
110
|
+
protocol, user, host, port_str, path = https_match.groups()
|
111
|
+
port = int(port_str) if port_str else None
|
112
|
+
|
113
|
+
# Validate that path is not empty
|
114
|
+
if not path or path == '/':
|
115
|
+
raise exceptions.GitError(
|
116
|
+
f'Invalid repository path in URL: {url}')
|
117
|
+
|
118
|
+
return GitUrlInfo(host=host,
|
119
|
+
path=path,
|
120
|
+
protocol=protocol,
|
121
|
+
user=user,
|
122
|
+
port=port)
|
123
|
+
|
124
|
+
# Pattern for SSH URLs (full format)
|
125
|
+
ssh_full_pattern = r'^ssh://(?:([^@]+)@)?([^:/]+)(?::(\d+))?/(.+)$'
|
126
|
+
ssh_full_match = re.match(ssh_full_pattern, clean_url)
|
127
|
+
|
128
|
+
if ssh_full_match:
|
129
|
+
user, host, port_str, path = ssh_full_match.groups()
|
130
|
+
port = int(port_str) if port_str else None
|
131
|
+
|
132
|
+
# Validate that path is not empty
|
133
|
+
if not path or path == '/':
|
134
|
+
raise exceptions.GitError(
|
135
|
+
f'Invalid repository path in SSH URL: {url}')
|
136
|
+
|
137
|
+
return GitUrlInfo(host=host,
|
138
|
+
path=path,
|
139
|
+
protocol='ssh',
|
140
|
+
user=user,
|
141
|
+
port=port)
|
142
|
+
|
143
|
+
# Pattern for SSH SCP-like format (exclude URLs with ://)
|
144
|
+
scp_pattern = r'^(?:([^@]+)@)?([^:/]+):(.+)$'
|
145
|
+
scp_match = re.match(scp_pattern, clean_url)
|
146
|
+
|
147
|
+
# Make sure it's not a URL with protocol (should not contain ://)
|
148
|
+
if scp_match and '://' not in clean_url:
|
149
|
+
user, host, path = scp_match.groups()
|
150
|
+
|
151
|
+
# Validate that path is not empty
|
152
|
+
if not path:
|
153
|
+
raise exceptions.GitError(
|
154
|
+
f'Invalid repository path in SSH URL: {url}')
|
155
|
+
|
156
|
+
return GitUrlInfo(host=host,
|
157
|
+
path=path,
|
158
|
+
protocol='ssh',
|
159
|
+
user=user,
|
160
|
+
port=None)
|
161
|
+
|
162
|
+
raise exceptions.GitError(
|
163
|
+
f'Unsupported git URL format: {url}. '
|
164
|
+
'Supported formats: https://host/owner/repo, '
|
165
|
+
'ssh://user@host/owner/repo, user@host:owner/repo')
|
166
|
+
|
167
|
+
def get_https_url(self, with_token: bool = False) -> str:
|
168
|
+
"""Get HTTPS URL for the repository.
|
169
|
+
|
170
|
+
Args:
|
171
|
+
with_token: If True, includes token in URL for authentication
|
172
|
+
|
173
|
+
Returns:
|
174
|
+
HTTPS URL string.
|
175
|
+
"""
|
176
|
+
port_str = f':{self._parsed_url.port}' if self._parsed_url.port else ''
|
177
|
+
path = self._parsed_url.path
|
178
|
+
# Remove .git suffix if present (but not individual characters)
|
179
|
+
if path.endswith('.git'):
|
180
|
+
path = path[:-4]
|
181
|
+
|
182
|
+
if with_token and self.git_token:
|
183
|
+
return f'https://{self.git_token}@{self._parsed_url.host}' \
|
184
|
+
f'{port_str}/{path}.git'
|
185
|
+
return f'https://{self._parsed_url.host}{port_str}/{path}.git'
|
186
|
+
|
187
|
+
def get_ssh_url(self) -> str:
|
188
|
+
"""Get SSH URL for the repository in full format.
|
189
|
+
|
190
|
+
Returns:
|
191
|
+
SSH URL string in full format.
|
192
|
+
"""
|
193
|
+
# Use original user from URL, or default to 'git'
|
194
|
+
ssh_user = self._parsed_url.user or 'git'
|
195
|
+
port_str = f':{self._parsed_url.port}' if self._parsed_url.port else ''
|
196
|
+
path = self._parsed_url.path
|
197
|
+
# Remove .git suffix if present (but not individual characters)
|
198
|
+
if path.endswith('.git'):
|
199
|
+
path = path[:-4]
|
200
|
+
return f'ssh://{ssh_user}@{self._parsed_url.host}{port_str}/{path}.git'
|
201
|
+
|
202
|
+
def get_repo_clone_info(self) -> GitCloneInfo:
|
203
|
+
"""Validate the repository access with comprehensive authentication
|
204
|
+
and return the appropriate clone info.
|
205
|
+
|
206
|
+
This method implements a sequential validation approach:
|
207
|
+
1. Try public access (no authentication)
|
208
|
+
2. If has token and URL is https, try token access
|
209
|
+
3. If URL is ssh, try ssh access with user provided ssh key or
|
210
|
+
default ssh credential
|
211
|
+
|
212
|
+
Returns:
|
213
|
+
GitCloneInfo instance with successful access method.
|
214
|
+
|
215
|
+
Raises:
|
216
|
+
exceptions.GitError: If the git URL format is invalid or
|
217
|
+
the repository cannot be accessed.
|
218
|
+
"""
|
219
|
+
logger.debug(f'Validating access to {self._parsed_url.host}'
|
220
|
+
f'/{self._parsed_url.path}')
|
221
|
+
|
222
|
+
# Step 1: Try public access first (most common case)
|
223
|
+
try:
|
224
|
+
https_url = self.get_https_url()
|
225
|
+
logger.debug(f'Trying public HTTPS access to {https_url}')
|
226
|
+
|
227
|
+
# Use /info/refs endpoint to check public access.
|
228
|
+
# This is more reliable than git ls-remote as it doesn't
|
229
|
+
# use local git config.
|
230
|
+
stripped_url = https_url.rstrip('/')
|
231
|
+
info_refs_url = f'{stripped_url}/info/refs?service=git-upload-pack'
|
232
|
+
|
233
|
+
# Make a simple HTTP request without any authentication
|
234
|
+
response = requests.get(
|
235
|
+
info_refs_url,
|
236
|
+
timeout=10,
|
237
|
+
allow_redirects=True,
|
238
|
+
# Ensure no local credentials are used
|
239
|
+
auth=None)
|
240
|
+
|
241
|
+
if response.status_code == 200:
|
242
|
+
logger.info(
|
243
|
+
f'Successfully validated repository {https_url} access '
|
244
|
+
'using public access')
|
245
|
+
return GitCloneInfo(url=https_url)
|
246
|
+
except Exception as e: # pylint: disable=broad-except
|
247
|
+
logger.debug(f'Public access failed: {str(e)}')
|
248
|
+
|
249
|
+
# Step 2: Try with token if provided
|
250
|
+
if self.git_token and self._parsed_url.protocol == 'https':
|
251
|
+
try:
|
252
|
+
https_url = self.get_https_url()
|
253
|
+
auth_url = self.get_https_url(with_token=True)
|
254
|
+
logger.debug(f'Trying token authentication to {https_url}')
|
255
|
+
git_cmd = git.cmd.Git()
|
256
|
+
git_cmd.ls_remote(auth_url)
|
257
|
+
logger.info(
|
258
|
+
f'Successfully validated repository {https_url} access '
|
259
|
+
'using token authentication')
|
260
|
+
return GitCloneInfo(url=https_url, token=self.git_token)
|
261
|
+
except Exception as e:
|
262
|
+
logger.info(f'Token access failed: {str(e)}')
|
263
|
+
raise exceptions.GitError(
|
264
|
+
f'Failed to access repository {self.repo_url} using token '
|
265
|
+
'authentication. Please verify your token and repository '
|
266
|
+
f'access permissions. Original error: {str(e)}') from e
|
267
|
+
|
268
|
+
# Step 3: Try SSH access with available keys
|
269
|
+
if self._parsed_url.protocol == 'ssh':
|
270
|
+
try:
|
271
|
+
ssh_url = self.get_ssh_url()
|
272
|
+
|
273
|
+
# Get SSH key info using the combined method
|
274
|
+
ssh_key_info = self._get_ssh_key_info()
|
275
|
+
|
276
|
+
if ssh_key_info:
|
277
|
+
key_path, key_content = ssh_key_info
|
278
|
+
git_ssh_command = f'ssh -F none -i {key_path} ' \
|
279
|
+
'-o StrictHostKeyChecking=no ' \
|
280
|
+
'-o UserKnownHostsFile=/dev/null ' \
|
281
|
+
'-o IdentitiesOnly=yes'
|
282
|
+
ssh_env = {'GIT_SSH_COMMAND': git_ssh_command}
|
283
|
+
|
284
|
+
logger.debug(f'Trying SSH authentication to {ssh_url} '
|
285
|
+
f'with {key_path}')
|
286
|
+
git_cmd = git.cmd.Git()
|
287
|
+
git_cmd.update_environment(**ssh_env)
|
288
|
+
git_cmd.ls_remote(ssh_url)
|
289
|
+
logger.info(
|
290
|
+
f'Successfully validated repository {ssh_url} access '
|
291
|
+
f'using SSH key: {key_path}')
|
292
|
+
return GitCloneInfo(url=ssh_url,
|
293
|
+
ssh_key=key_content,
|
294
|
+
envs=ssh_env)
|
295
|
+
else:
|
296
|
+
raise exceptions.GitError(
|
297
|
+
f'No SSH keys found for {self.repo_url}.')
|
298
|
+
except Exception as e: # pylint: disable=broad-except
|
299
|
+
raise exceptions.GitError(
|
300
|
+
f'Failed to access repository {self.repo_url} using '
|
301
|
+
'SSH key authentication. Please verify your SSH key and '
|
302
|
+
'repository access permissions. '
|
303
|
+
f'Original error: {str(e)}') from e
|
304
|
+
|
305
|
+
# If we get here, no authentication methods are available
|
306
|
+
raise exceptions.GitError(
|
307
|
+
f'Failed to access repository {self.repo_url}. '
|
308
|
+
'If this is a private repository, please provide authentication'
|
309
|
+
f' using either: GIT_TOKEN for token-based access, or'
|
310
|
+
f' GIT_SSH_KEY_PATH for SSH access.')
|
311
|
+
|
312
|
+
def _parse_ssh_config(self) -> Optional[str]:
|
313
|
+
"""Parse SSH config file to find IdentityFile for the target host.
|
314
|
+
|
315
|
+
Returns:
|
316
|
+
Path to SSH private key specified in config, or None if not found.
|
317
|
+
"""
|
318
|
+
ssh_config_path = os.path.expanduser('~/.ssh/config')
|
319
|
+
if not os.path.exists(ssh_config_path):
|
320
|
+
logger.debug('SSH config file ~/.ssh/config does not exist')
|
321
|
+
return None
|
322
|
+
|
323
|
+
try:
|
324
|
+
# Try to use paramiko's SSH config parser if available
|
325
|
+
try:
|
326
|
+
import paramiko # pylint: disable=import-outside-toplevel
|
327
|
+
ssh_config = paramiko.SSHConfig()
|
328
|
+
with open(ssh_config_path, 'r', encoding='utf-8') as f:
|
329
|
+
ssh_config.parse(f)
|
330
|
+
# Get config for the target host
|
331
|
+
host_config = ssh_config.lookup(self._parsed_url.host)
|
332
|
+
|
333
|
+
# Look for identity files in the config
|
334
|
+
identity_files: Union[str, List[str]] = host_config.get(
|
335
|
+
'identityfile', [])
|
336
|
+
if not isinstance(identity_files, list):
|
337
|
+
identity_files = [identity_files]
|
338
|
+
|
339
|
+
# Find the first existing identity file
|
340
|
+
for identity_file in identity_files:
|
341
|
+
key_path = os.path.expanduser(identity_file)
|
342
|
+
if os.path.exists(key_path):
|
343
|
+
logger.debug(f'Found SSH key in config for '
|
344
|
+
f'{self._parsed_url.host}: {key_path}')
|
345
|
+
return key_path
|
346
|
+
|
347
|
+
logger.debug(f'No valid SSH keys found in config for host: '
|
348
|
+
f'{self._parsed_url.host}')
|
349
|
+
return None
|
350
|
+
|
351
|
+
except ImportError:
|
352
|
+
logger.debug('paramiko not available')
|
353
|
+
return None
|
354
|
+
|
355
|
+
except Exception as e: # pylint: disable=broad-except
|
356
|
+
logger.debug(f'Error parsing SSH config: {str(e)}')
|
357
|
+
return None
|
358
|
+
|
359
|
+
def _get_ssh_key_info(self) -> Optional[tuple]:
|
360
|
+
"""Get SSH key path and content using comprehensive strategy.
|
361
|
+
|
362
|
+
Strategy:
|
363
|
+
1. Check provided git_ssh_key_path if given
|
364
|
+
2. Check SSH config for host-specific IdentityFile
|
365
|
+
3. Search for common SSH key types in ~/.ssh/ directory
|
366
|
+
|
367
|
+
Returns:
|
368
|
+
Tuple of (key_path, key_content) if found, None otherwise.
|
369
|
+
"""
|
370
|
+
# Step 1: Check provided SSH key path first
|
371
|
+
if self.git_ssh_key_path:
|
372
|
+
try:
|
373
|
+
key_path = os.path.expanduser(self.git_ssh_key_path)
|
374
|
+
|
375
|
+
# Validate SSH key before using it
|
376
|
+
if not os.path.exists(key_path):
|
377
|
+
raise exceptions.GitError(
|
378
|
+
f'SSH key not found at path: {self.git_ssh_key_path}')
|
379
|
+
|
380
|
+
# Check key permissions
|
381
|
+
key_stat = os.stat(key_path)
|
382
|
+
if key_stat.st_mode & 0o077:
|
383
|
+
logger.warning(
|
384
|
+
f'SSH key {key_path} has too open permissions. '
|
385
|
+
f'Recommended: chmod 600 {key_path}')
|
386
|
+
|
387
|
+
# Check if it's a valid private key and read content
|
388
|
+
with open(key_path, 'r', encoding='utf-8') as f:
|
389
|
+
key_content = f.read()
|
390
|
+
if not (key_content.startswith('-----BEGIN') and
|
391
|
+
'PRIVATE KEY' in key_content):
|
392
|
+
raise exceptions.GitError(
|
393
|
+
f'SSH key {key_path} is invalid.')
|
394
|
+
|
395
|
+
logger.debug(f'Using provided SSH key: {key_path}')
|
396
|
+
return (key_path, key_content)
|
397
|
+
except Exception as e: # pylint: disable=broad-except
|
398
|
+
raise exceptions.GitError(
|
399
|
+
f'Validate provided SSH key error: {str(e)}') from e
|
400
|
+
|
401
|
+
# Step 2: Check SSH config for host-specific configuration
|
402
|
+
config_key_path = self._parse_ssh_config()
|
403
|
+
if config_key_path:
|
404
|
+
try:
|
405
|
+
with open(config_key_path, 'r', encoding='utf-8') as f:
|
406
|
+
key_content = f.read()
|
407
|
+
logger.debug(f'Using SSH key from config: {config_key_path}')
|
408
|
+
return (config_key_path, key_content)
|
409
|
+
except Exception as e: # pylint: disable=broad-except
|
410
|
+
logger.debug(f'Could not read SSH key: {str(e)}')
|
411
|
+
|
412
|
+
# Step 3: Search for default SSH keys
|
413
|
+
ssh_dir = os.path.expanduser('~/.ssh')
|
414
|
+
if not os.path.exists(ssh_dir):
|
415
|
+
logger.debug('SSH directory ~/.ssh does not exist')
|
416
|
+
return None
|
417
|
+
|
418
|
+
# Common SSH key file names in order of preference
|
419
|
+
key_candidates = [
|
420
|
+
'id_rsa', # Most common
|
421
|
+
'id_ed25519', # Modern, recommended
|
422
|
+
]
|
423
|
+
|
424
|
+
for key_name in key_candidates:
|
425
|
+
private_key_path = os.path.join(ssh_dir, key_name)
|
426
|
+
|
427
|
+
# Check if both private and public keys exist
|
428
|
+
if not os.path.exists(private_key_path):
|
429
|
+
continue
|
430
|
+
|
431
|
+
# Check private key permissions
|
432
|
+
try:
|
433
|
+
key_stat = os.stat(private_key_path)
|
434
|
+
if key_stat.st_mode & 0o077:
|
435
|
+
logger.warning(
|
436
|
+
f'SSH key {private_key_path} has too open permissions. '
|
437
|
+
f'Consider: chmod 600 {private_key_path}')
|
438
|
+
|
439
|
+
# Validate private key format and read content
|
440
|
+
with open(private_key_path, 'r', encoding='utf-8') as f:
|
441
|
+
key_content = f.read()
|
442
|
+
if not (key_content.startswith('-----BEGIN') and
|
443
|
+
'PRIVATE KEY' in key_content):
|
444
|
+
logger.debug(f'SSH key {private_key_path} is invalid.')
|
445
|
+
continue
|
446
|
+
|
447
|
+
logger.debug(f'Discovered default SSH key: {private_key_path}')
|
448
|
+
return (private_key_path, key_content)
|
449
|
+
|
450
|
+
except Exception as e: # pylint: disable=broad-except
|
451
|
+
logger.debug(
|
452
|
+
f'Error checking SSH key {private_key_path}: {str(e)}')
|
453
|
+
continue
|
454
|
+
|
455
|
+
logger.debug('No suitable SSH keys found')
|
456
|
+
return None
|
457
|
+
|
458
|
+
def get_ref_type(self) -> GitRefType:
|
459
|
+
"""Get the type of the reference.
|
460
|
+
|
461
|
+
Returns:
|
462
|
+
GitRefType.COMMIT if it's a commit hash,
|
463
|
+
GitRefType.BRANCH if it's a branch,
|
464
|
+
GitRefType.TAG if it's a tag.
|
465
|
+
|
466
|
+
Raises:
|
467
|
+
exceptions.GitError: If the reference is invalid.
|
468
|
+
"""
|
469
|
+
clone_info = self.get_repo_clone_info()
|
470
|
+
git_cmd = git.cmd.Git()
|
471
|
+
if clone_info.envs:
|
472
|
+
git_cmd.update_environment(**clone_info.envs)
|
473
|
+
|
474
|
+
try:
|
475
|
+
# Get all remote refs
|
476
|
+
refs = git_cmd.ls_remote(clone_info.url).split('\n')
|
477
|
+
|
478
|
+
# Collect all commit hashes from refs
|
479
|
+
all_commit_hashes = set()
|
480
|
+
|
481
|
+
# Check if it's a branch or tag name
|
482
|
+
for ref in refs:
|
483
|
+
if not ref:
|
484
|
+
continue
|
485
|
+
hash_val, ref_name = ref.split('\t')
|
486
|
+
|
487
|
+
# Store the commit hash for later validation
|
488
|
+
all_commit_hashes.add(hash_val)
|
489
|
+
|
490
|
+
# Check if it's a branch
|
491
|
+
if ref_name.startswith(
|
492
|
+
'refs/heads/') and ref_name[11:] == self.ref:
|
493
|
+
return GitRefType.BRANCH
|
494
|
+
|
495
|
+
# Check if it's a tag
|
496
|
+
if ref_name.startswith(
|
497
|
+
'refs/tags/') and ref_name[10:] == self.ref:
|
498
|
+
return GitRefType.TAG
|
499
|
+
|
500
|
+
# If we get here, it's not a branch or tag name
|
501
|
+
# Check if it looks like a commit hash (hex string)
|
502
|
+
if len(self.ref) >= 4 and all(
|
503
|
+
c in '0123456789abcdef' for c in self.ref.lower()):
|
504
|
+
# First check if it's a complete match with any known commit
|
505
|
+
if self.ref in all_commit_hashes:
|
506
|
+
logger.debug(f'Found exact commit hash match: {self.ref}')
|
507
|
+
return GitRefType.COMMIT
|
508
|
+
|
509
|
+
# Check if it's a prefix match with any known commit
|
510
|
+
matching_commits = [
|
511
|
+
h for h in all_commit_hashes if h.startswith(self.ref)
|
512
|
+
]
|
513
|
+
if len(matching_commits) == 1:
|
514
|
+
logger.debug(
|
515
|
+
f'Found commit hash prefix match: {self.ref} -> '
|
516
|
+
f'{matching_commits[0]}')
|
517
|
+
return GitRefType.COMMIT
|
518
|
+
elif len(matching_commits) > 1:
|
519
|
+
# Multiple matches - ambiguous
|
520
|
+
raise exceptions.GitError(
|
521
|
+
f'Ambiguous commit hash {self.ref!r}. '
|
522
|
+
f'Multiple commits match: '
|
523
|
+
f'{", ".join(matching_commits[:5])}...')
|
524
|
+
|
525
|
+
# If no match found in ls-remote output, we can't verify
|
526
|
+
# the commit exists. This could be a valid commit that's
|
527
|
+
# not at the tip of any branch/tag. We'll assume it's valid
|
528
|
+
# if it looks like a commit hash and let git handle validation
|
529
|
+
# during clone.
|
530
|
+
logger.debug(f'Commit hash not found in ls-remote output, '
|
531
|
+
f'assuming valid: {self.ref}')
|
532
|
+
logger.warning(
|
533
|
+
f'Cannot verify commit {self.ref} exists - it may be a '
|
534
|
+
'commit in history not at any branch/tag tip')
|
535
|
+
return GitRefType.COMMIT
|
536
|
+
|
537
|
+
# If it's not a branch, tag, or hex string, it's invalid
|
538
|
+
raise exceptions.GitError(
|
539
|
+
f'Git reference {self.ref!r} not found. '
|
540
|
+
'Please provide a valid branch, tag, or commit hash.')
|
541
|
+
|
542
|
+
except git.exc.GitCommandError as e:
|
543
|
+
if not (self.git_token or self.git_ssh_key_path):
|
544
|
+
raise exceptions.GitError(
|
545
|
+
'Failed to check repository. If this is a private '
|
546
|
+
'repository, please provide authentication using either '
|
547
|
+
'GIT_TOKEN or GIT_SSH_KEY_PATH.') from e
|
548
|
+
raise exceptions.GitError(
|
549
|
+
f'Failed to check git reference: {str(e)}') from e
|
sky/client/common.py
CHANGED
@@ -272,7 +272,7 @@ def upload_mounts_to_api_server(dag: 'sky.Dag',
|
|
272
272
|
upload_list = []
|
273
273
|
for task_ in dag.tasks:
|
274
274
|
task_.file_mounts_mapping = {}
|
275
|
-
if task_.workdir:
|
275
|
+
if task_.workdir and isinstance(task_.workdir, str):
|
276
276
|
workdir = task_.workdir
|
277
277
|
assert os.path.isabs(workdir)
|
278
278
|
upload_list.append(workdir)
|
sky/clouds/gcp.py
CHANGED
@@ -1174,7 +1174,7 @@ class GCP(clouds.Cloud):
|
|
1174
1174
|
# These series don't support pd-standard, use pd-balanced for LOW.
|
1175
1175
|
_propagate_disk_type(
|
1176
1176
|
lowest=tier2name[resources_utils.DiskTier.MEDIUM])
|
1177
|
-
if instance_type.startswith('a3-ultragpu'):
|
1177
|
+
if instance_type.startswith('a3-ultragpu') or series == 'n4':
|
1178
1178
|
# a3-ultragpu instances only support hyperdisk-balanced.
|
1179
1179
|
_propagate_disk_type(all='hyperdisk-balanced')
|
1180
1180
|
|
sky/dashboard/out/404.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/dashboard/_next/static/css/219887b94512388c.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/219887b94512388c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/dashboard/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/dashboard/_next/static/chunks/webpack-
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/dashboard/_next/static/css/219887b94512388c.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/219887b94512388c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/dashboard/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/dashboard/_next/static/chunks/webpack-c3b45b7b0eaef66f.js" defer=""></script><script src="/dashboard/_next/static/chunks/framework-efc06c2733009cd3.js" defer=""></script><script src="/dashboard/_next/static/chunks/main-c0a4f1ea606d48d2.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_app-771a40cde532309b.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-c72a1f77a3c0be1b.js" defer=""></script><script src="/dashboard/_next/static/Et5IQ5Y3WvH608nXClo4z/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/Et5IQ5Y3WvH608nXClo4z/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"Et5IQ5Y3WvH608nXClo4z","assetPrefix":"/dashboard","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4869,430],{1260:function(e,s,l){"use strict";l.d(s,{Z:function(){return t}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let t=(0,l(998).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7603:function(e,s,l){"use strict";l.d(s,{Z:function(){return t}});/**
|
7
|
+
* @license lucide-react v0.407.0 - ISC
|
8
|
+
*
|
9
|
+
* This source code is licensed under the ISC license.
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
11
|
+
*/let t=(0,l(998).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1812:function(e,s,l){"use strict";l.d(s,{X:function(){return n}});var t=l(5893),r=l(7294);let a=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},n=e=>{let{error:s,title:l="Error",onDismiss:n}=e,[i,c]=(0,r.useState)(!1);if((0,r.useEffect)(()=>{s&&c(!1)},[s]),!s||i)return null;let o="string"==typeof s?s:a(s);return(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsxs)("div",{className:"text-sm text-red-800",children:[(0,t.jsxs)("strong",{children:[l,":"]})," ",o]})})]}),(0,t.jsx)("button",{onClick:()=>{c(!0),n&&n()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,t.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},2077:function(e,s,l){"use strict";l.r(s),l.d(s,{Workspaces:function(){return M}});var t=l(5893),r=l(7294),a=l(1163),n=l(3266),i=l(8969),c=l(7324),o=l(7673),d=l(8764),u=l(803),m=l(5739),x=l(1272),h=l(326);l(3850);var p=l(1812),g=l(3626),f=l(1260);/**
|
12
|
+
* @license lucide-react v0.407.0 - ISC
|
13
|
+
*
|
14
|
+
* This source code is licensed under the ISC license.
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
16
|
+
*/let j=(0,l(998).Z)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);var v=l(7603),b=l(3001),w=l(938),N=l(6378),k=l(1214),y=l(6856),C=l(7145),L=l(4545),S=l(3225),z=l(1664),Z=l.n(z);let D=e=>{let{isPrivate:s}=e;return s?(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300",children:"Private"}):(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-300",children:"Public"})},E=k.nb.REFRESH_INTERVAL;function M(){let[e,s]=(0,r.useState)([]),[l,k]=(0,r.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[z,M]=(0,r.useState)(!0),[R,O]=(0,r.useState)(null),[J,A]=(0,r.useState)({key:"name",direction:"asc"}),[P,T]=(0,r.useState)(""),[W,F]=(0,r.useState)(!1),[B,V]=(0,r.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[X,q]=(0,r.useState)({open:!1,message:"",userName:""}),[I,_]=(0,r.useState)(null),[H,K]=(0,r.useState)(!1),[U,$]=(0,r.useState)(null),[G,Q]=(0,r.useState)(null),Y=(0,a.useRouter)(),ee=(0,b.X)(),es=async()=>{if(I&&Date.now()-I.timestamp<3e5)return I;K(!0);try{let e=await C.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),l={role:s.role,name:s.name,timestamp:Date.now()};return _(l),K(!1),l}catch(e){throw K(!1),e}},el=async(e,s)=>{try{let l=await es();if("admin"!==l.role)return q({open:!0,message:e,userName:l.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),q({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},et=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&M(!0);try{let[e,l,t]=await Promise.all([N.default.get(c.fX),N.default.get(n.getClusters),N.default.get(i.getManagedJobs,[{allUsers:!0}])]);O(e);let r=Object.keys(e),a=await Promise.all(r.map(e=>N.default.get(c.yz,[e]))),o=Object.fromEntries(r.map((e,s)=>[e,a[s]]));Object.fromEntries(l.map(e=>[e.cluster,e.workspace||"default"]));let d={};r.forEach(e=>{d[e]={name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}});let u=0;l.forEach(e=>{let s=e.workspace||"default";d[s]||(d[s]={name:s,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}),d[s].totalClusterCount++,("RUNNING"===e.status||"LAUNCHING"===e.status)&&(d[s].runningClusterCount++,u++),e.cloud&&d[s].clouds.add(e.cloud)});let m=t.jobs||[],x=new Set(w.statusGroups.active),h=0;m.forEach(e=>{let s=e.workspace||"default";d[s]&&x.has(e.status)&&d[s].managedJobsCount++,x.has(e.status)&&h++});let p=Object.values(d).filter(e=>r.includes(e.name)).map(e=>({...e,clouds:Array.isArray(o[e.name])?o[e.name]:[]})).sort((e,s)=>e.name.localeCompare(s.name));s(p),k({runningClusters:u,totalClusters:l.length,managedJobs:h})}catch(e){console.error("Error fetching workspace data:",e),s([]),k({runningClusters:0,totalClusters:0,managedJobs:0})}e&&M(!1)};(0,r.useEffect)(()=>{(async()=>{await y.ZP.preloadForPage("workspaces"),et(!0)})();let e=setInterval(()=>{et(!1)},E);return()=>clearInterval(e)},[]);let er=e=>{let s="asc";J.key===e&&"asc"===J.direction&&(s="desc"),A({key:e,direction:s})},ea=e=>J.key===e?"asc"===J.direction?" ↑":" ↓":"",en=r.useMemo(()=>{if(!e)return[];let s=e;if(P&&""!==P.trim()){let l=P.toLowerCase().trim();s=e.filter(e=>!!(e.name.toLowerCase().includes(l)||e.clouds.some(e=>{let s=S.Z2[e.toLowerCase()]||e;return e.toLowerCase().includes(l)||s.toLowerCase().includes(l)}))||!!(!0===((null==R?void 0:R[e.name])||{}).private?"private":"public").includes(l))}return(0,L.R0)(s,J.key,J.direction)},[e,J,P,R]),ei=e=>{el("cannot delete workspace",()=>{V({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},ec=async()=>{if(B.workspaceToDelete){V(e=>({...e,deleting:!0,error:null}));try{await (0,c.zl)(B.workspaceToDelete),Q('Workspace "'.concat(B.workspaceToDelete,'" deleted successfully!')),V({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),N.default.invalidate(c.fX),await et(!0)}catch(e){console.error("Error deleting workspace:",e),V(e=>({...e,deleting:!1,error:null})),$(e)}}},eo=()=>{V({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})},ed=e=>{el("cannot edit workspace",()=>{Y.push("/workspaces/".concat(e))})};return z&&0===e.length?(0,t.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,t.jsx)(m.Z,{}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"fixed top-20 right-4 z-[9999] max-w-md",children:[G&&(0,t.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsx)("p",{className:"text-sm font-medium text-green-800",children:G})})]}),(0,t.jsx)("div",{className:"ml-auto pl-3",children:(0,t.jsxs)("button",{type:"button",onClick:()=>Q(null),className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100",children:[(0,t.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,t.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})]})}),(0,t.jsx)(p.X,{error:U,title:"Error",onDismiss:()=>$(null)})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2 h-5",children:[(0,t.jsx)("div",{className:"text-base flex items-center",children:(0,t.jsx)("span",{className:"text-sky-blue leading-none",children:"Workspaces"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[z&&(0,t.jsxs)("div",{className:"flex items-center mr-2",children:[(0,t.jsx)(m.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Refreshing..."})]}),(0,t.jsxs)("button",{onClick:()=>{N.default.invalidate(c.fX),N.default.invalidate(n.getClusters),N.default.invalidate(i.getManagedJobs,[{allUsers:!0}]),N.default.invalidateFunction(c.yz),et(!0)},disabled:z,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(g.Z,{className:"h-4 w-4 mr-1.5"}),!ee&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,t.jsx)("input",{type:"text",placeholder:"Filter workspaces",value:P,onChange:e=>T(e.target.value),className:"h-8 w-full px-3 pr-8 text-sm border border-gray-300 rounded-md focus:ring-1 focus:ring-sky-500 focus:border-sky-500 outline-none"}),P&&(0,t.jsx)("button",{onClick:()=>T(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear search",children:(0,t.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsx)("button",{onClick:()=>{el("cannot create workspace",()=>{Y.push("/workspace/new")})},disabled:H,className:"ml-4 bg-sky-600 hover:bg-sky-700 text-white flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200",title:"Create Workspace",children:H?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Z,{size:12,className:"mr-2"}),(0,t.jsx)("span",{children:"Create Workspace"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.Z,{className:"h-4 w-4 mr-2"}),"Create Workspace"]})})]}),0!==e.length||z?(0,t.jsx)(o.Zb,{children:(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,t.jsxs)(d.iA,{className:"min-w-full",children:[(0,t.jsx)(d.xD,{children:(0,t.jsxs)(d.SC,{children:[(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>er("name"),children:["Workspace",ea("name")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 hidden sm:table-cell",onClick:()=>er("totalClusterCount"),children:["Clusters ",ea("totalClusterCount")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 hidden md:table-cell",onClick:()=>er("managedJobsCount"),children:["Jobs",ea("managedJobsCount")]}),(0,t.jsx)(d.ss,{className:"whitespace-nowrap hidden lg:table-cell",children:"Enabled infra"}),(0,t.jsx)(d.ss,{className:"whitespace-nowrap",children:"Actions"})]})}),(0,t.jsx)(d.RM,{children:z&&0===en.length?(0,t.jsx)(d.SC,{children:(0,t.jsx)(d.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,t.jsxs)("div",{className:"flex justify-center items-center",children:[(0,t.jsx)(m.Z,{size:20,className:"mr-2"}),(0,t.jsx)("span",{children:"Loading..."})]})})}):en.length>0?en.map(e=>{let s=!0===((null==R?void 0:R[e.name])||{}).private;return(0,t.jsxs)(d.SC,{className:"hover:bg-gray-50",children:[(0,t.jsxs)(d.pj,{className:"",children:[(0,t.jsx)("button",{onClick:()=>ed(e.name),disabled:H,className:"text-blue-600 hover:text-blue-600 hover:underline text-left",children:e.name}),(0,t.jsx)("span",{className:"ml-2",children:(0,t.jsx)(D,{isPrivate:s})})]}),(0,t.jsx)(d.pj,{className:"hidden sm:table-cell",children:(0,t.jsxs)("button",{onClick:()=>{Y.push({pathname:"/clusters",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:[e.runningClusterCount," running,"," ",e.totalClusterCount," total"]})}),(0,t.jsx)(d.pj,{className:"hidden md:table-cell",children:(0,t.jsx)("button",{onClick:()=>{Y.push({pathname:"/jobs",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.managedJobsCount})}),(0,t.jsx)(d.pj,{className:"hidden lg:table-cell",children:e.clouds.length>0?[...e.clouds].sort().map((s,l)=>{let r=S.Z2[s.toLowerCase()]||s;return(0,t.jsxs)("span",{children:[(0,t.jsx)(Z(),{href:"/infra",className:"inline-flex items-center px-2 py-1 rounded text-sm bg-sky-100 text-sky-800 hover:bg-sky-200 hover:text-sky-900 transition-colors duration-200",children:r}),l<e.clouds.length-1&&" "]},s)}):(0,t.jsx)("span",{className:"text-gray-500 text-sm",children:"-"})}),(0,t.jsxs)(d.pj,{children:[(0,t.jsx)(u.z,{variant:"ghost",size:"sm",onClick:()=>ed(e.name),disabled:H,className:"text-gray-600 hover:text-gray-800 mr-1",children:(0,t.jsx)(j,{className:"w-4 h-4"})}),(0,t.jsx)(u.z,{variant:"ghost",size:"sm",onClick:()=>ei(e.name),disabled:"default"===e.name||H,title:"default"===e.name?"Cannot delete default workspace":"Delete workspace",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:(0,t.jsx)(v.Z,{className:"w-4 h-4"})})]})]},e.name)}):(0,t.jsx)(d.SC,{children:(0,t.jsx)(d.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:"No workspaces found"})})})]})})}):(0,t.jsxs)("div",{className:"text-center py-10",children:[(0,t.jsx)("p",{className:"text-lg text-gray-600",children:"No workspaces found."}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Create a cluster to see its workspace here."})]}),R&&(0,t.jsx)(h.Vq,{open:W,onOpenChange:F,children:(0,t.jsxs)(h.cZ,{className:"sm:max-w-md md:max-w-lg lg:max-w-xl xl:max-w-2xl w-full max-h-[90vh] flex flex-col",children:[(0,t.jsx)(h.fK,{children:(0,t.jsx)(h.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,t.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,t.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:x.ZP.dump(R,{indent:2})})})]})}),(0,t.jsx)(h.Vq,{open:X.open,onOpenChange:e=>{q(s=>({...s,open:e})),e||$(null)},children:(0,t.jsxs)(h.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,t.jsxs)(h.fK,{children:[(0,t.jsx)(h.$N,{children:"Permission Denied"}),(0,t.jsx)(h.Be,{children:H?(0,t.jsxs)("div",{className:"flex items-center py-2",children:[(0,t.jsx)(m.Z,{size:16,className:"mr-2"}),(0,t.jsx)("span",{children:"Checking permissions..."})]}):(0,t.jsx)(t.Fragment,{children:X.userName?(0,t.jsxs)(t.Fragment,{children:[X.userName," is logged in as non-admin and ",X.message,"."]}):X.message})})]}),(0,t.jsx)(h.cN,{children:(0,t.jsx)(u.z,{variant:"outline",onClick:()=>q(e=>({...e,open:!1})),disabled:H,children:"OK"})})]})}),(0,t.jsx)(h.Vq,{open:B.confirmOpen,onOpenChange:e=>{e||(eo(),$(null))},children:(0,t.jsxs)(h.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(h.fK,{children:[(0,t.jsx)(h.$N,{children:"Delete Workspace"}),(0,t.jsxs)(h.Be,{children:['Are you sure you want to delete workspace "',B.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,t.jsxs)(h.cN,{children:[(0,t.jsx)(u.z,{variant:"outline",onClick:eo,disabled:B.deleting,children:"Cancel"}),(0,t.jsx)(u.z,{variant:"destructive",onClick:ec,disabled:B.deleting,children:B.deleting?"Deleting...":"Delete"})]})]})})]})}},1163:function(e,s,l){e.exports=l(6036)},2003:function(e,s,l){"use strict";l.d(s,{j:function(){return n}});var t=l(512);let r=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=t.W,n=(e,s)=>l=>{var t;if((null==s?void 0:s.variants)==null)return a(e,null==l?void 0:l.class,null==l?void 0:l.className);let{variants:n,defaultVariants:i}=s,c=Object.keys(n).map(e=>{let s=null==l?void 0:l[e],t=null==i?void 0:i[e];if(null===s)return null;let a=r(s)||r(t);return n[e][a]}),o=l&&Object.entries(l).reduce((e,s)=>{let[l,t]=s;return void 0===t||(e[l]=t),e},{});return a(e,c,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:l,className:t,...r}=s;return Object.entries(r).every(e=>{let[s,l]=e;return Array.isArray(l)?l.includes({...i,...o}[s]):({...i,...o})[s]===l})?[...e,l,t]:e},[]),null==l?void 0:l.class,null==l?void 0:l.className)}}}]);
|
sky/dashboard/out/_next/static/chunks/{webpack-3fad5d4a0541a02d.js → webpack-c3b45b7b0eaef66f.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
!function(){"use strict";var e,t,n,r,c,a,o,u,f,i={},s={};function d(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}},r=!0;try{i[e](n,n.exports,d),r=!1}finally{r&&delete s[e]}return n.exports}d.m=i,e=[],d.O=function(t,n,r,c){if(n){c=c||0;for(var a=e.length;a>0&&e[a-1][2]>c;a--)e[a]=e[a-1];e[a]=[n,r,c];return}for(var o=1/0,a=0;a<e.length;a++){for(var n=e[a][0],r=e[a][1],c=e[a][2],u=!0,f=0;f<n.length;f++)o>=c&&Object.keys(d.O).every(function(e){return d.O[e](n[f])})?n.splice(f--,1):(u=!1,c<o&&(o=c));if(u){e.splice(a--,1);var i=r();void 0!==i&&(t=i)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var c=Object.create(null);d.r(c);var a={};t=t||[null,n({}),n([]),n(n)];for(var o=2&r&&e;"object"==typeof o&&!~t.indexOf(o);o=n(o))Object.getOwnPropertyNames(o).forEach(function(t){a[t]=function(){return e[t]}});return a.default=function(){return e},d.d(c,a),c},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return 2544===e?"static/chunks/2544.27f70672535675ed.js":5491===e?"static/chunks/5491.918ffed0ba7a5294.js":3937===e?"static/chunks/3937.d7f1c55d1916c7f2.js":9025===e?"static/chunks/9025.133e9ba5c780afeb.js":2875===e?"static/chunks/2875.c24c6d57dc82e436.js":9984===e?"static/chunks/9984.b56614f3c4c5961d.js":430===e?"static/chunks/430.ed51037d1a4a438b.js":1746===e?"static/chunks/1746.27d40aedc22bd2d6.js":2641===e?"static/chunks/2641.35edc9ccaeaad9e3.js":9847===e?"static/chunks/9847.46e613d000c55859.js":4725===e?"static/chunks/4725.4c849b1e05c8e9ad.js":3785===e?"static/chunks/3785.95b94f18aaec7233.js":4869===e?"static/chunks/4869.
|
1
|
+
!function(){"use strict";var e,t,n,r,c,a,o,u,f,i={},s={};function d(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}},r=!0;try{i[e](n,n.exports,d),r=!1}finally{r&&delete s[e]}return n.exports}d.m=i,e=[],d.O=function(t,n,r,c){if(n){c=c||0;for(var a=e.length;a>0&&e[a-1][2]>c;a--)e[a]=e[a-1];e[a]=[n,r,c];return}for(var o=1/0,a=0;a<e.length;a++){for(var n=e[a][0],r=e[a][1],c=e[a][2],u=!0,f=0;f<n.length;f++)o>=c&&Object.keys(d.O).every(function(e){return d.O[e](n[f])})?n.splice(f--,1):(u=!1,c<o&&(o=c));if(u){e.splice(a--,1);var i=r();void 0!==i&&(t=i)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var c=Object.create(null);d.r(c);var a={};t=t||[null,n({}),n([]),n(n)];for(var o=2&r&&e;"object"==typeof o&&!~t.indexOf(o);o=n(o))Object.getOwnPropertyNames(o).forEach(function(t){a[t]=function(){return e[t]}});return a.default=function(){return e},d.d(c,a),c},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return 2544===e?"static/chunks/2544.27f70672535675ed.js":5491===e?"static/chunks/5491.918ffed0ba7a5294.js":3937===e?"static/chunks/3937.d7f1c55d1916c7f2.js":9025===e?"static/chunks/9025.133e9ba5c780afeb.js":2875===e?"static/chunks/2875.c24c6d57dc82e436.js":9984===e?"static/chunks/9984.b56614f3c4c5961d.js":430===e?"static/chunks/430.ed51037d1a4a438b.js":1746===e?"static/chunks/1746.27d40aedc22bd2d6.js":2641===e?"static/chunks/2641.35edc9ccaeaad9e3.js":9847===e?"static/chunks/9847.46e613d000c55859.js":4725===e?"static/chunks/4725.4c849b1e05c8e9ad.js":3785===e?"static/chunks/3785.95b94f18aaec7233.js":4869===e?"static/chunks/4869.bdd42f14b51d1d6f.js":"static/chunks/"+e+"-"+({616:"162f3033ffcd3d31",804:"9f5e98ce84d46bdd",938:"6a9ffdaa21eee969",1043:"90a88c46f27b3df5",1141:"d8c6404a7c6fffe6",1272:"1ef0bf0237faccdb",1664:"d65361e92b85e786",1871:"76491ac174a95278",3698:"9fa11dafb5cad4a6",3947:"b059261d6fa88a1f",5230:"df791914b54d91d9",5739:"5ea3ffa10fc884f2",6601:"d4a381403a8bae91",6989:"eab0e9c16b64fd9f",6990:"dcb411b566e64cde",8969:"743abf4bc86baf48",9470:"b6f6a35283863a6f"})[e]+".js"},d.miniCssF=function(e){},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},c="_N_E:",d.l=function(e,t,n,a){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var o,u,f=document.getElementsByTagName("script"),i=0;i<f.length;i++){var s=f[i];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==c+n){o=s;break}}o||(u=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,d.nc&&o.setAttribute("nonce",d.nc),o.setAttribute("data-webpack",c+n),o.src=d.tu(e)),r[e]=[t];var b=function(t,n){o.onerror=o.onload=null,clearTimeout(l);var c=r[e];if(delete r[e],o.parentNode&&o.parentNode.removeChild(o),c&&c.forEach(function(e){return e(n)}),t)return t(n)},l=setTimeout(b.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=b.bind(null,o.onerror),o.onload=b.bind(null,o.onload),u&&document.head.appendChild(o)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=function(){return void 0===a&&(a={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(a=trustedTypes.createPolicy("nextjs#bundler",a))),a},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/dashboard/_next/",o={2272:0},d.f.j=function(e,t){var n=d.o(o,e)?o[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(2272!=e){var r=new Promise(function(t,r){n=o[e]=[t,r]});t.push(n[2]=r);var c=d.p+d.u(e),a=Error();d.l(c,function(t){if(d.o(o,e)&&(0!==(n=o[e])&&(o[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+c+")",a.name="ChunkLoadError",a.type=r,a.request=c,n[1](a)}},"chunk-"+e,e)}else o[e]=0}},d.O.j=function(e){return 0===o[e]},u=function(e,t){var n,r,c=t[0],a=t[1],u=t[2],f=0;if(c.some(function(e){return 0!==o[e]})){for(n in a)d.o(a,n)&&(d.m[n]=a[n]);if(u)var i=u(d)}for(e&&e(t);f<c.length;f++)r=c[f],d.o(o,r)&&o[r]&&o[r][0](),o[r]=0;return d.O(i)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(u.bind(null,0)),f.push=u.bind(null,f.push.bind(f)),d.nc=void 0}();
|