Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport master] Better Snyk #933

Merged
merged 2 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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