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

fix: generate docs bugs #77

Merged
merged 1 commit into from
Mar 13, 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
12 changes: 7 additions & 5 deletions scripts/common/inventory-controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@
for match in matches:
# Load the YAML data from the resource string
data = yaml.safe_load(resource)
# Extract the value of the metadata.name node
resource_name = data['metadata']['name']
# Add an item to the inventory list with the security control(match), file type, file name, resource name and details(resource)
inventory.append((match, "kubernetes", os.path.join(root, file), resource_name, resource))
# only continue if the file loaded properly (don't process resources that are commented out)
if data != None:
# Extract the value of the metadata.name node
resource_name = data['metadata']['name']
# Add an item to the inventory list with the security control(match), file type, file name, resource name and details(resource)
inventory.append((match, "kubernetes", os.path.join(root, file), resource_name, resource))

##################
# MARKDOWN FILE
Expand All @@ -75,4 +77,4 @@
# write inventory.csv using "%" as delimiter
with open('inventory.csv', 'w') as file:
writer = csv.writer(file, delimiter='%')
writer.writerows(inventory)
writer.writerows(inventory)
7 changes: 6 additions & 1 deletion scripts/kpt/generate-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ if [ -f Kptfile ]; then

chmod 777 README.md

# Work-around when Kptfile pipeline mutators have 'selectors', delete it (in the temp LINUX_WORKDIR).
# Error example,
# [error]: failed to generate doc: failed to decode Kptfile: invalid 'v1' Kptfile: yaml: unmarshal errors: line 41: field selectors not found in type v1.Function
yq eval 'del(.pipeline.mutators[].selectors)' -i Kptfile

#REPO_URL="${repo}.git${directory}/"
REPO_URL="${repo}.git${directory%/*}/"
print_info "running generate-kpt-pkg-docs"
Expand Down Expand Up @@ -144,4 +149,4 @@ exec 3>&-

# Copying securitycontrols.md back to original folder
print_info "Copying securitycontrols.md back to original folder"
cp -f securitycontrols.md "$srcDir"
cp -f securitycontrols.md "$srcDir"
Loading