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

ENT-12486: Add argument to make checking against downloads in cfbs generate-release-information optional #210

Merged
merged 1 commit into from
Nov 26, 2024
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
5 changes: 5 additions & 0 deletions cfbs/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ def get_arg_parser():
help="Use existing masterfiles instead of downloading in 'cfbs generate-release-information'",
action="store_true",
)
parser.add_argument(
"--check-against-downloads",
help="Check whether downloadable files match git files in 'cfbs generate-release-information'",
action="store_true",
)
parser.add_argument(
"--masterfiles", help="Add masterfiles on cfbs init choose between"
)
Expand Down
6 changes: 5 additions & 1 deletion cfbs/cfbs.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH CFBS "1" "2024\-11\-22" "cfbs" "CFEngine Build System manual"
.TH CFBS "1" "2024\-11\-26" "cfbs" "CFEngine Build System manual"
.SH NAME
cfbs \- combines multiple modules into 1 policy set to deploy on your infrastructure. Modules can be custom promise types, JSON files which enable certain functionality, or reusable CFEngine policy. The modules you use can be written by the CFEngine team, others in the community, your colleagues, or yourself.
.SH SYNOPSIS
Expand Down Expand Up @@ -76,6 +76,10 @@ Ignore versions.json. Necessary in case of a custom index or testing changes to
\fB\-\-omit\-download\fR
Use existing masterfiles instead of downloading in 'cfbs generate-release-information'

.TP
\fB\-\-check\-against\-downloads\fR
Check whether downloadable files match git files in 'cfbs generate-release-information'

.TP
\fB\-\-masterfiles\fR \fI\,MASTERFILES\/\fR
Add masterfiles on cfbs init choose between
Expand Down
4 changes: 2 additions & 2 deletions cfbs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,5 +1208,5 @@ def get_input_command(name, outfile):


@cfbs_command("generate-release-information")
def generate_release_information_command(omit_download=False):
generate_release_information(omit_download)
def generate_release_information_command(omit_download=False, check=False):
generate_release_information(omit_download, check)
8 changes: 7 additions & 1 deletion cfbs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def main() -> int:
% args.command
)

if args.check_against_downloads and args.command != "generate-release-information":
user_error(
"The option --check-against-downloads is only for 'cfbs generate-release-information', not 'cfbs %s'"
% args.command
)

if args.non_interactive and args.command not in (
"init",
"add",
Expand Down Expand Up @@ -99,7 +105,7 @@ def main() -> int:

if args.command == "generate-release-information":
return commands.generate_release_information_command(
omit_download=args.omit_download
omit_download=args.omit_download, check=args.check_against_downloads
)

if not is_cfbs_repo():
Expand Down
12 changes: 7 additions & 5 deletions cfbs/masterfiles/generate_release_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
DOWNLOAD_PATH = "downloaded_masterfiles"


def generate_release_information(omit_download=False):
def generate_release_information(omit_download=False, check=False):
if not omit_download:
print("Downloading masterfiles...")

Expand All @@ -22,10 +22,12 @@ def generate_release_information(omit_download=False):
generate_vcf_download(DOWNLOAD_PATH, downloaded_versions)
generate_vcf_git_checkout(downloaded_versions)

print("Candidate release information generated.")
print("Checking that downloadable files match git files...")
if check:
print("Candidate release information generated.")
print("Checking that downloadable files match git files...")

check_download_matches_git(downloaded_versions)
check_download_matches_git(downloaded_versions)

print("Downloadable files match git files.")

print("Downloadable files match git files.")
print("Release information generation successfully finished.")
Loading