stoobly-agent 1.0.8__py3-none-any.whl → 1.0.9__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.
stoobly_agent/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
1
  COMMAND = 'stoobly-agent'
2
- VERSION = '1.0.8'
2
+ VERSION = '1.0.9'
@@ -8,7 +8,7 @@
8
8
 
9
9
  # Constants
10
10
  DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
11
- WORKFLOW_NAME := exec
11
+ EXEC_WORKFLOW_NAME := exec
12
12
 
13
13
  CONTEXT_DIR_DEFAULT := $(realpath $(DIR)/../..)
14
14
 
@@ -27,7 +27,7 @@ docker_compose_command=docker compose
27
27
  source_env=set -a; [ -f .env ] && source .env; set +a
28
28
 
29
29
  docker_compose_file_path=$(app_data_dir)/docker/stoobly-ui/exec/.docker-compose.exec.yml
30
- stoobly_exec_args=--profile $(WORKFLOW_NAME) -p $(WORKFLOW_NAME) up --build --remove-orphans
30
+ stoobly_exec_args=--profile $(EXEC_WORKFLOW_NAME) -p $(EXEC_WORKFLOW_NAME) up --build --remove-orphans
31
31
  stoobly_exec_env=export CONTEXT_DIR=$(context_dir) && export USER_ID=$$UID && export CA_CERTS_DIR="$(ca_certs_dir)"
32
32
  stoobly_exec=$(stoobly_exec_env) && $(source_env) && $(docker_compose_command) -f "$(docker_compose_file_path)" $(stoobly_exec_args)
33
33
 
@@ -1 +1,14 @@
1
- # Define services here
1
+ # Define networks and services here
2
+ #
3
+ # If a container service needs access to a Stoobly defined service,
4
+ # then the container service needs to add the service name to the 'networks' property
5
+ # e.g. If we have defined a 'upstream' service, then the following should be added
6
+ # networks:
7
+ # - upstream
8
+ #
9
+ # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
10
+ # e.g. If we want to run a service as part of the 'mock' workflow, then the following should be added
11
+ # profiles:
12
+ # - mock
13
+ networks: {}
14
+ services: {}
@@ -1 +1,14 @@
1
- # Define services here
1
+ # Define networks and services here
2
+ #
3
+ # If a container service needs access to a Stoobly defined service,
4
+ # then the container service needs to add the service name to the 'networks' property
5
+ # e.g. If we have defined a 'upstream' service, then the following should be added
6
+ # networks:
7
+ # - upstream
8
+ #
9
+ # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
10
+ # e.g. If we want to run a service as part of the 'record' workflow, then the following should be added
11
+ # profiles:
12
+ # - record
13
+ networks: {}
14
+ services: {}
@@ -1 +1,14 @@
1
- # Define services here
1
+ # Define networks and services here
2
+ #
3
+ # If a container service needs access to a Stoobly defined service,
4
+ # then the container service needs to add the service name to the 'networks' property
5
+ # e.g. If we have defined a 'upstream' service, then the following should be added
6
+ # networks:
7
+ # - upstream
8
+ #
9
+ # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
10
+ # e.g. If we want to run a service as part of the 'test' workflow, then the following should be added
11
+ # profiles:
12
+ # - test
13
+ networks: {}
14
+ services: {}
@@ -3,6 +3,8 @@
3
3
  extra_options=$EXEC_OPTIONS
4
4
  workflow=$1
5
5
 
6
+ mkdir -p .stoobly/tmp
7
+
6
8
  stoobly-agent scaffold workflow run \
7
9
  --app-dir-path "$(pwd)" \
8
10
  --dry-run \
@@ -1,6 +1,8 @@
1
1
  import os
2
2
  import pdb
3
3
 
4
+ from typing import TypedDict
5
+
4
6
  from stoobly_agent.config.data_dir import DataDir
5
7
  from stoobly_agent.lib.logger import Logger
6
8
 
@@ -11,6 +13,10 @@ from .workflow_command import WorkflowCommand
11
13
 
12
14
  LOG_ID = 'WorkflowRunCommand'
13
15
 
16
+ class UpOptions(TypedDict):
17
+ attached: bool
18
+ namespace: str
19
+
14
20
  class WorkflowRunCommand(WorkflowCommand):
15
21
  def __init__(self, app: App, **kwargs):
16
22
  super().__init__(app, **kwargs)
@@ -63,7 +69,7 @@ class WorkflowRunCommand(WorkflowCommand):
63
69
  def create_network(self):
64
70
  return f"docker network create {self.network} 2> /dev/null"
65
71
 
66
- def up(self):
72
+ def up(self, **options: UpOptions):
67
73
  if not os.path.exists(self.compose_path):
68
74
  return ''
69
75
 
@@ -94,8 +100,15 @@ class WorkflowRunCommand(WorkflowCommand):
94
100
  command.append(f"-f {os.path.relpath(self.extra_compose_path, self.__current_working_dir)}")
95
101
 
96
102
  command.append(f"--profile {self.workflow_name}")
103
+
104
+ if options.get('namespace'):
105
+ command.append(f"-p {options['namespace']}")
106
+
97
107
  command.append('up')
98
- command.append('-d')
108
+
109
+ if not options.get('attached'):
110
+ command.append('-d')
111
+
99
112
  command.append('--build')
100
113
 
101
114
  self.write_env()
@@ -316,13 +316,15 @@ def logs(**kwargs):
316
316
  @click.option('--ca-certs-dir-path', default=DataDir.instance().mitmproxy_conf_dir_path, help='Path to ca certs directory used to sign SSL certs. Defaults to ~/.mitmproxy')
317
317
  @click.option('--certs-dir-path', help='Path to certs directory. Defaults to the certs dir of the context.')
318
318
  @click.option('--context-dir-path', default=DataDir.instance().context_dir_path, help='Path to Stoobly data directory.')
319
+ @click.option('--detached', is_flag=True, help='If set, will not run the highest priority service in the foreground.')
319
320
  @click.option('--filter', multiple=True, type=click.Choice([WORKFLOW_CUSTOM_FILTER]), help='Select which service groups to run. Defaults to all.')
320
321
  @click.option('--dry-run', default=False, is_flag=True, help='If set, prints commands.')
321
322
  @click.option('--extra-compose-path', help='Path to extra compose configuration files.')
322
323
  @click.option('--log-level', default=INFO, type=click.Choice([DEBUG, INFO, WARNING, ERROR]), help='''
323
324
  Log levels can be "debug", "info", "warning", or "error"
324
325
  ''')
325
- @click.option('--network', help='Name of network namespace.')
326
+ @click.option('--namespace', help='Workflow namespace.')
327
+ @click.option('--network', help='Workflow network namespace.')
326
328
  @click.option('--service', multiple=True, help='Select which services to run. Defaults to all.')
327
329
  @click.argument('workflow_name')
328
330
  def run(**kwargs):
@@ -372,10 +374,13 @@ def run(**kwargs):
372
374
  print(create_network_command)
373
375
 
374
376
  commands = sorted(commands, key=lambda command: command.service_config.priority)
375
- for command in commands:
377
+ for index, command in enumerate(commands):
376
378
  __print_header(f"SERVICE {command.service_name}")
377
379
 
378
- exec_command = command.up()
380
+ # By default, the entrypoint service should be last
381
+ # However, this can change if the user has configured a service's priority to be higher
382
+ attached = not kwargs['detached'] and index == len(commands) - 1
383
+ exec_command = command.up(attached=attached, namespace=kwargs['namespace'])
379
384
  if not exec_command:
380
385
  continue
381
386
 
@@ -226,6 +226,7 @@ class DataDir:
226
226
  with open(os.path.join(self.__data_dir_path, '.gitignore'), 'w') as fp:
227
227
  fp.write(
228
228
  "\n".join([
229
+ 'certs',
229
230
  'db',
230
231
  'settings.yml',
231
232
  os.path.join('snapshots', 'log'),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: stoobly-agent
3
- Version: 1.0.8
3
+ Version: 1.0.9
4
4
  Summary: Record, mock, and test HTTP(s) requests. CLI agent for Stoobly
5
5
  License: Apache-2.0
6
6
  Author: Matt Le
@@ -1,4 +1,4 @@
1
- stoobly_agent/__init__.py,sha256=YRJ2IyOFYfNMitHnDEgevFuLZ3X0HHY8moxXjMFFabk,44
1
+ stoobly_agent/__init__.py,sha256=r0VYJeYLDBgc5UvCAjDPGJ_KS3dTEnx7N7dyr9LmgzI,44
2
2
  stoobly_agent/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  stoobly_agent/app/api/__init__.py,sha256=ctkB8KR-eXO0SFhj602huHiyvQ3PslFWd8fkcufgrAI,1000
4
4
  stoobly_agent/app/api/application_http_request_handler.py,sha256=jf4fkqjOiCeI2IM5Ro7ie0v_C6y0-7-5TIE_IKMPOfg,5513
@@ -101,7 +101,7 @@ stoobly_agent/app/cli/scaffold/service_workflow_validate_command.py,sha256=zvqKm
101
101
  stoobly_agent/app/cli/scaffold/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
102
  stoobly_agent/app/cli/scaffold/templates/app/.Dockerfile.context,sha256=1Zm5_ROKZzFMAkMt8dluEJASI2CBi9d9If_Gch9FMNM,193
103
103
  stoobly_agent/app/cli/scaffold/templates/app/.Dockerfile.proxy,sha256=JfZOVALEmRE_hVEMIHTmem9Ln32qnfKOAUO1c5Z9fqw,1027
104
- stoobly_agent/app/cli/scaffold/templates/app/.Makefile,sha256=JOtlDYzba0phpQdsKcWPbJCS9ZWgoqixq7wwzKTVzj0,4161
104
+ stoobly_agent/app/cli/scaffold/templates/app/.Makefile,sha256=zfa8uZFGZEJV0cnSLvbQ1kctrLu5zuO7Kdpj6yK-yuU,4176
105
105
  stoobly_agent/app/cli/scaffold/templates/app/.docker-compose.base.yml,sha256=LNNuygX6hMtmElxaO6jTIYq3psYmxNv7xax7ra6JzO4,407
106
106
  stoobly_agent/app/cli/scaffold/templates/app/Makefile,sha256=t7xRaCc9q3k7W34S0h9KX02GljSVwGpPnFmiLUvWxsw,80
107
107
  stoobly_agent/app/cli/scaffold/templates/app/build/.config.yml,sha256=8Wt8ZZ5irvBYYS44xGrR_EWlZDuXH9kyWmquzsh7s8g,19
@@ -128,19 +128,19 @@ stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/bin/.configure,sha2
128
128
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/bin/.init,sha256=5xJbfpwGOmRj5lwK5e0JNlVpNd3WFUkZ0GaCUK40aDk,97
129
129
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/bin/configure,sha256=Nme7aSLA-IH1NXgmqRMPzOlKcUSRXqZd-kcuZa47IEk,11
130
130
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/bin/init,sha256=O7czui9GFHbcoEC5I9MwkRyZvDGY42IwlyQwIWcgylY,12
131
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/docker-compose.yml,sha256=S-e2LOIwkifAtc-66n8cvvd6dpLtIsHGX1H0W4Nc1Oo,22
131
+ stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/docker-compose.yml,sha256=Zh8h8yUqVXZMi_Y4aUPE48qw2DU-ONO4-rrSTh4E_Ts,591
132
132
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/.docker-compose.record.yml,sha256=g_tkKEPhwUyg5QbXNBT_bo3CFw9qdhaQyWirMJDS9tc,688
133
133
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/bin/.configure,sha256=Jp7ozDgj0x9D8PYS8CMhGNs4VfwJhVwBqzss8ygbLJU,258
134
134
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/bin/.init,sha256=5xJbfpwGOmRj5lwK5e0JNlVpNd3WFUkZ0GaCUK40aDk,97
135
135
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/bin/configure,sha256=Nme7aSLA-IH1NXgmqRMPzOlKcUSRXqZd-kcuZa47IEk,11
136
136
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/bin/init,sha256=O7czui9GFHbcoEC5I9MwkRyZvDGY42IwlyQwIWcgylY,12
137
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/docker-compose.yml,sha256=S-e2LOIwkifAtc-66n8cvvd6dpLtIsHGX1H0W4Nc1Oo,22
137
+ stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/docker-compose.yml,sha256=5n4bZBHI9MtwBF55ugu1RTdwMy7T6SsYGQ_3sulFUj8,595
138
138
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/.docker-compose.test.yml,sha256=ifPMJHPbAf6hI4vS1BWuzPOOt5SCaxHFnWA5BVnM9RY,685
139
139
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/bin/.configure,sha256=I4MhiSVbBaQWy056opYfPqnWPZmS5rKBW_Y26nDGMeY,256
140
140
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/bin/.init,sha256=5xJbfpwGOmRj5lwK5e0JNlVpNd3WFUkZ0GaCUK40aDk,97
141
141
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/bin/configure,sha256=Nme7aSLA-IH1NXgmqRMPzOlKcUSRXqZd-kcuZa47IEk,11
142
142
  stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/bin/init,sha256=O7czui9GFHbcoEC5I9MwkRyZvDGY42IwlyQwIWcgylY,12
143
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/docker-compose.yml,sha256=S-e2LOIwkifAtc-66n8cvvd6dpLtIsHGX1H0W4Nc1Oo,22
143
+ stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/docker-compose.yml,sha256=E4gGJwHfnZoFo9-0vM17-Qg5LPjx7vIPpcz2K7eiZg0,591
144
144
  stoobly_agent/app/cli/scaffold/templates/app/gateway/.config.yml,sha256=XnLQZMzzMMIwVycjyPN5QXsmRztkTFAna1kIHYuDfJQ,19
145
145
  stoobly_agent/app/cli/scaffold/templates/app/gateway/.docker-compose.base.yml,sha256=L70ReUdGnfCDBxz9urdZoBskyAQ5fZ56KEzqzh6XRbk,257
146
146
  stoobly_agent/app/cli/scaffold/templates/app/gateway/mock/.docker-compose.mock.yml,sha256=LiMgBvOozkBH34-72kQXLylmrnERwjQfs8aws6BlZHM,232
@@ -154,7 +154,7 @@ stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/exec/bin/.disable,sha256
154
154
  stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/exec/bin/.enable,sha256=sfUSPG4uHdXX95BLgivXQYLbsLBP2DjJIiSTXRtvXuY,188
155
155
  stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/exec/bin/.mkcert,sha256=vyHaXmvy-7oL2RD8rIxwT-fdJS5kXmB0yHK5fRMo_cM,46
156
156
  stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/exec/bin/.reset,sha256=_pvbLk-ektsCHEh_egDtd6c0sVqCPunwUWggarfoli0,238
157
- stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/exec/bin/.run,sha256=AporhoTO76u9lexoPJ9XnFsjRnhpPRZdv1g2ri3-V50,210
157
+ stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/exec/bin/.run,sha256=X_fs8iPIjNOD_2XMRIlA4mWtMDLwvp1lxJuPU4cBQYk,233
158
158
  stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/exec/bin/.snapshot,sha256=Kav1QNhKG7f0DBzc4-9dmxZMmmVTxmPqakT_W4kVYKk,241
159
159
  stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/exec/bin/.stop,sha256=n9k-qnQXfG5J_71FxkteLg962ErT1wTs1juEDtbmUgM,209
160
160
  stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/mock/.docker-compose.mock.yml,sha256=Ba-jNMZUcq62kK_hLpaN7dkEwz3_ZS91aJOOJ8U3Ark,257
@@ -187,9 +187,9 @@ stoobly_agent/app/cli/scaffold/workflow_command.py,sha256=V4Wfv9bgh5MlWAaW_68uud
187
187
  stoobly_agent/app/cli/scaffold/workflow_copy_command.py,sha256=R9hh5dWVz7vGld7pENAA_a9gW56EkgG2K35nBQYXwyI,1462
188
188
  stoobly_agent/app/cli/scaffold/workflow_create_command.py,sha256=5xnRYrVb2KlSDARZFjLGGWeURXRu63OHoRLEhO-EAvw,3401
189
189
  stoobly_agent/app/cli/scaffold/workflow_log_command.py,sha256=FN-XyMVnulbassBuqeB21J_PQnOsr_LNs0Dg2tcDkjg,435
190
- stoobly_agent/app/cli/scaffold/workflow_run_command.py,sha256=DxbcJ-Z7lFobwW9YUp82d2gyRqUk5RzMRmOoMYdX6Eg,4222
190
+ stoobly_agent/app/cli/scaffold/workflow_run_command.py,sha256=WmEA0TZtEajKhbaauBLqTuH3--ODXtQ5-A33VqaEWoI,4463
191
191
  stoobly_agent/app/cli/scaffold/workflow_validate_command.py,sha256=fhHciJXg_u32Wmh8us8LhgQj8D1SxkBADtuBBF4K0FM,4377
192
- stoobly_agent/app/cli/scaffold_cli.py,sha256=JjmChiUiZ1j_QoJKlvoZ3Hl9YibswRYjjYMhuXHmujU,18053
192
+ stoobly_agent/app/cli/scaffold_cli.py,sha256=sB12SJIGDpz-_HuMjWMnA-psfggR2DyMsIw8E-ZQWpg,18513
193
193
  stoobly_agent/app/cli/scenario_cli.py,sha256=3J1EiJOvunkfWrEkOsanw-XrKkOk78ij_GjBlE9p7CE,8229
194
194
  stoobly_agent/app/cli/snapshot_cli.py,sha256=XNxpTm5z3bnBGNGI3_XZIif0ypN62WqYfDmShL5fXg4,9965
195
195
  stoobly_agent/app/cli/trace_cli.py,sha256=K7E-vx3JUcqEDSWOdIOi_AieKNQz7dBfmRrVvKDkzFI,4605
@@ -416,7 +416,7 @@ stoobly_agent/config/constants/statuses.py,sha256=dR88qHHnDR_5ppuKijwc0R24D_fWc6
416
416
  stoobly_agent/config/constants/test_filter.py,sha256=rQ-eMZ8kpq49pqS1PQhaRx59dlRicd-Ag4sjgoXfpY8,109
417
417
  stoobly_agent/config/constants/test_output_level.py,sha256=yrn8cs-lexrK0Ckpc_SX3NhsZPfVhNpmjzjSP62LCro,135
418
418
  stoobly_agent/config/constants/test_strategy.py,sha256=d6-WgKqElB3q_csP-QYFkhR4XvlPGfGdCJ-SBEDEoL4,152
419
- stoobly_agent/config/data_dir.py,sha256=W-J3DPB3ImP6Vir279hC5knw-744vfgjMkKNxG6ZpIY,7712
419
+ stoobly_agent/config/data_dir.py,sha256=xlNP9b9of0zPSjfDRL_YcmdZ6JJ7DMgqwlXe3dTagqI,7745
420
420
  stoobly_agent/config/mitmproxy.py,sha256=z9L1JSWwQFsn4gMZk8Dcz5mOcUc6dYnW1ZugrYTEttw,1902
421
421
  stoobly_agent/config/schema.yml,sha256=b4I8utMrUrMSr86UbXgYYxt2-TJynQA9oQtOQ7CM-PE,1963
422
422
  stoobly_agent/config/settings.yml.sample,sha256=muxP1bWrtknVaSgdseFaw23tuwduILNdQTVy7aB519M,404
@@ -720,8 +720,8 @@ stoobly_agent/test/mock_data/scaffold/docker-compose-local-service.yml,sha256=x7
720
720
  stoobly_agent/test/mock_data/scaffold/index.html,sha256=qJwuYajKZ4ihWZrJQ3BNObV5kf1VGnnm_vqlPJzdqLE,258
721
721
  stoobly_agent/test/mock_data/uspto.yaml,sha256=6U5se7C3o-86J4m9xpOk9Npias399f5CbfWzR87WKwE,7835
722
722
  stoobly_agent/test/test_helper.py,sha256=m_oAI7tmRYCNZdKfNqISWhMv3e44tjeYViQ3nTUfnos,1007
723
- stoobly_agent-1.0.8.dist-info/LICENSE,sha256=8QKGyy45eN76Zk52h8gu1DKX2B_gbWgZ3nzDLofEbaE,548
724
- stoobly_agent-1.0.8.dist-info/METADATA,sha256=w_KU9407lw_67FBJdjJGDJ1gnyDrJYPfU-g1OOVFI38,3425
725
- stoobly_agent-1.0.8.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
726
- stoobly_agent-1.0.8.dist-info/entry_points.txt,sha256=aq5wix5oC8MDQtmyPGU0xaFrsjJg7WH28NmXh2sc3Z8,56
727
- stoobly_agent-1.0.8.dist-info/RECORD,,
723
+ stoobly_agent-1.0.9.dist-info/LICENSE,sha256=8QKGyy45eN76Zk52h8gu1DKX2B_gbWgZ3nzDLofEbaE,548
724
+ stoobly_agent-1.0.9.dist-info/METADATA,sha256=UfKvxrEkLC-N9EWc4jXE4NIpWWurBq8hqznXxJRNjWI,3425
725
+ stoobly_agent-1.0.9.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
726
+ stoobly_agent-1.0.9.dist-info/entry_points.txt,sha256=aq5wix5oC8MDQtmyPGU0xaFrsjJg7WH28NmXh2sc3Z8,56
727
+ stoobly_agent-1.0.9.dist-info/RECORD,,