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

OCPBUGS-48244: ztp: ci check to ensure source-cr filenames are within 255 limit #2185

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
26 changes: 24 additions & 2 deletions ztp/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: ci-job test-policygen checkExtraManifests checkSourceCRsAnnotation test-policygen-kustomize test-siteconfig test-siteconfig-kustomize test-acm-ztp-generated-policies check-reference
.PHONY: ci-job test-policygen checkExtraManifests checkSourceCRsAnnotation test-policygen-kustomize test-siteconfig test-siteconfig-kustomize test-acm-ztp-generated-policies check-reference checkSourceCRsPath

ci-job: test-policygen checkExtraManifests checkSourceCRsAnnotation test-policygen-kustomize test-siteconfig test-siteconfig-kustomize test-acm-ztp-generated-policies check-reference
ci-job: test-policygen checkExtraManifests checkSourceCRsAnnotation test-policygen-kustomize test-siteconfig test-siteconfig-kustomize test-acm-ztp-generated-policies check-reference checkSourceCRsPath

test-policygen:
@echo "ZTP: Build policy generator and run test"
Expand All @@ -19,6 +19,28 @@ checkSourceCRsAnnotation:
fi; \
done; \



# ZTP_HOME is a temporary hard-coded path to site-generate container's ztp folder
# Should remain consistent across upstream, midstream and CI script
# https://github.com/openshift-kni/cnf-features-deploy/blob/master/ztp/resource-generator/Containerfile#L28C1-L28C23
ZTP_HOME=/home/ztp/
SOURCE_CRS := source-crs
# checkSourceCRsPath CI Job is to ensure source crs path length do not exceed 255 characters
# Related Issue: https://issues.redhat.com/browse/OCPBUGS-48244
checkSourceCRsPath:
@failures=0; \
for cr in $(shell find $(SOURCE_CRS) -type f); do \
path_length=$$(echo -n ${ZTP_HOME}$$cr | wc -c); \
if [ $$path_length -gt 255 ]; then \
echo "File path too long: $$cr (length: $$path_length)"; \
(( failures += 1 )); \
else \
echo "File path OK: ${ZTP_HOME}$$cr (length: $$path_length)"; \
fi; \
done; \
exit $$failures

test-policygen-kustomize:
@echo "ZTP: Build policy generator kustomize plugin and run test"
$(MAKE) -C ./policygenerator-kustomize-plugin test
Expand Down
4 changes: 4 additions & 0 deletions ztp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ We suggest breaking down the site plan into components that are common, relevant
* Site: IP addresses, SRIOV configuration

We look forward to user feedback and will gladly accept pull requests and issues for consideration.

## ZTP Guidelines

To avoid issues due to filename length limitations (ISO standard: not greater than 255), please ensure files in the source-crs folder are within this limit. This includes the length of the full path as per ZTP_HOME set in the ztp-site-generate container.
abraham2512 marked this conversation as resolved.
Show resolved Hide resolved