snapctl 0.29.1__tar.gz → 0.31.0__tar.gz
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.
Potentially problematic release.
This version of snapctl might be problematic. Click here for more details.
- {snapctl-0.29.1 → snapctl-0.31.0}/PKG-INFO +25 -7
- {snapctl-0.29.1 → snapctl-0.31.0}/README.md +24 -6
- {snapctl-0.29.1 → snapctl-0.31.0}/pyproject.toml +1 -1
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/commands/byogs.py +25 -7
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/commands/snapend.py +2 -3
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/config/constants.py +1 -1
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/main.py +6 -6
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/__init__.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/__main__.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/commands/__init__.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/commands/byosnap.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/commands/game.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/config/__init__.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/config/endpoints.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/config/hashes.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/types/__init__.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/types/definitions.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/utils/__init__.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/utils/echo.py +0 -0
- {snapctl-0.29.1 → snapctl-0.31.0}/snapctl/utils/helper.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: snapctl
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.31.0
|
|
4
4
|
Summary: Snapser CLI Tool
|
|
5
5
|
Author: Ajinkya Apte
|
|
6
6
|
Author-email: aj@snapser.com
|
|
@@ -302,7 +302,7 @@ See all the supported commands
|
|
|
302
302
|
snapctl byogs --help
|
|
303
303
|
```
|
|
304
304
|
|
|
305
|
-
#### 2. byogs create
|
|
305
|
+
#### 2. [Deprecated soon] byogs create
|
|
306
306
|
|
|
307
307
|
Create a custom game server. Note that you will have to build, push and publish your game server image, for it to be useable
|
|
308
308
|
in a Snapend fleet.
|
|
@@ -336,7 +336,7 @@ snapctl byogs build --help
|
|
|
336
336
|
# $image_tag = An image tag for your snap
|
|
337
337
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
338
338
|
# Example:
|
|
339
|
-
# snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/
|
|
339
|
+
# snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
340
340
|
snapctl byogs build $byogs_sid --tag $image_tag --path $code_root_path
|
|
341
341
|
```
|
|
342
342
|
|
|
@@ -356,7 +356,7 @@ snapctl byogs push --help
|
|
|
356
356
|
snapctl byogs push $byogs_sid --tag $image_tag
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
-
#### 5. byogs publish-image
|
|
359
|
+
#### 5. [Deprecated soon] byogs publish-image
|
|
360
360
|
|
|
361
361
|
Publish your custom game server image. This command executes, `build` and `push` one after the other.
|
|
362
362
|
|
|
@@ -369,11 +369,11 @@ snapctl byogs publish-image --help
|
|
|
369
369
|
# $image_tag = An image tag for your snap
|
|
370
370
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
371
371
|
# Example:
|
|
372
|
-
# snapctl byogs publish-image byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/
|
|
372
|
+
# snapctl byogs publish-image byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
373
373
|
snapctl byogs publish-image $byogs_sid --tag $image_tag --path $code_root_path
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
-
#### 6. byogs publish-version
|
|
376
|
+
#### 6. [Deprecated soon] byogs publish-version
|
|
377
377
|
|
|
378
378
|
Publish a new version for your game server. Only after your game server version is published, you will be able
|
|
379
379
|
to use it in your Snapend fleet. This command should be run after you `push` or `publish-image` commands.
|
|
@@ -393,6 +393,24 @@ snapctl byogs publish-version --help
|
|
|
393
393
|
snapctl byogs publish-version $byogs_sid --tag $image_tag --prefix $prefix --version $version --http-port $ingress_port
|
|
394
394
|
```
|
|
395
395
|
|
|
396
|
+
#### 7. [New] byogs publish
|
|
397
|
+
|
|
398
|
+
Publish your custom game server image. This commend replaces the old way of creating, publishing image and
|
|
399
|
+
then publishing the byogs. Now all you have to do is publish your image and create a fleet using the web portal.
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
# Help for the byogs command
|
|
403
|
+
snapctl byogs publish --help
|
|
404
|
+
|
|
405
|
+
# Publish a new image
|
|
406
|
+
# $image_tag = An image tag for your snap
|
|
407
|
+
# $code_root_path = Local code path where your Dockerfile is present
|
|
408
|
+
# Example:
|
|
409
|
+
# snapctl byogs publish --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
410
|
+
snapctl byogs publish --tag $image_tag --path $code_root_path
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
|
|
396
414
|
### Game
|
|
397
415
|
|
|
398
416
|
#### 1. snapend help
|
|
@@ -506,7 +524,7 @@ snapctl snapend update --help
|
|
|
506
524
|
# Note at least one of the two needs to be present
|
|
507
525
|
# Example:
|
|
508
526
|
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs byogs-fleet-one:gs-1:v0.0.1,my-fleet-two:gs-2:v0.0.4
|
|
509
|
-
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs
|
|
527
|
+
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs fleet-one:v0.0.1,fleet-two:v0.0.4 --blocking
|
|
510
528
|
snapctl snapend update $snapend_id --byosnaps $byosnaps --byogs $byogs --blocking
|
|
511
529
|
```
|
|
512
530
|
|
|
@@ -285,7 +285,7 @@ See all the supported commands
|
|
|
285
285
|
snapctl byogs --help
|
|
286
286
|
```
|
|
287
287
|
|
|
288
|
-
#### 2. byogs create
|
|
288
|
+
#### 2. [Deprecated soon] byogs create
|
|
289
289
|
|
|
290
290
|
Create a custom game server. Note that you will have to build, push and publish your game server image, for it to be useable
|
|
291
291
|
in a Snapend fleet.
|
|
@@ -319,7 +319,7 @@ snapctl byogs build --help
|
|
|
319
319
|
# $image_tag = An image tag for your snap
|
|
320
320
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
321
321
|
# Example:
|
|
322
|
-
# snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/
|
|
322
|
+
# snapctl byogs build byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
323
323
|
snapctl byogs build $byogs_sid --tag $image_tag --path $code_root_path
|
|
324
324
|
```
|
|
325
325
|
|
|
@@ -339,7 +339,7 @@ snapctl byogs push --help
|
|
|
339
339
|
snapctl byogs push $byogs_sid --tag $image_tag
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
#### 5. byogs publish-image
|
|
342
|
+
#### 5. [Deprecated soon] byogs publish-image
|
|
343
343
|
|
|
344
344
|
Publish your custom game server image. This command executes, `build` and `push` one after the other.
|
|
345
345
|
|
|
@@ -352,11 +352,11 @@ snapctl byogs publish-image --help
|
|
|
352
352
|
# $image_tag = An image tag for your snap
|
|
353
353
|
# $code_root_path = Local code path where your Dockerfile is present
|
|
354
354
|
# Example:
|
|
355
|
-
# snapctl byogs publish-image byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/
|
|
355
|
+
# snapctl byogs publish-image byosnap-jinks-gs --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
356
356
|
snapctl byogs publish-image $byogs_sid --tag $image_tag --path $code_root_path
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
-
#### 6. byogs publish-version
|
|
359
|
+
#### 6. [Deprecated soon] byogs publish-version
|
|
360
360
|
|
|
361
361
|
Publish a new version for your game server. Only after your game server version is published, you will be able
|
|
362
362
|
to use it in your Snapend fleet. This command should be run after you `push` or `publish-image` commands.
|
|
@@ -376,6 +376,24 @@ snapctl byogs publish-version --help
|
|
|
376
376
|
snapctl byogs publish-version $byogs_sid --tag $image_tag --prefix $prefix --version $version --http-port $ingress_port
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
+
#### 7. [New] byogs publish
|
|
380
|
+
|
|
381
|
+
Publish your custom game server image. This commend replaces the old way of creating, publishing image and
|
|
382
|
+
then publishing the byogs. Now all you have to do is publish your image and create a fleet using the web portal.
|
|
383
|
+
|
|
384
|
+
```
|
|
385
|
+
# Help for the byogs command
|
|
386
|
+
snapctl byogs publish --help
|
|
387
|
+
|
|
388
|
+
# Publish a new image
|
|
389
|
+
# $image_tag = An image tag for your snap
|
|
390
|
+
# $code_root_path = Local code path where your Dockerfile is present
|
|
391
|
+
# Example:
|
|
392
|
+
# snapctl byogs publish --tag my-first-image --path /Users/DevName/Development/SnapserEngine/game_server
|
|
393
|
+
snapctl byogs publish --tag $image_tag --path $code_root_path
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
|
|
379
397
|
### Game
|
|
380
398
|
|
|
381
399
|
#### 1. snapend help
|
|
@@ -489,7 +507,7 @@ snapctl snapend update --help
|
|
|
489
507
|
# Note at least one of the two needs to be present
|
|
490
508
|
# Example:
|
|
491
509
|
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs byogs-fleet-one:gs-1:v0.0.1,my-fleet-two:gs-2:v0.0.4
|
|
492
|
-
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs
|
|
510
|
+
# snapctl snapend update gx5x6bc0 --byosnaps byosnap-service-1:v1.0.0,byosnap-service--2:v1.0.0 --byogs fleet-one:v0.0.1,fleet-two:v0.0.4 --blocking
|
|
493
511
|
snapctl snapend update $snapend_id --byosnaps $byosnaps --byogs $byogs --blocking
|
|
494
512
|
```
|
|
495
513
|
|
|
@@ -24,10 +24,11 @@ class ByoGs:
|
|
|
24
24
|
"""
|
|
25
25
|
BYOGS CLI commands
|
|
26
26
|
"""
|
|
27
|
-
|
|
27
|
+
SID = 'byogs'
|
|
28
28
|
SUBCOMMANDS = [
|
|
29
29
|
'build', 'push',
|
|
30
30
|
'create', 'publish-image', 'publish-version',
|
|
31
|
+
'publish'
|
|
31
32
|
]
|
|
32
33
|
PLATFORMS = ['linux/amd64']
|
|
33
34
|
LANGUAGES = ['go', 'python', 'ruby', 'c#', 'c++', 'rust', 'java', 'node']
|
|
@@ -45,15 +46,17 @@ class ByoGs:
|
|
|
45
46
|
self.base_url: str = base_url
|
|
46
47
|
self.api_key: str = api_key
|
|
47
48
|
self.sid: str = sid
|
|
49
|
+
if subcommand == 'publish':
|
|
50
|
+
self.sid = ByoGs.SID
|
|
48
51
|
self.name: str = name
|
|
49
52
|
self.desc: str = desc
|
|
50
53
|
self.platform_type: str = platform_type
|
|
51
54
|
self.language: str = language
|
|
55
|
+
self.token: Union[str, None] = None
|
|
52
56
|
if subcommand != 'create':
|
|
53
57
|
self.token: Union[str, None] = get_composite_token(
|
|
54
|
-
base_url, api_key, 'byogs', {'service_id': sid}
|
|
55
|
-
|
|
56
|
-
self.token: Union[str, None] = None
|
|
58
|
+
base_url, api_key, 'byogs', {'service_id': self.sid}
|
|
59
|
+
)
|
|
57
60
|
self.token_parts: Union[list, None] = ByoGs._get_token_values(
|
|
58
61
|
self.token) if self.token is not None else None
|
|
59
62
|
self.input_tag: Union[str, None] = input_tag
|
|
@@ -269,10 +272,10 @@ class ByoGs:
|
|
|
269
272
|
response['msg'] = f"Invalid command. Valid commands are {', '.join(ByoGs.SUBCOMMANDS)}."
|
|
270
273
|
return response
|
|
271
274
|
# Validate the SID
|
|
272
|
-
if not self.sid.startswith(ByoGs.
|
|
275
|
+
if not self.sid.startswith(ByoGs.SID):
|
|
273
276
|
response['msg'] = (
|
|
274
277
|
"Invalid Game Server ID. Valid Game Server IDs start "
|
|
275
|
-
f"with {ByoGs.
|
|
278
|
+
f"with {ByoGs.SID}."
|
|
276
279
|
)
|
|
277
280
|
return response
|
|
278
281
|
if len(self.sid) > ByoGs.SID_CHARACTER_LIMIT:
|
|
@@ -310,7 +313,7 @@ class ByoGs:
|
|
|
310
313
|
f"{ByoGs.TAG_CHARACTER_LIMIT} characters"
|
|
311
314
|
)
|
|
312
315
|
return response
|
|
313
|
-
if self.subcommand
|
|
316
|
+
if self.subcommand in ['build', 'publish-image', 'publish']:
|
|
314
317
|
if not self.input_tag:
|
|
315
318
|
response['msg'] = "Missing required parameter: tag"
|
|
316
319
|
return response
|
|
@@ -430,6 +433,21 @@ class ByoGs:
|
|
|
430
433
|
return False
|
|
431
434
|
return True
|
|
432
435
|
|
|
436
|
+
def publish(self) -> bool:
|
|
437
|
+
"""
|
|
438
|
+
Publish the image
|
|
439
|
+
1. Check Dependencies
|
|
440
|
+
2. Login to Snapser Registry
|
|
441
|
+
3. Build your snap
|
|
442
|
+
4. Tag the repo
|
|
443
|
+
5. Push the image
|
|
444
|
+
6. Upload swagger.json
|
|
445
|
+
"""
|
|
446
|
+
if not self._check_dependencies() or not self._docker_login() or \
|
|
447
|
+
not self._docker_build() or not self._docker_tag() or not self._docker_push():
|
|
448
|
+
return False
|
|
449
|
+
return True
|
|
450
|
+
|
|
433
451
|
def publish_version(self) -> bool:
|
|
434
452
|
"""
|
|
435
453
|
Publish your game server version
|
|
@@ -117,12 +117,11 @@ class Snapend:
|
|
|
117
117
|
byogs_list = []
|
|
118
118
|
for byog in byogs.split(','):
|
|
119
119
|
byog = byog.strip()
|
|
120
|
-
if len(byog.split(':')) !=
|
|
120
|
+
if len(byog.split(':')) != 2:
|
|
121
121
|
return []
|
|
122
122
|
byogs_list.append({
|
|
123
123
|
'fleet_name': byog.split(':')[0],
|
|
124
|
-
'
|
|
125
|
-
'service_version': byog.split(':')[2]
|
|
124
|
+
'image_tag': byog.split(':')[1],
|
|
126
125
|
})
|
|
127
126
|
return byogs_list
|
|
128
127
|
|
|
@@ -319,7 +319,7 @@ def byogs(
|
|
|
319
319
|
..., help="BYOGs Subcommands: " + ", ".join(ByoGs.SUBCOMMANDS) + "."
|
|
320
320
|
),
|
|
321
321
|
sid: str = typer.Argument(
|
|
322
|
-
|
|
322
|
+
ByoGs.SID, help="Game Server Id. Should start with byogs"
|
|
323
323
|
),
|
|
324
324
|
# create
|
|
325
325
|
name: str = typer.Option(
|
|
@@ -338,14 +338,14 @@ def byogs(
|
|
|
338
338
|
help="(req: create) Language of your snap - " + \
|
|
339
339
|
", ".join(ByoGs.LANGUAGES) + "."
|
|
340
340
|
),
|
|
341
|
-
# publish-image and publish-version
|
|
341
|
+
# publish, publish-image and publish-version
|
|
342
342
|
tag: str = typer.Option(
|
|
343
343
|
None, "--tag",
|
|
344
|
-
help="(req: build, push, publish-image and publish-version) Tag for your snap"
|
|
344
|
+
help="(req: build, push, publish, publish-image and publish-version) Tag for your snap"
|
|
345
345
|
),
|
|
346
|
-
# publish-image
|
|
346
|
+
# publish and publish-image
|
|
347
347
|
path: Union[str, None] = typer.Option(
|
|
348
|
-
None, "--path", help="(req: build, publish-image, upload-docs) Path to your snap code"
|
|
348
|
+
None, "--path", help="(req: build, publish, publish-image, upload-docs) Path to your snap code"
|
|
349
349
|
),
|
|
350
350
|
docker_file: str = typer.Option(
|
|
351
351
|
"Dockerfile", help="Dockerfile name to use"
|
|
@@ -512,7 +512,7 @@ def snapend(
|
|
|
512
512
|
byogs: str = typer.Option(
|
|
513
513
|
None, "--byogs",
|
|
514
514
|
help=(
|
|
515
|
-
"(optional: update) Comma separated list of BYOGs fleet name
|
|
515
|
+
"(optional: update) Comma separated list of BYOGs fleet name:tags. "
|
|
516
516
|
"Eg: fleet-1:service-1:v1.0.0,fleet-2:service-2:v1.0.0"
|
|
517
517
|
)
|
|
518
518
|
),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|