autopkg-wrapper 2024.8.1__py3-none-any.whl → 2025.8.1__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.
@@ -1 +0,0 @@
1
- __version__ = "2024.8.1"
@@ -186,7 +186,7 @@ def get_override_repo_info(args):
186
186
  logging.debug(f"Override Repo Path: {override_repo_path}")
187
187
 
188
188
  override_repo_git_work_tree = f"--work-tree={override_repo_path}"
189
- override_repo_git_git_dir = f"--git-dir={override_repo_path / ".git"}"
189
+ override_repo_git_git_dir = f"--git-dir={override_repo_path / '.git'}"
190
190
  override_repo_url, override_repo_remote_ref = git.get_repo_info(
191
191
  override_repo_git_git_dir
192
192
  )
@@ -229,7 +229,7 @@ def update_recipe_repo(recipe, git_info, disable_recipe_trust_check, args):
229
229
 
230
230
  if current_branch != git_info["override_trust_branch"]:
231
231
  logging.debug(
232
- f"override_trust_branch: {git_info["override_trust_branch"]}"
232
+ f"override_trust_branch: {git_info['override_trust_branch']}"
233
233
  )
234
234
  git.create_branch(git_info)
235
235
 
@@ -356,6 +356,8 @@ def main():
356
356
  args=args,
357
357
  )
358
358
 
359
+ failed_recipes = []
360
+
359
361
  for recipe in recipe_list:
360
362
  logging.info(f"Processing Recipe: {recipe.name}")
361
363
  process_recipe(
@@ -373,12 +375,18 @@ def main():
373
375
  recipe=recipe, token=args.slack_token
374
376
  ) if args.slack_token else None
375
377
 
378
+ if recipe.error or recipe.results.get("failed"):
379
+ failed_recipes.append(recipe)
380
+
376
381
  recipe.pr_url = (
377
382
  git.create_pull_request(git_info=override_repo_info, recipe=recipe)
378
383
  if args.create_pr
379
384
  else None
380
385
  )
381
386
 
382
-
383
- if __name__ == "__main__":
384
- main()
387
+ # Create GitHub issue for failed recipes
388
+ if args.create_issues and failed_recipes and args.github_token:
389
+ issue_url = git.create_issue_for_failed_recipes(
390
+ git_info=override_repo_info, failed_recipes=failed_recipes
391
+ )
392
+ logging.info(f"Created GitHub issue for failed recipes: {issue_url}")
@@ -1 +0,0 @@
1
- __version__ = "0.0.0"
@@ -19,7 +19,7 @@ def send_notification(recipe, token):
19
19
  if not recipe.results["failed"]:
20
20
  task_description = "Unknown error"
21
21
  else:
22
- task_description = ("Error: {} \n" "Traceback: {} \n").format(
22
+ task_description = ("Error: {} \nTraceback: {} \n").format(
23
23
  recipe.results["failed"][0]["message"],
24
24
  recipe.results["failed"][0]["traceback"],
25
25
  )
@@ -1 +0,0 @@
1
- __version__ = "0.0.0"
@@ -100,7 +100,7 @@ def setup_args():
100
100
  "--branch-name",
101
101
  default=os.getenv(
102
102
  "AW_TRUST_BRANCH",
103
- f"fix/update_trust_information/{datetime.now().strftime("%Y-%m-%dT%H-%M-%S")}",
103
+ f"fix/update_trust_information/{datetime.now().strftime('%Y-%m-%dT%H-%M-%S')}",
104
104
  ),
105
105
  help="""
106
106
  Branch name to be used recipe overrides have failed their trust verification and need to be updated.
@@ -113,6 +113,11 @@ def setup_args():
113
113
  action="store_true",
114
114
  help="If enabled, autopkg_wrapper will open a PR for updated trust information",
115
115
  )
116
+ parser.add_argument(
117
+ "--create-issues",
118
+ action="store_true",
119
+ help="Create a GitHub issue for recipes that fail during processing",
120
+ )
116
121
  parser.add_argument(
117
122
  "--overrides-repo-path",
118
123
  default=os.getenv("AW_OVERRIDES_REPO_PATH", None),
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  import subprocess
3
+ from datetime import datetime
3
4
 
4
5
  from github import Github
5
6
 
@@ -102,8 +103,58 @@ Please review and merge the updated trust information for this override.
102
103
 
103
104
  g = Github(git_info["github_token"])
104
105
  repo = g.get_repo(git_info["override_repo_remote_ref"])
105
- pr = repo.create_pull(title=title, body=body, head=git_info["override_trust_branch"], base="main")
106
- pr_url = f"{git_info["override_repo_url"]}/pull/{pr.number}"
106
+ pr = repo.create_pull(
107
+ title=title, body=body, head=git_info["override_trust_branch"], base="main"
108
+ )
109
+ pr_url = f"{git_info['override_repo_url']}/pull/{pr.number}"
107
110
 
108
111
  logging.debug(f"PR URL: {pr_url}")
109
112
  return pr_url
113
+
114
+
115
+ def create_issue_for_failed_recipes(git_info, failed_recipes):
116
+ """
117
+ Creates a GitHub issue listing all recipes that failed during the run.
118
+
119
+ Args:
120
+ git_info (dict): Dictionary containing Git repository information
121
+ failed_recipes (list): List of Recipe objects that failed during processing
122
+
123
+ Returns:
124
+ str: URL of the created GitHub issue, or None if no issue was created
125
+ """
126
+
127
+ if not failed_recipes:
128
+ logging.debug("No failed recipes to report")
129
+ return None
130
+
131
+ g = Github(git_info["github_token"])
132
+ repo = g.get_repo(git_info["override_repo_remote_ref"])
133
+
134
+ # Create issue title and body
135
+ current_date = datetime.now().strftime("%Y-%m-%d")
136
+ title = f"AutoPkg Recipe Failures - {current_date}"
137
+
138
+ body = "## Recipe Failure Details:\n\n"
139
+ for recipe in failed_recipes:
140
+ body += f"#### {recipe.name}\n"
141
+
142
+ if recipe.results.get("failed"):
143
+ for failure in recipe.results.get("failed", []):
144
+ body += f"- {failure.get('message', 'Unknown error')}\n"
145
+
146
+ body += "\n"
147
+
148
+ body += "\nThis issue was automatically generated by autopkg-wrapper."
149
+
150
+ # Create the issue
151
+ issue = repo.create_issue(
152
+ title=title,
153
+ body=body,
154
+ labels=["autopkg-failure"],
155
+ )
156
+
157
+ issue_url = f"{git_info['override_repo_url']}/issues/{issue.number}"
158
+ logging.debug(f"Issue URL: {issue_url}")
159
+
160
+ return issue_url
@@ -1,23 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: autopkg-wrapper
3
- Version: 2024.8.1
3
+ Version: 2025.8.1
4
4
  Summary: A package used to execute some autopkg functions, primarily within the context of a GitHub Actions runner.
5
- Home-page: https://github.com/smithjw/autopkg-wrapper
6
- License: BSD-3-Clause
7
- Author: James Smith
8
- Author-email: james@smithjw.me
9
- Requires-Python: >=3.12,<4.0
10
- Classifier: License :: OSI Approved :: BSD License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.12
13
- Requires-Dist: chardet (>=5)
14
- Requires-Dist: idna (>=3)
15
- Requires-Dist: pygithub (>=2)
16
- Requires-Dist: requests (>=2)
17
- Requires-Dist: ruamel-yaml (>=0.18)
18
- Requires-Dist: toml (>=0.10)
19
- Requires-Dist: urllib3 (>=2)
20
5
  Project-URL: Repository, https://github.com/smithjw/autopkg-wrapper
6
+ Author-email: James Smith <james@smithjw.me>
7
+ License-Expression: BSD-3-Clause
8
+ License-File: LICENSE
9
+ Requires-Python: ~=3.12.0
10
+ Requires-Dist: chardet
11
+ Requires-Dist: idna
12
+ Requires-Dist: pygithub
13
+ Requires-Dist: requests
14
+ Requires-Dist: ruamel-yaml
15
+ Requires-Dist: toml
16
+ Requires-Dist: urllib3
21
17
  Description-Content-Type: text/markdown
22
18
 
23
19
  # autopkg-wrapper
@@ -56,4 +52,3 @@ An example folder structure and GitHub Actions Workflow is available within the
56
52
 
57
53
  - [`autopkg_tools` from Facebook](https://github.com/facebook/IT-CPE/tree/main/legacy/autopkg_tools)
58
54
  - [`autopkg_tools` from Facebook, modified by Gusto](https://github.com/Gusto/it-cpe-opensource/tree/main/autopkg)
59
-
@@ -0,0 +1,13 @@
1
+ autopkg_wrapper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ autopkg_wrapper/autopkg_wrapper.py,sha256=dF8BGhk1IpP4w6lRtJqgpY-VK9vkoOiD0jidIUaSn9M,13457
3
+ autopkg_wrapper/notifier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ autopkg_wrapper/notifier/slack.py,sha256=aPxQDGd5zPxSsu3mEqalNOF0ly0QnYog0ieHokd5-OY,1979
5
+ autopkg_wrapper/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ autopkg_wrapper/utils/args.py,sha256=6sghB9DWZmv7VLUR9uJA5WkhxsZ08Ri1qoUY5rxydjY,4883
7
+ autopkg_wrapper/utils/git_functions.py,sha256=Ojsq-wQsw7Gezq9pYDTtXF9SxrK9b9Cfap3mbJyVgdw,4456
8
+ autopkg_wrapper/utils/logging.py,sha256=3knpMViO_zAU8WM5bSImQaz5M01vMFk_raB4lt1cbvo,324
9
+ autopkg_wrapper-2025.8.1.dist-info/METADATA,sha256=v97bxd_6_vj97C7Av4hl7vCXgUBWu-SHIKmn-QGDLMc,2527
10
+ autopkg_wrapper-2025.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
+ autopkg_wrapper-2025.8.1.dist-info/entry_points.txt,sha256=TVIcOt7OozzX1c00pwMGbBysaHg_v_N3mO3juoFqPpo,73
12
+ autopkg_wrapper-2025.8.1.dist-info/licenses/LICENSE,sha256=PpNOQjZGcsKFuA0wU16YU7PueVxqPX4OnyZ7TlLQlq4,1602
13
+ autopkg_wrapper-2025.8.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ autopkg_wrapper = autopkg_wrapper.autopkg_wrapper:main
@@ -1,13 +0,0 @@
1
- autopkg_wrapper/__init__.py,sha256=LH37MkR079fO0oez0_vLvmySB5pH_U7FgoqJn5fRbuI,25
2
- autopkg_wrapper/autopkg_wrapper.py,sha256=7hi8QmQgAqX5LHlv89ongl06NIvznXo8Qqhy4srHXQw,13042
3
- autopkg_wrapper/notifier/__init__.py,sha256=ShXQBVjyiSOHxoQJS2BvNG395W4KZfqMxZWBAR0MZrE,22
4
- autopkg_wrapper/notifier/slack.py,sha256=nKHeSmgDaTaSUo19ZgnjjjKzeWgg34fMHUwNj9C5FMY,1982
5
- autopkg_wrapper/utils/__init__.py,sha256=ShXQBVjyiSOHxoQJS2BvNG395W4KZfqMxZWBAR0MZrE,22
6
- autopkg_wrapper/utils/args.py,sha256=5VyPP28DYHttuwBD6iPTLMWSy1IiJ11md01GpkIWt8s,4718
7
- autopkg_wrapper/utils/git_functions.py,sha256=zMMzwRG9V2VFaQk3y_o1H63_hzI1qohwBKaetNDS2mY,2975
8
- autopkg_wrapper/utils/logging.py,sha256=3knpMViO_zAU8WM5bSImQaz5M01vMFk_raB4lt1cbvo,324
9
- autopkg_wrapper-2024.8.1.dist-info/LICENSE,sha256=PpNOQjZGcsKFuA0wU16YU7PueVxqPX4OnyZ7TlLQlq4,1602
10
- autopkg_wrapper-2024.8.1.dist-info/METADATA,sha256=D5E6qm9B79Ezm6lEkJp0-ACksXweM8kFMN6kdecRwHw,2756
11
- autopkg_wrapper-2024.8.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- autopkg_wrapper-2024.8.1.dist-info/entry_points.txt,sha256=-whajEGfgetm2CroLN1IMolYlyM9QqUPM7oJZWQrVfE,72
13
- autopkg_wrapper-2024.8.1.dist-info/RECORD,,
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- autopkg_wrapper=autopkg_wrapper.autopkg_wrapper:main
3
-