Skip to content

Commit

Permalink
Merge pull request #933 from camptocamp/backport/909-to-master
Browse files Browse the repository at this point in the history
[Backport master] Better Snyk
  • Loading branch information
sbrunner authored Dec 15, 2022
2 parents 49ca8cf + 91fc460 commit 659508f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 12 additions & 2 deletions c2cciutils/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ def snyk(
print(f"::group::Run: {' '.join(command)}")
sys.stdout.flush()
sys.stderr.flush()
subprocess.run(command, env=env) # pylint: disable=subprocess-run-check
snyk_fix_proc = subprocess.run( # pylint: disable=subprocess-run-check
command, env=env, stdout=subprocess.PIPE, encoding="utf-8"
)
snyk_fix_message = snyk_fix_proc.stdout.strip()
print("::endgroup::")

if not args.fix:
Expand Down Expand Up @@ -190,7 +193,14 @@ def snyk(
c2cciutils.configuration.AUDIT_SNYK_FIX_PULL_REQUEST_ARGUMENTS_DEFAULT,
)
subprocess.run(
["gh", "pr", "create", f"--base={current_branch}", *fix_github_create_pull_request_arguments],
[
"gh",
"pr",
"create",
f"--base={current_branch}",
f"--body={snyk_fix_message}",
*fix_github_create_pull_request_arguments,
],
check=True,
env=env,
)
Expand Down
3 changes: 1 addition & 2 deletions c2cciutils/scripts/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def main() -> None:
snyk_exec, env = c2cciutils.snyk_exec()
for image in images_full:
if version_type in ("version_branch", "version_tag"):
subprocess.run(
subprocess.run( # pylint: disable=subprocess-run-check
[
snyk_exec,
"container",
Expand All @@ -284,7 +284,6 @@ def main() -> None:
# f"--project-tags=tag={image.split(':')[-1]}",
image,
],
check=True,
env=env,
)
# Currently just for information
Expand Down

0 comments on commit 659508f

Please sign in to comment.