primitive 0.2.33__py3-none-any.whl → 0.2.35__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.
primitive/__about__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Dylan Stein <dylan@primitive.tech>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.2.33"
4
+ __version__ = "0.2.35"
@@ -102,4 +102,4 @@ class Agent(BaseAction):
102
102
 
103
103
  sleep(5)
104
104
  except KeyboardInterrupt:
105
- logger.info("[agent] Stopping primitive agent...")
105
+ logger.info("Stopping primitive agent...")
primitive/agent/runner.py CHANGED
@@ -119,20 +119,27 @@ class Runner:
119
119
  self.job_settings["rootDirectory"]
120
120
  )
121
121
 
122
- # Attempt to parse the job yaml file
123
- job_filename = self.job_settings["repositoryFilename"]
124
- logger.info(f"Scanning directory for job file {job_filename}")
122
+ db_config = self.job_settings.get("config", None)
123
+ if db_config:
124
+ logger.info(f"Using job config from database for {self.job['slug']}")
125
+ self.config = db_config
126
+ else:
127
+ # Attempt to parse the job yaml file
128
+ job_filename = self.job_settings["repositoryFilename"]
129
+ logger.info(f"Scanning directory for job file {job_filename}")
125
130
 
126
- job_config_file = Path(self.source_dir / ".primitive" / job_filename)
131
+ job_config_file = Path(self.source_dir / ".primitive" / job_filename)
127
132
 
128
- if job_config_file.exists():
129
- logger.info(f"Found job description for {self.job['slug']}")
130
- self.config = yaml.load(open(job_config_file, "r"), Loader=Loader)
131
- else:
132
- logger.error(
133
- f"No job description with matching filename '{job_filename}' found"
134
- )
135
- raise FileNotFoundError
133
+ if job_config_file.exists():
134
+ logger.info(
135
+ f"Found job description for {self.job['slug']} at {job_config_file}"
136
+ )
137
+ self.config = yaml.load(open(job_config_file, "r"), Loader=Loader)
138
+ else:
139
+ logger.error(
140
+ f"No job description with matching filename '{job_filename}' found"
141
+ )
142
+ raise FileNotFoundError
136
143
 
137
144
  # Setup initial process environment
138
145
  self.initial_env = os.environ
@@ -254,7 +261,9 @@ class Runner:
254
261
  return number_of_files_produced
255
262
 
256
263
  async def run_task(self, task: Task) -> bool:
257
- for cmd in task["cmd"].strip().split("\n"):
264
+ logger.info(f"Running step '{task['label']}'")
265
+ commands = task["cmd"].strip().split("\n")
266
+ for i, cmd in enumerate(commands):
258
267
  # Adding an additional echo and utilizing stdbuf to force line buffering
259
268
  # This ensures that the environment variables and starting delimiter are
260
269
  # always in a new chunk, vastly simplifying our parsing logic
@@ -264,6 +273,8 @@ class Runner:
264
273
  f"{cmd} && echo -n '{ENV_VAR_LOOKUP_START}' && env && echo -n '{ENV_VAR_LOOKUP_END}'",
265
274
  ]
266
275
 
276
+ logger.info(f"Executing command {i + 1}/{len(commands)}: {cmd}")
277
+
267
278
  process = await asyncio.create_subprocess_exec(
268
279
  *args,
269
280
  env=self.modified_env,
@@ -287,6 +298,10 @@ class Runner:
287
298
 
288
299
  returncode = await process.wait()
289
300
 
301
+ logger.info(
302
+ f"Finished executing command {i + 1}/{len(commands)}: {cmd} with return code {returncode}"
303
+ )
304
+
290
305
  JobRun.objects.filter_by(job_run_id=self.job_run["id"]).update(
291
306
  {"pid": None}
292
307
  )
@@ -35,6 +35,7 @@ fragment JobRunFragment on JobRun {
35
35
  parseStderr
36
36
  failureLevel
37
37
  repositoryFilename
38
+ config
38
39
  }
39
40
  gitCommit {
40
41
  sha
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: primitive
3
- Version: 0.2.33
3
+ Version: 0.2.35
4
4
  Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
5
5
  Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
6
6
  Project-URL: Source, https://github.com//primitivecorp/primitive-cli
@@ -1,11 +1,11 @@
1
- primitive/__about__.py,sha256=VgaNzMy13Zl_7Ph2LzRKGJY9WBIR3X3iXpy-0CtxYTQ,130
1
+ primitive/__about__.py,sha256=hEyqfjOzciSUTNTdMBjYfDhPQ78HUi4rV_w9imBssec,130
2
2
  primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
3
3
  primitive/cli.py,sha256=g7EtHI9MATAB0qQu5w-WzbXtxz_8zu8z5E7sETmMkKU,2509
4
4
  primitive/client.py,sha256=h8WZVnQylVe0vbpuyC8YZHl2JyITSPC-1HbUcmrE5pc,3623
5
5
  primitive/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- primitive/agent/actions.py,sha256=JLnHCtu0AgeHRZccCc2I39mziLixmj9EKtKeYmvBE7A,3700
6
+ primitive/agent/actions.py,sha256=VHlNTw2M-T1MRajpIBu2weT8AsdDdYtlgbBnRBYYeco,3692
7
7
  primitive/agent/commands.py,sha256=cK7d3OcN5Z65gQWVZFQ-Y9ddw9Pes4f9OVBpeMsj5sE,255
8
- primitive/agent/runner.py,sha256=duF0iQCvf23ZOKRUk5e3yL2wQz9pr-XnpPijFqmb4uc,15143
8
+ primitive/agent/runner.py,sha256=u1uEJiXUi2ps7wHFYo5iOW4WURo4ObnApUbzhsG-6AU,15784
9
9
  primitive/agent/uploader.py,sha256=ZzrzsajNBogwEC7mT6Ejy0h2Jd9axMYGzt9pbCvVMlk,3171
10
10
  primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  primitive/auth/actions.py,sha256=9NIEXJ1BNJutJs6AMMSjMN_ziONUAUhY_xHwojYJCLA,942
@@ -54,7 +54,7 @@ primitive/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  primitive/jobs/actions.py,sha256=Fx2cPc1x09nRasOVtjhPjNRJ-jNoi3RJhXqC3verD9s,5444
55
55
  primitive/jobs/commands.py,sha256=MxPCkBEYW_eLNqgCRYeyj7ZcLOFAWfpVZlqDR2Y_S0o,830
56
56
  primitive/jobs/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
- primitive/jobs/graphql/fragments.py,sha256=pS6jXZ9yxvPKjKx50zpwzARJHYlg7NQLYCm1voiuCzI,642
57
+ primitive/jobs/graphql/fragments.py,sha256=flBi4REkfPX3sao22McmjclK-lFsqiXQa21YKmTbxu8,653
58
58
  primitive/jobs/graphql/mutations.py,sha256=8ASvCmwQh7cMeeiykOdYaYVryG8FRIuVF6v_J8JJZuw,219
59
59
  primitive/jobs/graphql/queries.py,sha256=ZxNmm-WovytbggNuKRnwa0kc26T34_0yhqkoqx-2uj0,1736
60
60
  primitive/monitor/actions.py,sha256=aYe5OfgCxhapXbcvz7vSlIMAcLOFRcAUWmdBZ8H7UWs,10889
@@ -96,8 +96,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
96
96
  primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
97
97
  primitive/utils/shell.py,sha256=Z4zxmOaSyGCrS0D6I436iQci-ewHLt4UxVg1CD9Serc,2171
98
98
  primitive/utils/text.py,sha256=XiESMnlhjQ534xE2hMNf08WehE1SKaYFRNih0MmnK0k,829
99
- primitive-0.2.33.dist-info/METADATA,sha256=d38zBbaz0OFTGWtf-ZmSEUSWJX1NgmWf3aotjjZkMA8,3569
100
- primitive-0.2.33.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
- primitive-0.2.33.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
102
- primitive-0.2.33.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
103
- primitive-0.2.33.dist-info/RECORD,,
99
+ primitive-0.2.35.dist-info/METADATA,sha256=PLtjAKPLgi5K7IkgS3mqqeroGABE4fnmDTnSLYZE0P4,3569
100
+ primitive-0.2.35.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
+ primitive-0.2.35.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
102
+ primitive-0.2.35.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
103
+ primitive-0.2.35.dist-info/RECORD,,