diff --git a/.github/checklist-map.json b/.github/checklist-map.json index ec101c7..3fac52a 100644 --- a/.github/checklist-map.json +++ b/.github/checklist-map.json @@ -1,199 +1,300 @@ { "read-prerequisites": { "title": "[Checklist] Review CNCF sandbox prerequisites", - "labels": ["checklist-item", "checklist:read-prerequisites", "phase:prepare"], + "labels": [ + "checklist-item", + "checklist:read-prerequisites", + "phase:prepare" + ], "template": "checklist-item.md", "body": "Review the CNCF sandbox prerequisites in the `read_prerequisites` section of [APPLICATION.md](../APPLICATION.md) (links and policy notes are there).\n\nWhen complete, add your review notes under **Your answer** in that section and open a PR with `Closes #ISSUE_NUMBER`." }, "project-summary": { "title": "[Application] Project summary and description", - "labels": ["checklist-item", "checklist:project-summary", "phase:basic-info"], + "labels": [ + "checklist-item", + "checklist:project-summary", + "phase:basic-info" + ], "template": "checklist-item.md", "body": "Draft the one-line project summary and 100–300 word project description for the sandbox application.\n\nUpdate the `project_summary` and `project_description` fields in [APPLICATION.md](../APPLICATION.md).\n\nWhen complete, open a PR and include `Closes #ISSUE_NUMBER` in the PR description." }, "reusable-project": { "title": "[Critical] Confirm project is reusable (not a reference architecture)", - "labels": ["checklist-item", "checklist:reusable-project", "phase:basic-info", "critical"], + "labels": [ + "checklist-item", + "checklist:reusable-project", + "phase:basic-info", + "critical" + ], "template": "checklist-item.md", "body": "Confirm this is a reusable open source project designed for broad adoption—not a reference architecture, reference implementation, or company-specific platform.\n\nCheck the box in the `not_reference_architecture` field in [APPLICATION.md](../APPLICATION.md). If this is a reference architecture, apply to [CNCF Reference Architectures](https://architecture.cncf.io/) instead.\n\nWhen complete, open a PR and include `Closes #ISSUE_NUMBER` in the PR description." }, "org-and-repo-urls": { "title": "[Application] Org and repository URLs", - "labels": ["checklist-item", "checklist:org-and-repo-urls", "phase:project-details"], + "labels": [ + "checklist-item", + "checklist:org-and-repo-urls", + "phase:project-details" + ], "template": "checklist-item.md", "body": "Document org repo URL, primary project repo URL, and any additional repos in scope.\n\nUpdate `org_repo_url`, `project_repo_url`, and `additional_repos` in [APPLICATION.md](../APPLICATION.md)." }, - "parent-separation-vote": { - "title": "[Critical] Parent project separation vote (if applicable)", - "labels": ["checklist-item", "checklist:parent-separation-vote", "phase:project-details", "critical"], - "template": "checklist-item.md", - "body": "If the project is separating from a parent organization, link to a public issue in the parent project showing maintainer consensus to split.\n\nIf not applicable, document \"N/A\" in the `parent_separation_vote` field in [APPLICATION.md](../APPLICATION.md)." - }, "website-url": { "title": "[Application] Website URL", - "labels": ["checklist-item", "checklist:website-url", "phase:project-details"], + "labels": [ + "checklist-item", + "checklist:website-url", + "phase:project-details" + ], "template": "checklist-item.md", "body": "Provide the project website URL (or primary repo URL if no website).\n\nUpdate `website_url` in [APPLICATION.md](../APPLICATION.md)." }, "roadmap": { "title": "[Application] Roadmap and roadmap context", - "labels": ["checklist-item", "checklist:roadmap", "phase:project-details", "recommended"], + "labels": [ + "checklist-item", + "checklist:roadmap", + "phase:project-details", + "recommended" + ], "template": "checklist-item.md", "body": "Provide a publicly accessible roadmap URL and optional context.\n\nUpdate `roadmap` and `roadmap_context` in [APPLICATION.md](../APPLICATION.md)." }, "contributing-guide": { "title": "[Application] Contributing guide", - "labels": ["checklist-item", "checklist:contributing-guide", "phase:project-details", "recommended"], + "labels": [ + "checklist-item", + "checklist:contributing-guide", + "phase:project-details", + "recommended" + ], "template": "checklist-item.md", "body": "Provide a direct link to the project's contributing guide.\n\nUpdate `contributing_guide` in [APPLICATION.md](../APPLICATION.md)." }, "code-of-conduct": { "title": "[Application] Code of Conduct", - "labels": ["checklist-item", "checklist:code-of-conduct", "phase:project-details", "recommended"], + "labels": [ + "checklist-item", + "checklist:code-of-conduct", + "phase:project-details", + "recommended" + ], "template": "checklist-item.md", "body": "Provide a direct link to the project's Code of Conduct.\n\nUpdate `code_of_conduct` in [APPLICATION.md](../APPLICATION.md)." }, "adopters": { "title": "[Application] Adopters list", - "labels": ["checklist-item", "checklist:adopters", "phase:project-details", "recommended"], + "labels": [ + "checklist-item", + "checklist:adopters", + "phase:project-details", + "recommended" + ], "template": "checklist-item.md", "body": "Provide a link to the project's adopters file or document why one does not exist yet.\n\nUpdate `adopters` in [APPLICATION.md](../APPLICATION.md)." }, "maintainers-file": { "title": "[Critical] MAINTAINERS file with required columns", - "labels": ["checklist-item", "checklist:maintainers-file", "phase:project-details", "critical"], + "labels": [ + "checklist-item", + "checklist:maintainers-file", + "phase:project-details", + "critical" + ], "template": "checklist-item.md", "body": "Create or verify `MAINTAINERS.md` with Name, GitHub ID, and Company/Organization columns. Provide a direct GitHub `/blob/` link—not a contributors graph.\n\nExample format:\n```markdown\n| Maintainer | GitHub ID | Company/Organization |\n| ---------- | --------- | -------------------- |\n| Jane Doe | @janedoe | Acme Corp |\n```\n\nDocument the link in the `maintainers_file` field in [APPLICATION.md](../APPLICATION.md)." }, "security-policy": { "title": "[Application] Security policy (SECURITY.md)", - "labels": ["checklist-item", "checklist:security-policy", "phase:project-details", "recommended"], + "labels": [ + "checklist-item", + "checklist:security-policy", + "phase:project-details", + "recommended" + ], "template": "checklist-item.md", "body": "Provide a direct link to the project's security policy. See [security guidelines](https://contribute.cncf.io/maintainers/security/security-guidelines/#3-securitymd) and [templates](https://github.com/cncf/tag-security/tree/main/community/resources/project-resources/templates).\n\nUpdate `security_policy` in [APPLICATION.md](../APPLICATION.md)." }, "standard-or-spec": { "title": "[Application] Standard or specification details", - "labels": ["checklist-item", "checklist:standard-or-spec", "phase:project-details"], + "labels": [ + "checklist-item", + "checklist:standard-or-spec", + "phase:project-details" + ], "template": "checklist-item.md", "body": "Document whether the project is or includes a standard or specification. Write \"N/A\" if not applicable.\n\nUpdate `standard_or_spec` in [APPLICATION.md](../APPLICATION.md)." }, "product-separation": { "title": "[Application] Business product/service separation", - "labels": ["checklist-item", "checklist:product-separation", "phase:project-details"], + "labels": [ + "checklist-item", + "checklist:product-separation", + "phase:project-details" + ], "template": "checklist-item.md", "body": "Explain how the project is separated from any related commercial products or services.\n\nUpdate `product_separation` in [APPLICATION.md](../APPLICATION.md)." }, "why-cncf": { "title": "[Application] Why CNCF?", - "labels": ["checklist-item", "checklist:why-cncf", "phase:cloud-native"], + "labels": [ + "checklist-item", + "checklist:why-cncf", + "phase:cloud-native" + ], "template": "checklist-item.md", "body": "Draft why the project wants to join CNCF and what value CNCF membership provides.\n\nUpdate `why_cncf` in [APPLICATION.md](../APPLICATION.md)." }, "landscape-benefit": { "title": "[Application] Benefit to the Cloud Native Landscape", - "labels": ["checklist-item", "checklist:landscape-benefit", "phase:cloud-native"], + "labels": [ + "checklist-item", + "checklist:landscape-benefit", + "phase:cloud-native" + ], "template": "checklist-item.md", "body": "Describe how the project benefits the landscape and its differentiator.\n\nUpdate `landscape_benefit` in [APPLICATION.md](../APPLICATION.md)." }, "cloud-native-fit": { "title": "[Application] Cloud native fit", - "labels": ["checklist-item", "checklist:cloud-native-fit", "phase:cloud-native"], + "labels": [ + "checklist-item", + "checklist:cloud-native-fit", + "phase:cloud-native" + ], "template": "checklist-item.md", "body": "Explain where the project fits in the cloud native landscape.\n\nUpdate `cloud_native_fit` in [APPLICATION.md](../APPLICATION.md)." }, "cloud-native-integration": { "title": "[Application] Cloud native integration", - "labels": ["checklist-item", "checklist:cloud-native-integration", "phase:cloud-native"], + "labels": [ + "checklist-item", + "checklist:cloud-native-integration", + "phase:cloud-native" + ], "template": "checklist-item.md", "body": "Document which CNCF projects this complements or depends on.\n\nUpdate `cloud_native_integration` in [APPLICATION.md](../APPLICATION.md)." }, "cloud-native-overlap": { "title": "[Application] Cloud native overlap", - "labels": ["checklist-item", "checklist:cloud-native-overlap", "phase:cloud-native", "recommended"], + "labels": [ + "checklist-item", + "checklist:cloud-native-overlap", + "phase:cloud-native", + "recommended" + ], "template": "checklist-item.md", "body": "Document overlapping CNCF projects and how you differentiate.\n\nUpdate `cloud_native_overlap` in [APPLICATION.md](../APPLICATION.md)." }, "similar-projects": { "title": "[Application] Similar projects", - "labels": ["checklist-item", "checklist:similar-projects", "phase:cloud-native", "recommended"], + "labels": [ + "checklist-item", + "checklist:similar-projects", + "phase:cloud-native", + "recommended" + ], "template": "checklist-item.md", "body": "List similar projects in CNCF or elsewhere (or \"N/A\").\n\nUpdate `similar_projects` in [APPLICATION.md](../APPLICATION.md)." }, "landscape-listing": { "title": "[Application] Cloud Native Landscape listing", - "labels": ["checklist-item", "checklist:landscape-listing", "phase:cloud-native"], + "labels": [ + "checklist-item", + "checklist:landscape-listing", + "phase:cloud-native" + ], "template": "checklist-item.md", "body": "Document whether the project is listed on [landscape.cncf.io](https://landscape.cncf.io/).\n\nUpdate `landscape` in [APPLICATION.md](../APPLICATION.md)." }, "lfx-insights": { "title": "[Application] LFX Insights listing", - "labels": ["checklist-item", "checklist:lfx-insights", "phase:cloud-native"], + "labels": [ + "checklist-item", + "checklist:lfx-insights", + "phase:cloud-native" + ], "template": "checklist-item.md", "body": "Document whether the project is listed on [LFX Insights](https://insights.linuxfoundation.org/).\n\nUpdate `insights` in [APPLICATION.md](../APPLICATION.md)." }, "trademark-agreement": { "title": "[Application] Trademark and accounts agreement", - "labels": ["checklist-item", "checklist:trademark-agreement", "phase:cncf-policies"], + "labels": [ + "checklist-item", + "checklist:trademark-agreement", + "phase:cncf-policies" + ], "template": "checklist-item.md", "body": "Confirm agreement to donate project trademarks and accounts to CNCF if accepted.\n\nCheck the box in `trademark_agreement` in [APPLICATION.md](../APPLICATION.md)." }, "ip-policy-agreement": { "title": "[Application] CNCF IP policy agreement", - "labels": ["checklist-item", "checklist:ip-policy-agreement", "phase:cncf-policies"], + "labels": [ + "checklist-item", + "checklist:ip-policy-agreement", + "phase:cncf-policies" + ], "template": "checklist-item.md", "body": "Confirm agreement to follow the CNCF IP Policy if accepted.\n\nCheck the box in `ip_policy_agreement` in [APPLICATION.md](../APPLICATION.md)." }, - "apache-2-license": { - "title": "[Critical] Apache 2.0 license compliance", - "labels": ["checklist-item", "checklist:apache-2-license", "phase:cncf-policies", "critical"], - "template": "checklist-item.md", - "body": "Verify the project uses Apache 2.0 (or document required license exception). License must be compliant **before** acceptance.\n\nDocument evidence in the `license` field in [APPLICATION.md](../APPLICATION.md) and link to the LICENSE file in the project repo." - }, "license-exception": { "title": "[Application] License exception review", - "labels": ["checklist-item", "checklist:license-exception", "phase:cncf-policies"], + "labels": [ + "checklist-item", + "checklist:license-exception", + "phase:cncf-policies" + ], "template": "checklist-item.md", "body": "Document whether a license exception is needed. Write \"N/A\" if using Apache 2.0.\n\nUpdate `license_exception` in [APPLICATION.md](../APPLICATION.md)." }, "dependency-licenses": { "title": "[Application] Dependency license compliance", - "labels": ["checklist-item", "checklist:dependency-licenses", "phase:cncf-policies"], + "labels": [ + "checklist-item", + "checklist:dependency-licenses", + "phase:cncf-policies" + ], "template": "checklist-item.md", "body": "Verify all dependencies use allowlisted licenses or approved exceptions.\n\nUpdate `dependency_licenses` in [APPLICATION.md](../APPLICATION.md)." }, "domain-technical-review": { "title": "[Application] Domain Technical Review (optional)", - "labels": ["checklist-item", "checklist:domain-technical-review", "phase:cncf-policies"], + "labels": [ + "checklist-item", + "checklist:domain-technical-review", + "phase:cncf-policies" + ], "template": "checklist-item.md", "body": "Link any TAG engagement, presentations, or completed General Technical Review questionnaire.\n\nUpdate `domain_technical_review` in [APPLICATION.md](../APPLICATION.md)." }, - "repo-age-and-activity": { - "title": "[Critical] Repository age and active development", - "labels": ["checklist-item", "checklist:repo-age-and-activity", "phase:pre-submission", "critical"], - "template": "checklist-item.md", - "body": "Verify the repository is at least 6 months old with active development. Document evidence (creation date, recent commits, releases).\n\nUpdate `repo_age_evidence` in [APPLICATION.md](../APPLICATION.md)." - }, - "maintainer-diversity": { - "title": "[Recommended] Maintainer organization diversity", - "labels": ["checklist-item", "checklist:maintainer-diversity", "phase:pre-submission", "recommended"], - "template": "checklist-item.md", - "body": "Document maintainer employer diversity (different companies, not different GitHub orgs).\n\nUpdate `maintainer_diversity` in [APPLICATION.md](../APPLICATION.md)." - }, "contact-information": { "title": "[Application] Contact and signatory information", - "labels": ["checklist-item", "checklist:contact-information", "phase:contact"], + "labels": [ + "checklist-item", + "checklist:contact-information", + "phase:contact" + ], "template": "checklist-item.md", "body": "Add application contact emails and Contribution Agreement signatory information.\n\nUpdate `application_contact_emails` and `signatory_information` in [APPLICATION.md](../APPLICATION.md).\n\n**Do not commit private emails in public repos** if this application repo is public—use a private fork or store contacts in a secure location and fill them in only when generating the submission." }, "additional-information": { "title": "[Application] Additional information and CNCF contacts", - "labels": ["checklist-item", "checklist:additional-information", "phase:contact"], + "labels": [ + "checklist-item", + "checklist:additional-information", + "phase:contact" + ], "template": "checklist-item.md", "body": "Add CNCF contacts and any additional context for the TOC.\n\nUpdate `cncf_contacts` and `additional_information` in [APPLICATION.md](../APPLICATION.md)." }, "final-review": { "title": "[Submit] Final application review and CNCF submission", - "labels": ["checklist-item", "checklist:final-review", "phase:submit"], + "labels": [ + "checklist-item", + "checklist:final-review", + "phase:submit" + ], "template": "checklist-item.md", "body": "Follow the `final_review` section in [APPLICATION.md](../APPLICATION.md), then generate and submit:\n\n```bash\n./scripts/generate-submission.sh --validate\n./scripts/generate-submission.sh --create-issue --project-name \"YourProject\"\n```\n\n`--create-issue` records the CNCF issue link in APPLICATION.md and README. Open a PR with `Closes #ISSUE_NUMBER` when the final-review item is done." } diff --git a/.github/cncf-form.json b/.github/cncf-form.json index 7e791c3..75ee02d 100644 --- a/.github/cncf-form.json +++ b/.github/cncf-form.json @@ -1,6 +1,9 @@ { "title_prefix": "[Sandbox]", - "issue_labels": ["New", "contribution-agreement/unsigned"], + "issue_labels": [ + "New", + "contribution-agreement/unsigned" + ], "sections": [ { "heading": "## :clipboard: Basic project information", @@ -11,21 +14,28 @@ "label": "Project summary", "type": "text", "required": true, - "checklist": ["project-summary"] + "checklist": [ + "project-summary" + ] }, { "id": "project_description", "label": "Project description", "type": "textarea", "required": true, - "checklist": ["project-summary"] + "checklist": [ + "project-summary" + ] }, { "id": "not_reference_architecture", - "label": "This is a reusable open source project designed for broad adoption, not a reference architecture, reference implementation, or demonstration of patterns", + "label": "Project vs Reference Architecture/Implementation", "type": "checkbox", "required": true, - "checklist": ["reusable-project"] + "checklist": [ + "reusable-project" + ], + "option_label": "This is a reusable open source project designed for broad adoption, not a reference architecture, reference implementation, or demonstration of patterns" } ] }, @@ -38,98 +48,117 @@ "label": "Org repo URL (provide if all repos under the org are in scope of the application)", "type": "text", "required": true, - "checklist": ["org-and-repo-urls"] + "checklist": [ + "org-and-repo-urls" + ] }, { "id": "project_repo_url", "label": "Project repo URL in scope of application", "type": "text", "required": true, - "checklist": ["org-and-repo-urls"] + "checklist": [ + "org-and-repo-urls" + ] }, { "id": "additional_repos", "label": "Additional repos in scope of the application", "type": "textarea", "required": false, - "checklist": ["org-and-repo-urls"] - }, - { - "id": "parent_separation_vote", - "label": "Parent project separation vote (if applicable)", - "type": "textarea", - "required": false, - "checklist": ["parent-separation-vote"] + "checklist": [ + "org-and-repo-urls" + ] }, { "id": "website_url", "label": "Website URL", "type": "text", "required": true, - "checklist": ["website-url"] + "checklist": [ + "website-url" + ] }, { "id": "roadmap", "label": "Roadmap", "type": "text", "required": true, - "checklist": ["roadmap"] + "checklist": [ + "roadmap" + ] }, { "id": "roadmap_context", "label": "Roadmap context", "type": "textarea", "required": true, - "checklist": ["roadmap"] + "checklist": [ + "roadmap" + ] }, { "id": "contributing_guide", "label": "Contributing guide", "type": "text", "required": true, - "checklist": ["contributing-guide"] + "checklist": [ + "contributing-guide" + ] }, { "id": "code_of_conduct", "label": "Code of Conduct (CoC)", "type": "text", "required": true, - "checklist": ["code-of-conduct"] + "checklist": [ + "code-of-conduct" + ] }, { "id": "adopters", "label": "Adopters", "type": "text", "required": false, - "checklist": ["adopters"] + "checklist": [ + "adopters" + ] }, { "id": "maintainers_file", "label": "Maintainers file", "type": "text", "required": true, - "checklist": ["maintainers-file"] + "checklist": [ + "maintainers-file" + ] }, { "id": "security_policy", "label": "Security policy file", "type": "text", "required": true, - "checklist": ["security-policy"] + "checklist": [ + "security-policy" + ] }, { "id": "standard_or_spec", "label": "Standard or specification?", "type": "textarea", "required": true, - "checklist": ["standard-or-spec"] + "checklist": [ + "standard-or-spec" + ] }, { "id": "product_separation", "label": "Business product or service to project separation", "type": "textarea", "required": true, - "checklist": ["product-separation"] + "checklist": [ + "product-separation" + ] } ] }, @@ -142,56 +171,72 @@ "label": "Why CNCF?", "type": "textarea", "required": true, - "checklist": ["why-cncf"] + "checklist": [ + "why-cncf" + ] }, { "id": "landscape_benefit", "label": "Benefit to the landscape", "type": "textarea", "required": true, - "checklist": ["landscape-benefit"] + "checklist": [ + "landscape-benefit" + ] }, { "id": "cloud_native_fit", "label": "Cloud native 'fit'", "type": "textarea", "required": true, - "checklist": ["cloud-native-fit"] + "checklist": [ + "cloud-native-fit" + ] }, { "id": "cloud_native_integration", "label": "Cloud native 'integration'", "type": "textarea", "required": true, - "checklist": ["cloud-native-integration"] + "checklist": [ + "cloud-native-integration" + ] }, { "id": "cloud_native_overlap", "label": "Cloud native overlap", "type": "textarea", "required": true, - "checklist": ["cloud-native-overlap"] + "checklist": [ + "cloud-native-overlap" + ] }, { "id": "similar_projects", "label": "Similar projects", "type": "textarea", "required": true, - "checklist": ["similar-projects"] + "checklist": [ + "similar-projects" + ] }, { "id": "landscape", "label": "Landscape", "type": "textarea", "required": true, - "checklist": ["landscape-listing"] + "checklist": [ + "landscape-listing" + ] }, { "id": "insights", "label": "Insights", "type": "textarea", "required": true, - "checklist": ["lfx-insights"] + "checklist": [ + "lfx-insights" + ] } ] }, @@ -201,85 +246,74 @@ "fields": [ { "id": "trademark_agreement", - "label": "If the project is accepted, I agree to donate all project trademarks and accounts to the CNCF", + "label": "Trademark and accounts", "type": "checkbox", "required": true, - "checklist": ["trademark-agreement"] + "checklist": [ + "trademark-agreement" + ], + "option_label": "If the project is accepted, I agree to donate all project trademarks and accounts to the CNCF" }, { "id": "ip_policy_agreement", - "label": "If the project is accepted, I agree the project will follow the CNCF IP Policy", + "label": "IP policy", "type": "checkbox", "required": true, - "checklist": ["ip-policy-agreement"] - }, - { - "id": "license", - "label": "Project license (Apache 2.0)", - "type": "textarea", - "required": true, - "checklist": ["apache-2-license"] + "checklist": [ + "ip-policy-agreement" + ], + "option_label": "If the project is accepted, I agree the project will follow the CNCF IP Policy" }, { "id": "license_exception", "label": "Will the project require a license exception?", "type": "textarea", "required": true, - "checklist": ["license-exception"] + "checklist": [ + "license-exception" + ] }, { "id": "dependency_licenses", "label": "Does the project utilize any dependencies with licenses not on the allowlist or an approved exception?", "type": "textarea", "required": true, - "checklist": ["dependency-licenses"] + "checklist": [ + "dependency-licenses" + ] }, { "id": "domain_technical_review", "label": "Project \"Domain Technical Review\"", "type": "textarea", "required": false, - "checklist": ["domain-technical-review"] - } - ] - }, - { - "heading": "## :white_check_mark: Pre-submission verification", - "intro": "Evidence for critical requirements reviewed before submission.", - "fields": [ - { - "id": "repo_age_evidence", - "label": "Repository age and active development evidence", - "type": "textarea", - "required": true, - "checklist": ["repo-age-and-activity"] - }, - { - "id": "maintainer_diversity", - "label": "Maintainer organization diversity", - "type": "textarea", - "required": false, - "checklist": ["maintainer-diversity"] + "checklist": [ + "domain-technical-review" + ] } ] }, { "heading": "## :envelope: Contact information", - "intro": "Provide information about who to contact with questions about the project and who will sign the Contribution Agreement.", + "intro": "Provide information about who to contact with questions about the project and who will sign the [Contribution Agreement](https://github.com/cncf/foundation/blob/main/agreements/Sample%20Contribution%20Agreement%20(2025).pdf).", "fields": [ { "id": "application_contact_emails", "label": "Application contact email(s)", "type": "textarea", "required": true, - "checklist": ["contact-information"] + "checklist": [ + "contact-information" + ] }, { "id": "signatory_information", "label": "Contributing or sponsoring entity signatory information", "type": "textarea", "required": true, - "checklist": ["contact-information"] + "checklist": [ + "contact-information" + ] } ] }, @@ -292,14 +326,18 @@ "label": "CNCF contacts", "type": "textarea", "required": false, - "checklist": ["additional-information"] + "checklist": [ + "additional-information" + ] }, { "id": "additional_information", "label": "Additional information", "type": "textarea", "required": false, - "checklist": ["additional-information"] + "checklist": [ + "additional-information" + ] } ] } diff --git a/.github/workflows/sync-checklist-pr.yml b/.github/workflows/sync-checklist-pr.yml index 987763a..58bd938 100644 --- a/.github/workflows/sync-checklist-pr.yml +++ b/.github/workflows/sync-checklist-pr.yml @@ -11,8 +11,9 @@ permissions: jobs: link-pr-on-checklist: runs-on: ubuntu-latest - # Skip bot PRs and re-entry after this workflow pushes to the PR branch. + # End-user application repos only; skip bot PRs / re-entry after push. if: > + !github.event.repository.is_template && github.event.pull_request.user.login != 'github-actions[bot]' && github.actor != 'github-actions[bot]' steps: diff --git a/.github/workflows/sync-checklist.yml b/.github/workflows/sync-checklist.yml index 0120b1b..6f4eb39 100644 --- a/.github/workflows/sync-checklist.yml +++ b/.github/workflows/sync-checklist.yml @@ -19,8 +19,9 @@ concurrency: jobs: sync-checklist: runs-on: ubuntu-latest - # Ignore closes caused by bot sync noise; only checklist-item issues. + # End-user application repos only; ignore bot closes; checklist-item issues. if: > + !github.event.repository.is_template && contains(github.event.issue.labels.*.name, 'checklist-item') && github.event.issue.user.type != 'Bot' steps: diff --git a/.github/workflows/sync-cncf-form.yml b/.github/workflows/sync-cncf-form.yml new file mode 100644 index 0000000..a728702 --- /dev/null +++ b/.github/workflows/sync-cncf-form.yml @@ -0,0 +1,54 @@ +name: Sync CNCF application form + +on: + schedule: + - cron: "0 8 * * 1" + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + sync: + # Maintainer-only: keep the template form snapshot current. + if: github.event.repository.is_template + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: pip install -r requirements-dev.txt + + - name: Check upstream form + id: check + run: | + set +e + python3 scripts/sync_cncf_form.py --check --report | tee form-sync-report.md + status=${PIPESTATUS[0]} + set -e + if [ "$status" -eq 0 ]; then + echo "drift=false" >> "$GITHUB_OUTPUT" + else + echo "drift=true" >> "$GITHUB_OUTPUT" + fi + + - name: Sync form artifacts + if: steps.check.outputs.drift == 'true' + run: python3 scripts/sync_cncf_form.py --write --merge-application --report | tee form-sync-report.md + + - name: Open pull request + if: steps.check.outputs.drift == 'true' + uses: peter-evans/create-pull-request@v7 + with: + commit-message: "chore: sync CNCF sandbox application form" + title: "chore: sync CNCF sandbox application form" + body-path: form-sync-report.md + branch: chore/sync-cncf-form + delete-branch: true diff --git a/.github/workflows/validate-pr-closes-issues.yml b/.github/workflows/validate-pr-closes-issues.yml index 2409e95..b7bd956 100644 --- a/.github/workflows/validate-pr-closes-issues.yml +++ b/.github/workflows/validate-pr-closes-issues.yml @@ -11,7 +11,9 @@ permissions: jobs: comment-missing-closes: runs-on: ubuntu-latest - if: github.event.pull_request.user.login != 'github-actions[bot]' + if: > + !github.event.repository.is_template && + github.event.pull_request.user.login != 'github-actions[bot]' steps: - name: Check for closing keywords uses: actions/github-script@v7 diff --git a/.gitignore b/.gitignore index 5d126fa..598f759 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,10 @@ .env.* .vscode/ CNCF-SUBMISSION.md +CNCF-SUBMISSION.md.meta.json +APPLICATION-orphaned-answers.md +APPLICATION-orphaned-answers-*.md __pycache__/ scripts/__pycache__/ +.venv/ +.pydeps/ diff --git a/APPLICATION.md b/APPLICATION.md index b55430b..a19563c 100644 --- a/APPLICATION.md +++ b/APPLICATION.md @@ -26,6 +26,8 @@ Based on this form, a Contribution Agreement is sent to your contacts. **It must > [!CAUTION] > The TOC must approve your application and a Contribution Agreement must be signed before the project is an official CNCF project. Do not represent the project as "donated" or "contributed" until those steps complete. +**Critical requirements (CNCF may close the application if missing):** Apache 2.0 license; MAINTAINERS file with Name, GitHub ID, and Company/Organization; repository at least 6 months old with active development; reusable project (not a reference architecture); parent-separation vote linked in Additional information if applicable. + When finished, add review notes or links under **Your answer** below and open a PR with `Closes` and the issue number on the checklist line. @@ -80,6 +82,8 @@ Document URLs for this application: - `org_repo_url` — org repo if all repos under the org are in scope, or N/A - `project_repo_url` — primary project repository - `additional_repos` — other in-scope repos, or leave blank + +If this project is separating from a parent organization, link a **public maintainer vote** in `additional_information` (required by the CNCF form). - [ ] Org and repository URLs documented (Issue: #ISSUE_ORG_AND_REPO_URLS) @@ -96,18 +100,6 @@ _Primary project repository URL._ _Additional repository URLs in scope, or leave blank._ -## parent_separation_vote - - -If separating from a parent project, link a **public issue** in the parent repo showing maintainer consensus to split. Otherwise document **N/A** in `parent_separation_vote`. - - -- [ ] Parent project separation vote linked (or N/A documented) (Issue: #ISSUE_PARENT_SEPARATION_VOTE) - -**Your answer:** - -_If separating from a parent project, link to the public maintainer vote issue. Otherwise write N/A._ - ## website_url @@ -349,26 +341,12 @@ If accepted, the project will follow the CNCF IP Policy. Check the box when you _Optional notes._ -## license - - -**Critical:** License must be Apache 2.0 (or an approved exception documented separately) **before** acceptance—not after. - -Document the license and link to the `LICENSE` file in the project repo. - -Common auto-closure mistakes: BSL/GPL, or promising to relicense later. - - -- [ ] Apache 2.0 license compliance documented (Issue: #ISSUE_APACHE_2_LICENSE) - -**Your answer:** - -_Project license (must be Apache 2.0) and link to LICENSE file._ - ## license_exception -Document whether a CNCF license exception is needed. Write **N/A** if using Apache 2.0 with no exception. +**Critical:** Core project code must be Apache 2.0 before acceptance (or an approved CNCF license exception). Do not promise to relicense later. + +Document whether a license exception is needed and link the `LICENSE` file. Write **N/A** if using Apache 2.0 with no exception. - [ ] License exception review completed (Issue: #ISSUE_LICENSE_EXCEPTION) @@ -401,34 +379,6 @@ Optional: link TAG engagement, presentations, or a completed General Technical R _TAG engagement, presentations, or General Technical Review links. Leave blank if not applicable._ -## repo_age_evidence - - -**Critical:** Repository must be at least **6 months** old with evidence of active development (recent commits, releases, etc.). - -Document creation date and activity below. - -Common mistake: submitting a repo younger than six months. - - -- [ ] Repository age and active development verified (Issue: #ISSUE_REPO_AGE_AND_ACTIVITY) - -**Your answer:** - -_Repository creation date and evidence of active development (recent commits, releases, etc.)._ - -## maintainer_diversity - - -Document maintainer **employer** diversity. Different GitHub org memberships do **not** count as organization diversity. - - -- [ ] Maintainer organization diversity documented (Issue: #ISSUE_MAINTAINER_DIVERSITY) - -**Your answer:** - -_Maintainer employers. Different GitHub org memberships do not count as organization diversity._ - ## application_contact_emails @@ -452,6 +402,8 @@ _Contribution Agreement signatory details. Use the table format from the CNCF fo Add CNCF leadership contacts familiar with the project (TOC, TAGs, etc.) in `cncf_contacts` and any extra TOC context in `additional_information`. + +If separating from a parent project, include the public maintainer-vote issue in `additional_information`. - [ ] CNCF contacts and additional information completed (Issue: #ISSUE_ADDITIONAL_INFORMATION) @@ -474,6 +426,8 @@ When every checklist item above is complete: ./scripts/generate-submission.sh --create-issue --project-name "YourProject" ``` +You do not need to sync the CNCF form first — `--validate` / `--create-issue` check the live CNCF template and map your answers onto it. + Or copy `CNCF-SUBMISSION.md` into a [new CNCF sandbox issue](https://github.com/cncf/sandbox/issues/new?assignees=&labels=New&projects=&template=application.yml&title=%5BSandbox%5D+%3CProject+Name%3E). `--create-issue` records the CNCF issue link in this section and in README automatically. Then open a PR with `Closes` and the final-review issue number. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92346bb..65ac2a9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ The [sync-checklist workflow](.github/workflows/sync-checklist.yml) is a fallbac When all checklist items are complete: ```bash -# Validate all required fields are filled in +# Validate against the live CNCF form and your APPLICATION.md answers ./scripts/generate-submission.sh --validate # Option A: create the CNCF issue directly (requires gh auth) @@ -65,8 +65,12 @@ When all checklist items are complete: ./scripts/generate-submission.sh ``` +You do **not** sync the form while preparing your application. `--validate` and `--create-issue` fetch the live CNCF application template and map your answers onto it. If CNCF added a new required field, the command tells you which `## field_id` section to add in `APPLICATION.md`. + `--create-issue` records the CNCF issue URL in README metadata and in the `final_review` section of `APPLICATION.md`. +Use `--offline` only if you must generate from the local form snapshot without network access. + ## Branch naming Use descriptive branch names: @@ -96,6 +100,26 @@ Issues created by the bootstrap script use these labels: | `recommended` | Improves review experience | | `phase:*` | Application section grouping | +## Template maintainers + +Applicants should ignore this section. Keeping [`.github/cncf-form.json`](.github/cncf-form.json) aligned with [`cncf/sandbox` `application.yml`](https://github.com/cncf/sandbox/blob/main/.github/ISSUE_TEMPLATE/application.yml) is for template maintainers only (so *new* forks start current). + +```bash +python3 -m venv .venv && source .venv/bin/activate +pip install -r requirements-dev.txt +./scripts/sync-cncf-form.sh --check +./scripts/sync-cncf-form.sh --write --merge-application +./scripts/bootstrap-issues.sh --non-interactive # only if new checklist slugs appeared +``` + +- `--check` exits non-zero when the committed form does not match upstream (CI). +- `--write` updates the form snapshot and checklist stubs. +- `--merge-application` rewrites `APPLICATION.md` while preserving answers and Issue/PR links. +- Do not run `python3 scripts/render_application_template.py` on a fork with real answers; it overwrites the file. + +A weekly workflow ([sync-cncf-form.yml](.github/workflows/sync-cncf-form.yml)) opens a PR when upstream drifts. If sync reports unmatched fields, add a mapping in [`scripts/cncf_field_aliases.json`](scripts/cncf_field_aliases.json). + + ## References - [CNCF Sandbox README](https://github.com/cncf/sandbox/blob/main/README.md) diff --git a/README.md b/README.md index ad26098..0d5283c 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ This repository helps you prepare a [CNCF Sandbox application](https://github.co ./scripts/generate-submission.sh --create-issue ``` + You do **not** need to sync the CNCF form while working. At submit time, + `generate-submission.sh` checks the live CNCF application template and maps + your `APPLICATION.md` answers onto it. + See [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow. ## How tracking works @@ -46,7 +50,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow. ## Application progress -> **Application progress:** **0 / 33** items complete (0%) +> **Application progress:** **0 / 29** items complete (0%) > `░░░░░░░░░░░░░░░░░░░░` 0% @@ -55,7 +59,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow. Each row links to the matching section in [APPLICATION.md](APPLICATION.md). A PR with `Closes #N` checks the box and switches `(Issue: …)` to `(PR: …)` automatically — do not edit these lines by hand. -### [Read Prerequisites](APPLICATION.md#read_prerequisites) +### [read_prerequisites](APPLICATION.md#read_prerequisites) - [ ] Reviewed all prerequisite documentation (Issue: #ISSUE_READ_PREREQUISITES) @@ -77,10 +81,6 @@ Each row links to the matching section in [APPLICATION.md](APPLICATION.md). A PR ### [additional_repos](APPLICATION.md#additional_repos) -### [parent_separation_vote](APPLICATION.md#parent_separation_vote) - -- [ ] Parent project separation vote linked (or N/A documented) (Issue: #ISSUE_PARENT_SEPARATION_VOTE) - ### [website_url](APPLICATION.md#website_url) - [ ] Website URL documented (Issue: #ISSUE_WEBSITE_URL) @@ -159,10 +159,6 @@ Each row links to the matching section in [APPLICATION.md](APPLICATION.md). A PR - [ ] If the project is accepted, I agree the project will follow the CNCF IP Policy (Issue: #ISSUE_IP_POLICY_AGREEMENT) -### [license](APPLICATION.md#license) - -- [ ] Apache 2.0 license compliance documented (Issue: #ISSUE_APACHE_2_LICENSE) - ### [license_exception](APPLICATION.md#license_exception) - [ ] License exception review completed (Issue: #ISSUE_LICENSE_EXCEPTION) @@ -175,14 +171,6 @@ Each row links to the matching section in [APPLICATION.md](APPLICATION.md). A PR - [ ] Domain Technical Review linked (if applicable) (Issue: #ISSUE_DOMAIN_TECHNICAL_REVIEW) -### [repo_age_evidence](APPLICATION.md#repo_age_evidence) - -- [ ] Repository age and active development verified (Issue: #ISSUE_REPO_AGE_AND_ACTIVITY) - -### [maintainer_diversity](APPLICATION.md#maintainer_diversity) - -- [ ] Maintainer organization diversity documented (Issue: #ISSUE_MAINTAINER_DIVERSITY) - ### [application_contact_emails](APPLICATION.md#application_contact_emails) - [ ] Application contact emails and signatory information completed (Issue: #ISSUE_CONTACT_INFORMATION) @@ -206,6 +194,7 @@ Each row links to the matching section in [APPLICATION.md](APPLICATION.md). A PR - [CNCF Project Lifecycle & Process](https://github.com/cncf/toc/blob/main/process/README.md) - [CNCF Sandbox Application Form](https://github.com/cncf/sandbox/issues/new?assignees=&labels=New&projects=&template=application.yml&title=%5BSandbox%5D+%3CProject+Name%3E) + ## License Apache License 2.0 — see [LICENSE](LICENSE). diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..c1a201d --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1 @@ +PyYAML>=6.0 diff --git a/scripts/application_field_guides.json b/scripts/application_field_guides.json index acdad6a..d91e1f5 100644 --- a/scripts/application_field_guides.json +++ b/scripts/application_field_guides.json @@ -1,9 +1,8 @@ { - "read_prerequisites": "Thank you for applying to join the CNCF Sandbox. Read and understand:\n\n- CNCF [Sandbox README](https://github.com/cncf/sandbox/blob/main/README.md)\n- CNCF [Project Lifecycle & Process](https://github.com/cncf/toc/blob/main/process/README.md#cncf-project-lifecycle--process)\n- CNCF IP Policy, from [section 11 of the CNCF Charter](https://github.com/cncf/foundation/blob/main/charter.md#11-ip-policy), particularly Apache 2.0\n- CNCF [Allowlist License Policy](https://github.com/cncf/foundation/blob/main/policies-guidance/allowed-third-party-license-policy.md) for dependencies\n- CNCF [minimal support and marketing expectations for Sandbox projects](https://contribute.cncf.io/resources/project-services/maturity-levels/#sandbox)\n\nBased on this form, a Contribution Agreement is sent to your contacts. **It must be signed before the TOC can vote.** Linux Foundation countersigns only after a successful vote.\n\n> [!CAUTION]\n> The TOC must approve your application and a Contribution Agreement must be signed before the project is an official CNCF project. Do not represent the project as \"donated\" or \"contributed\" until those steps complete.\n\nWhen finished, add review notes or links under **Your answer** below and open a PR with `Closes` and the issue number on the checklist line.", + "read_prerequisites": "Thank you for applying to join the CNCF Sandbox. Read and understand:\n\n- CNCF [Sandbox README](https://github.com/cncf/sandbox/blob/main/README.md)\n- CNCF [Project Lifecycle & Process](https://github.com/cncf/toc/blob/main/process/README.md#cncf-project-lifecycle--process)\n- CNCF IP Policy, from [section 11 of the CNCF Charter](https://github.com/cncf/foundation/blob/main/charter.md#11-ip-policy), particularly Apache 2.0\n- CNCF [Allowlist License Policy](https://github.com/cncf/foundation/blob/main/policies-guidance/allowed-third-party-license-policy.md) for dependencies\n- CNCF [minimal support and marketing expectations for Sandbox projects](https://contribute.cncf.io/resources/project-services/maturity-levels/#sandbox)\n\nBased on this form, a Contribution Agreement is sent to your contacts. **It must be signed before the TOC can vote.** Linux Foundation countersigns only after a successful vote.\n\n> [!CAUTION]\n> The TOC must approve your application and a Contribution Agreement must be signed before the project is an official CNCF project. Do not represent the project as \"donated\" or \"contributed\" until those steps complete.\n\n**Critical requirements (CNCF may close the application if missing):** Apache 2.0 license; MAINTAINERS file with Name, GitHub ID, and Company/Organization; repository at least 6 months old with active development; reusable project (not a reference architecture); parent-separation vote linked in Additional information if applicable.\n\nWhen finished, add review notes or links under **Your answer** below and open a PR with `Closes` and the issue number on the checklist line.", "project_summary": "Draft the CNCF form fields in the sections below:\n\n- `project_summary` — one-line summary\n- `project_description` — 100–300 words on what the project does, why it is needed, and gaps it fills\n\nOpen one PR covering both fields; use `Closes` with the issue on the checklist line.", "not_reference_architecture": "Confirm this is a **reusable open source project** for broad adoption—not a reference architecture, reference implementation, or demo of patterns.\n\nIf this is a reference architecture, apply via [CNCF Reference Architectures](https://architecture.cncf.io/) instead.\n\nCheck the box below when confirmed.", - "org_repo_url": "Document URLs for this application:\n\n- `org_repo_url` — org repo if all repos under the org are in scope, or N/A\n- `project_repo_url` — primary project repository\n- `additional_repos` — other in-scope repos, or leave blank", - "parent_separation_vote": "If separating from a parent project, link a **public issue** in the parent repo showing maintainer consensus to split. Otherwise document **N/A** in `parent_separation_vote`.", + "org_repo_url": "Document URLs for this application:\n\n- `org_repo_url` — org repo if all repos under the org are in scope, or N/A\n- `project_repo_url` — primary project repository\n- `additional_repos` — other in-scope repos, or leave blank\n\nIf this project is separating from a parent organization, link a **public maintainer vote** in `additional_information` (required by the CNCF form).", "website_url": "Provide the project website URL, or the primary repo URL if there is no dedicated site.", "roadmap": "Provide a publicly accessible roadmap URL in `roadmap` and optional direction in `roadmap_context`.", "contributing_guide": "Link directly to the project's contributing guide (not a promise to add one later).", @@ -23,13 +22,16 @@ "insights": "Are you listed on [LFX Insights](https://insights.linuxfoundation.org/)? Document status.", "trademark_agreement": "If accepted, you agree to donate project trademarks and accounts to the CNCF. Check the box when you accept.", "ip_policy_agreement": "If accepted, the project will follow the CNCF IP Policy. Check the box when you accept.", - "license": "**Critical:** License must be Apache 2.0 (or an approved exception documented separately) **before** acceptance—not after.\n\nDocument the license and link to the `LICENSE` file in the project repo.\n\nCommon auto-closure mistakes: BSL/GPL, or promising to relicense later.", - "license_exception": "Document whether a CNCF license exception is needed. Write **N/A** if using Apache 2.0 with no exception.", + "license_exception": "**Critical:** Core project code must be Apache 2.0 before acceptance (or an approved CNCF license exception). Do not promise to relicense later.\n\nDocument whether a license exception is needed and link the `LICENSE` file. Write **N/A** if using Apache 2.0 with no exception.", "dependency_licenses": "Verify dependency licenses are on the [CNCF allowlist](https://github.com/cncf/foundation/blob/main/policies-guidance/allowed-third-party-license-policy.md) or have approved exceptions. Write **N/A** if fully compliant.", "domain_technical_review": "Optional: link TAG engagement, presentations, or a completed General Technical Review questionnaire. Leave blank if not applicable.", - "repo_age_evidence": "**Critical:** Repository must be at least **6 months** old with evidence of active development (recent commits, releases, etc.).\n\nDocument creation date and activity below.\n\nCommon mistake: submitting a repo younger than six months.", - "maintainer_diversity": "Document maintainer **employer** diversity. Different GitHub org memberships do **not** count as organization diversity.", "application_contact_emails": "Add application contact emails in `application_contact_emails` and Contribution Agreement signatory details in `signatory_information` (table format from the CNCF form).\n\n> [!WARNING]\n> If this repo is public, avoid committing private emails. Use a private fork or fill contacts only when generating the submission locally.", - "cncf_contacts": "Add CNCF leadership contacts familiar with the project (TOC, TAGs, etc.) in `cncf_contacts` and any extra TOC context in `additional_information`.", - "final_review": "When every checklist item above is complete:\n\n```bash\n./scripts/generate-submission.sh --validate\n./scripts/generate-submission.sh --create-issue --project-name \"YourProject\"\n```\n\nOr copy `CNCF-SUBMISSION.md` into a [new CNCF sandbox issue](https://github.com/cncf/sandbox/issues/new?assignees=&labels=New&projects=&template=application.yml&title=%5BSandbox%5D+%3CProject+Name%3E).\n\n`--create-issue` records the CNCF issue link in this section and in README automatically. Then open a PR with `Closes` and the final-review issue number." + "cncf_contacts": "Add CNCF leadership contacts familiar with the project (TOC, TAGs, etc.) in `cncf_contacts` and any extra TOC context in `additional_information`.\n\nIf separating from a parent project, include the public maintainer-vote issue in `additional_information`.", + "final_review": "When every checklist item above is complete:\n\n```bash\n./scripts/generate-submission.sh --validate\n./scripts/generate-submission.sh --create-issue --project-name \"YourProject\"\n```\n\nYou do not need to sync the CNCF form first — `--validate` / `--create-issue` check the live CNCF template and map your answers onto it.\n\nOr copy `CNCF-SUBMISSION.md` into a [new CNCF sandbox issue](https://github.com/cncf/sandbox/issues/new?assignees=&labels=New&projects=&template=application.yml&title=%5BSandbox%5D+%3CProject+Name%3E).\n\n`--create-issue` records the CNCF issue link in this section and in README automatically. Then open a PR with `Closes` and the final-review issue number.", + "project_description": "Provide a brief, 100-300 word description of the project that explains what it does and why it's needed.", + "project_repo_url": "Provide the URL of the primary source code for the project. If there is no single repo but all repos under the org are in scope of the application, write \"N/A\". If multiple repos (in addition to the primary repo) exist under an org, but not all are in scope, please enumerate in scope repos in the next question.", + "additional_repos": "Provide the URLs of any additional repos for this project's application if appropriate.", + "roadmap_context": "You may optionally provide any details of the roadmap and/or direction of the project you feel are required for clarity.", + "signatory_information": "Provide the email address(es) of the project's contributing or sponsoring company/organization or group of individuals. This is the person or people that would sign the [Contribution Agreement](https://github.com/cncf/foundation/blob/main/agreements/Sample%20Contribution%20Agreement%20(2025).pdf) which assigns trademarks (if any), domains, and accounts to the Linux Foundation.", + "additional_information": "Any additional information you would like the TOC to consider when evaluating this project?" } diff --git a/scripts/application_field_placeholders.json b/scripts/application_field_placeholders.json index a19bf00..ef73a36 100644 --- a/scripts/application_field_placeholders.json +++ b/scripts/application_field_placeholders.json @@ -6,7 +6,6 @@ "org_repo_url": "_Org repo URL, or N/A._", "project_repo_url": "_Primary project repository URL._", "additional_repos": "_Additional repository URLs in scope, or leave blank._", - "parent_separation_vote": "_If separating from a parent project, link to the public maintainer vote issue. Otherwise write N/A._", "website_url": "_Project website URL, or primary repo URL if no website._", "roadmap": "_Roadmap URL._", "roadmap_context": "_Optional details about roadmap direction._", @@ -27,12 +26,9 @@ "insights": "_Are you listed on [LFX Insights](https://insights.linuxfoundation.org/)?_", "trademark_agreement": "If the project is accepted, I agree to donate all project trademarks and accounts to the CNCF", "ip_policy_agreement": "If the project is accepted, I agree the project will follow the CNCF IP Policy", - "license": "_Project license (must be Apache 2.0) and link to LICENSE file._", "license_exception": "_Write N/A if using Apache 2.0 with no exception needed._", "dependency_licenses": "_Write N/A if all dependency licenses are on the CNCF allowlist or an approved exception._", "domain_technical_review": "_TAG engagement, presentations, or General Technical Review links. Leave blank if not applicable._", - "repo_age_evidence": "_Repository creation date and evidence of active development (recent commits, releases, etc.)._", - "maintainer_diversity": "_Maintainer employers. Different GitHub org memberships do not count as organization diversity._", "application_contact_emails": "_Comma-separated application contact email addresses._", "signatory_information": "_Contribution Agreement signatory details. Use the table format from the CNCF form._", "cncf_contacts": "_CNCF leadership contacts familiar with the project (TOC, TAGs, etc.)._", diff --git a/scripts/checklist_checkbox_labels.json b/scripts/checklist_checkbox_labels.json index 224ed6a..c0a7d2b 100644 --- a/scripts/checklist_checkbox_labels.json +++ b/scripts/checklist_checkbox_labels.json @@ -3,7 +3,6 @@ "project-summary": "Project summary and description drafted", "reusable-project": "Confirmed this is a reusable open source project, not a reference architecture", "org-and-repo-urls": "Org and repository URLs documented", - "parent-separation-vote": "Parent project separation vote linked (or N/A documented)", "website-url": "Website URL documented", "roadmap": "Roadmap and context documented", "contributing-guide": "Contributing guide linked", @@ -23,12 +22,9 @@ "lfx-insights": "LFX Insights status documented", "trademark-agreement": "Trademark and accounts agreement confirmed", "ip-policy-agreement": "CNCF IP policy agreement confirmed", - "apache-2-license": "Apache 2.0 license compliance documented", "license-exception": "License exception review completed", "dependency-licenses": "Dependency license compliance verified", "domain-technical-review": "Domain Technical Review linked (if applicable)", - "repo-age-and-activity": "Repository age and active development verified", - "maintainer-diversity": "Maintainer organization diversity documented", "contact-information": "Application contact emails and signatory information completed", "additional-information": "CNCF contacts and additional information completed", "final-review": "Final review complete and application submitted to CNCF" diff --git a/scripts/cncf_field_aliases.json b/scripts/cncf_field_aliases.json new file mode 100644 index 0000000..d4067c0 --- /dev/null +++ b/scripts/cncf_field_aliases.json @@ -0,0 +1,45 @@ +{ + "by_id": { + "not-reference-architecture": "not_reference_architecture", + "trademark": "trademark_agreement", + "ippolicy": "ip_policy_agreement" + }, + "by_label": { + "Project summary": "project_summary", + "Project description": "project_description", + "Project vs Reference Architecture/Implementation": "not_reference_architecture", + "This is a reusable open source project designed for broad adoption, not a reference architecture, reference implementation, or demonstration of patterns": "not_reference_architecture", + "Org repo URL (provide if all repos under the org are in scope of the application)": "org_repo_url", + "Project repo URL in scope of application": "project_repo_url", + "Additional repos in scope of the application": "additional_repos", + "Website URL": "website_url", + "Roadmap": "roadmap", + "Roadmap context": "roadmap_context", + "Contributing guide": "contributing_guide", + "Code of Conduct (CoC)": "code_of_conduct", + "Adopters": "adopters", + "Maintainers file": "maintainers_file", + "Security policy file": "security_policy", + "Standard or specification?": "standard_or_spec", + "Business product or service to project separation": "product_separation", + "Why CNCF?": "why_cncf", + "Benefit to the landscape": "landscape_benefit", + "Cloud native 'fit'": "cloud_native_fit", + "Cloud native 'integration'": "cloud_native_integration", + "Cloud native overlap": "cloud_native_overlap", + "Similar projects": "similar_projects", + "Landscape": "landscape", + "Insights": "insights", + "Trademark and accounts": "trademark_agreement", + "If the project is accepted, I agree to donate all project trademarks and accounts to the CNCF": "trademark_agreement", + "IP policy": "ip_policy_agreement", + "If the project is accepted, I agree the project will follow the CNCF IP Policy": "ip_policy_agreement", + "Will the project require a license exception?": "license_exception", + "Does the project utilize any dependencies with licenses not on the allowlist or an approved exception?": "dependency_licenses", + "Project \"Domain Technical Review\"": "domain_technical_review", + "Application contact email(s)": "application_contact_emails", + "Contributing or sponsoring entity signatory information": "signatory_information", + "CNCF contacts": "cncf_contacts", + "Additional information": "additional_information" + } +} diff --git a/scripts/generate-submission.sh b/scripts/generate-submission.sh index c448ca4..85d54e6 100755 --- a/scripts/generate-submission.sh +++ b/scripts/generate-submission.sh @@ -2,10 +2,13 @@ set -euo pipefail # Generates CNCF-SUBMISSION.md from APPLICATION.md for one-step CNCF submission. +# Fetches the live CNCF form so submission matches the current official template. +# Applicants do not need to sync their worksheet first. # # Prerequisites: # - jq installed # - python3 installed +# - network access (for live form check on --validate / --create-issue) # # Usage: # ./scripts/generate-submission.sh # generate CNCF-SUBMISSION.md @@ -17,27 +20,36 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" FORM_FILE="${ROOT_DIR}/.github/cncf-form.json" ANSWERS_FILE="${ROOT_DIR}/APPLICATION.md" OUTPUT_FILE="${ROOT_DIR}/CNCF-SUBMISSION.md" +FORM_META_FILE="${OUTPUT_FILE}.meta.json" METADATA_FILE="${ROOT_DIR}/.github/project-metadata.json" GENERATOR="${ROOT_DIR}/scripts/generate_submission.py" VALIDATE=false CREATE_ISSUE=false PROJECT_NAME="" +PREFER_LIVE_FORM=true +REQUIRE_LIVE_FORM=false while [[ $# -gt 0 ]]; do case "${1}" in --validate) VALIDATE=true + REQUIRE_LIVE_FORM=true ;; --create-issue) CREATE_ISSUE=true VALIDATE=true + REQUIRE_LIVE_FORM=true ;; --project-name) PROJECT_NAME="${2:-}" shift ;; + --offline) + PREFER_LIVE_FORM=false + REQUIRE_LIVE_FORM=false + ;; -h|--help) - sed -n '2,14p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//' + sed -n '2,16p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//' exit 0 ;; *) @@ -60,7 +72,27 @@ if [[ ! -f "${FORM_FILE}" || ! -f "${ANSWERS_FILE}" || ! -f "${GENERATOR}" ]]; t exit 1 fi -export FORM_FILE ANSWERS_FILE OUTPUT_FILE VALIDATE +ensure_pyyaml() { + if python3 -c "import yaml" >/dev/null 2>&1; then + return 0 + fi + local deps="${ROOT_DIR}/.pydeps" + mkdir -p "${deps}" + echo "Installing PyYAML for live CNCF form check..." + pip3 install --target "${deps}" -q -r "${ROOT_DIR}/requirements-dev.txt" + export PYTHONPATH="${deps}${PYTHONPATH:+:${PYTHONPATH}}" + if ! python3 -c "import yaml" >/dev/null 2>&1; then + echo "Error: could not import PyYAML after install." >&2 + exit 1 + fi +} + +if [[ "${PREFER_LIVE_FORM}" == true || "${REQUIRE_LIVE_FORM}" == true ]]; then + ensure_pyyaml +fi + +export FORM_FILE ANSWERS_FILE OUTPUT_FILE FORM_META_FILE VALIDATE ROOT_DIR +export PREFER_LIVE_FORM REQUIRE_LIVE_FORM python3 "${GENERATOR}" if [[ "${CREATE_ISSUE}" == true ]]; then @@ -79,9 +111,13 @@ if [[ "${CREATE_ISSUE}" == true ]]; then echo "Error: --project-name is required with --create-issue (or run bootstrap-issues.sh first)." >&2 exit 1 fi + if [[ ! -f "${FORM_META_FILE}" ]]; then + echo "Error: missing ${FORM_META_FILE} from form generation." >&2 + exit 1 + fi - title_prefix="$(jq -r '.title_prefix' "${FORM_FILE}")" - labels="$(jq -r '.issue_labels | join(",")' "${FORM_FILE}")" + title_prefix="$(jq -r '.title_prefix' "${FORM_META_FILE}")" + labels="$(jq -r '.issue_labels | join(",")' "${FORM_META_FILE}")" echo "Creating CNCF sandbox application issue..." issue_url="$(gh issue create \ -R cncf/sandbox \ diff --git a/scripts/generate_submission.py b/scripts/generate_submission.py index c95cf01..f9cf0c9 100755 --- a/scripts/generate_submission.py +++ b/scripts/generate_submission.py @@ -1,13 +1,18 @@ #!/usr/bin/env python3 -"""Generate CNCF-SUBMISSION.md from APPLICATION.md.""" +"""Generate CNCF-SUBMISSION.md from APPLICATION.md. + +By default prefers the live CNCF sandbox application.yml so submission matches +the current official form. Applicants do not need to sync their worksheet. +""" + +from __future__ import annotations import json import os import re import sys from pathlib import Path -from typing import Dict, List - +from typing import Dict, List, Optional, Tuple CHECKLIST_LINE = re.compile(r"^- \[[ xX]\].*.*$") FIELD_GUIDE = re.compile( @@ -15,8 +20,6 @@ re.DOTALL, ) YOUR_ANSWER = re.compile(r"^\*\*Your answer:\*\*.*\n*", re.MULTILINE) - - TRACKING_SUFFIX = re.compile(r" \((Issue|PR):.*\)\s*$") @@ -33,16 +36,7 @@ def strip_template_lines(body: str) -> str: return "\n".join(lines).strip() -def strip_checklist_lines(body: str) -> str: - lines = [ - line - for line in body.splitlines() - if not CHECKLIST_LINE.match(line.strip()) - ] - return "\n".join(lines).strip() - - -def parse_answers(text: str) -> Dict[str, str]: +def parse_raw_sections(text: str) -> Dict[str, str]: sections: Dict[str, List[str]] = {} current = None for line in text.splitlines(): @@ -53,9 +47,13 @@ def parse_answers(text: str) -> Dict[str, str]: continue if current is not None: sections[current].append(line) + return {field_id: "\n".join(lines) for field_id, lines in sections.items()} + + +def parse_answers(text: str) -> Dict[str, str]: return { - field_id: strip_template_lines("\n".join(lines)) - for field_id, lines in sections.items() + field_id: strip_template_lines(body) + for field_id, body in parse_raw_sections(text).items() } @@ -83,16 +81,77 @@ def is_empty(value: str) -> bool: ) -def main() -> int: - form_file = Path(os.environ["FORM_FILE"]) - answers_file = Path(os.environ["ANSWERS_FILE"]) - output_file = Path(os.environ["OUTPUT_FILE"]) - validate = os.environ.get("VALIDATE", "false") == "true" +def load_form( + root: Path, + local_form_path: Path, + prefer_live: bool, + require_live: bool, +) -> Tuple[dict, Optional[str]]: + """Return (form, status_message).""" + local_form = json.loads(local_form_path.read_text(encoding="utf-8")) + if not prefer_live and not require_live: + return local_form, None + + scripts = str(root / "scripts") + if scripts not in sys.path: + sys.path.insert(0, scripts) + + try: + from sync_cncf_form import DEFAULT_URL, fetch_compiled_form + except ImportError as exc: + if require_live: + print( + "Error: could not load live CNCF form helper " + f"({exc}). Install deps with: pip install -r requirements-dev.txt", + file=sys.stderr, + ) + raise SystemExit(1) + return local_form, "Using local form snapshot (live form helper unavailable)." + + try: + compiled, unmatched, diff = fetch_compiled_form(root, DEFAULT_URL) + except Exception as exc: # noqa: BLE001 + if require_live: + print( + "Error: could not fetch the live CNCF application form.\n" + f" {exc}\n" + "Check your network connection and re-run.", + file=sys.stderr, + ) + raise SystemExit(1) + return local_form, f"Using local form snapshot (live fetch failed: {exc})." + + if unmatched: + print( + "Error: the live CNCF form has fields this repository does not recognize yet:", + file=sys.stderr, + ) + for item in unmatched: + print(f" - {item}", file=sys.stderr) + print( + "\nAdd a mapping in scripts/cncf_field_aliases.json, or pull the latest " + "template updates, then re-run.", + file=sys.stderr, + ) + raise SystemExit(1) + + added = diff.get("added") or [] + notice_parts = ["Using live CNCF application form."] + if added: + notice_parts.append( + "New upstream fields: " + ", ".join(added) + "." + ) + return compiled, " ".join(notice_parts) - form = json.loads(form_file.read_text()) - answers = parse_answers(answers_file.read_text()) +def render_submission( + form: dict, + answers: Dict[str, str], + raw_sections: Dict[str, str], + validate: bool, +) -> Tuple[str, List[str], List[str]]: missing: List[str] = [] + unknown_required: List[str] = [] out: List[str] = [ "# Sandbox Application form", "", @@ -115,30 +174,85 @@ def main() -> int: label = field["label"] value = answers.get(field_id, "").strip() field_type = field.get("type", "text") + in_application = field_id in raw_sections - if field.get("required") and is_empty(value): + if field.get("required") and field_type != "checkbox" and is_empty(value): missing.append(field_id) + if not in_application: + unknown_required.append(field_id) out.append(f"### {label}") out.append("") if field_type == "checkbox": - if is_checkbox_checked(value): - out.append(f"- [x] {label}") + box_label = field.get("option_label") or label + raw_value = raw_sections.get(field_id, value) + if is_checkbox_checked(raw_value) or is_checkbox_checked(value): + out.append(f"- [x] {box_label}") else: - out.append(f"- [ ] {label}") + out.append(f"- [ ] {box_label}") if validate and field.get("required"): missing.append(field_id) + if not in_application: + unknown_required.append(field_id) else: out.append(value if value else "_Not provided_") out.append("") - output_file.write_text("\n".join(out).rstrip() + "\n") + return "\n".join(out).rstrip() + "\n", missing, unknown_required + + +def main() -> int: + form_file = Path(os.environ["FORM_FILE"]) + answers_file = Path(os.environ["ANSWERS_FILE"]) + output_file = Path(os.environ["OUTPUT_FILE"]) + meta_file = Path( + os.environ.get("FORM_META_FILE", str(output_file) + ".meta.json") + ) + validate = os.environ.get("VALIDATE", "false") == "true" + prefer_live = os.environ.get("PREFER_LIVE_FORM", "true") == "true" + require_live = os.environ.get("REQUIRE_LIVE_FORM", "false") == "true" + root = Path(os.environ.get("ROOT_DIR", form_file.resolve().parent.parent)) + + form, notice = load_form(root, form_file, prefer_live, require_live) + if notice: + print(notice, file=sys.stderr, flush=True) + + raw_answers = answers_file.read_text(encoding="utf-8") + answers = parse_answers(raw_answers) + raw_sections = parse_raw_sections(raw_answers) + + body, missing, unknown_required = render_submission( + form, answers, raw_sections, validate + ) + output_file.write_text(body, encoding="utf-8") + meta_file.write_text( + json.dumps( + { + "title_prefix": form.get("title_prefix", "[Sandbox]"), + "issue_labels": form.get("issue_labels", ["New"]), + }, + indent=2, + ) + + "\n", + encoding="utf-8", + ) if validate and missing: unique_missing = sorted(set(missing)) - print("Error: required fields are missing or still contain placeholders:", file=sys.stderr) + unique_unknown = sorted(set(unknown_required)) + print( + "Error: required fields are missing or still contain placeholders:", + file=sys.stderr, + ) for field_id in unique_missing: - print(f" - {field_id} (see APPLICATION.md)", file=sys.stderr) + if field_id in unique_unknown: + print( + f" - {field_id} — new on the live CNCF form; " + f"add a `## {field_id}` section in APPLICATION.md and fill it in", + file=sys.stderr, + ) + else: + print(f" - {field_id} (see APPLICATION.md)", file=sys.stderr) return 1 print(f"Wrote {output_file}") diff --git a/scripts/merge_application.py b/scripts/merge_application.py new file mode 100644 index 0000000..89947f9 --- /dev/null +++ b/scripts/merge_application.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python3 +"""Rewrite APPLICATION.md from the current form while preserving answers.""" + +from __future__ import annotations + +import json +import re +import sys +from pathlib import Path +from typing import Dict, List, Optional, Tuple + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from checklist_tracking import ( # noqa: E402 + CHECKLIST_LINE, + CHECKLIST_SLUG, + TRACKING_SUFFIX, + issue_token_placeholder, +) +from generate_submission import FIELD_GUIDE, is_empty # noqa: E402 +from render_application_template import render # noqa: E402 +from sync_readme_from_application import main as sync_readme # noqa: E402 +from update_checklist_progress import main as update_progress # noqa: E402 + +HEADING = re.compile(r"^## ([a-z0-9_]+)\s*$") + + +def parse_sections(text: str) -> Dict[str, str]: + sections: Dict[str, List[str]] = {} + current: Optional[str] = None + for line in text.splitlines(): + match = HEADING.match(line) + if match: + current = match.group(1) + sections[current] = [] + continue + if current is not None: + sections[current].append(line) + return {key: "\n".join(lines) for key, lines in sections.items()} + + +def extract_checklist_state(body: str) -> Dict[str, Tuple[bool, str]]: + state: Dict[str, Tuple[bool, str]] = {} + for line in body.splitlines(): + if not CHECKLIST_LINE.match(line.strip()): + continue + slug_match = CHECKLIST_SLUG.search(line) + if not slug_match: + continue + slug = slug_match.group(1) + checked = bool(re.match(r"^- \[[xX]\]", line.strip())) + tracking_match = TRACKING_SUFFIX.search(line) + tracking = tracking_match.group(0).strip() if tracking_match else "" + state[slug] = (checked, tracking) + return state + + +def extract_answer(body: str) -> str: + body = FIELD_GUIDE.sub("", body) + lines: List[str] = [] + for line in body.splitlines(): + if CHECKLIST_LINE.match(line.strip()) or "": + while idx < len(lines): + prefix.append(lines[idx]) + if lines[idx].strip() == "": + idx += 1 + break + idx += 1 + while idx < len(lines) and lines[idx].strip() == "": + prefix.append(lines[idx]) + idx += 1 + while idx < len(lines) and CHECKLIST_LINE.match(lines[idx]): + prefix.append(lines[idx]) + idx += 1 + while idx < len(lines) and lines[idx].strip() == "": + prefix.append(lines[idx]) + idx += 1 + + out = list(prefix) + if checkbox: + out.append("**Your answer:** (check the box above; add notes below if needed)") + out.append("") + out.append(answer) + out.append("") + else: + out.append("**Your answer:**") + out.append("") + out.append(answer) + out.append("") + return "\n".join(out).rstrip() + "\n" + + +def replace_section(text: str, field_id: str, new_body: str) -> str: + pattern = re.compile( + rf"(^## {re.escape(field_id)}\n)(.*?)(?=\n## |\Z)", + re.MULTILINE | re.DOTALL, + ) + body = new_body if new_body.endswith("\n") else new_body + "\n" + return pattern.sub(lambda match: f"{match.group(1)}{body}", text, count=1) + + +def checkbox_ids(form: Dict) -> set[str]: + return { + field["id"] + for section in form["sections"] + for field in section["fields"] + if field.get("type") == "checkbox" + } + + +def merge_application(root: Path, orphan_path: Optional[Path] = None) -> None: + application_path = root / "APPLICATION.md" + form = json.loads((root / ".github" / "cncf-form.json").read_text(encoding="utf-8")) + existing = application_path.read_text(encoding="utf-8") if application_path.is_file() else "" + sections = parse_sections(existing) + checklist_state: Dict[str, Tuple[bool, str]] = {} + answers: Dict[str, str] = {} + for field_id, body in sections.items(): + checklist_state.update(extract_checklist_state(body)) + answers[field_id] = extract_answer(body) + + keep_ids = {"read_prerequisites", "final_review"} | { + field["id"] for section in form["sections"] for field in section["fields"] + } + orphans = { + field_id: answer + for field_id, answer in answers.items() + if field_id not in keep_ids and not is_empty(answer) + } + if orphans and orphan_path is not None: + lines = ["# Orphaned APPLICATION.md answers", ""] + for field_id, answer in orphans.items(): + lines.append(f"## {field_id}") + lines.append("") + lines.append(answer) + lines.append("") + orphan_path.write_text("\n".join(lines).rstrip() + "\n", encoding="utf-8") + print(f"Wrote orphaned answers to {orphan_path}") + + rendered = render(root) + rendered = apply_checklist_state(rendered, checklist_state) + boxes = checkbox_ids(form) + for field_id in keep_ids: + if field_id not in answers: + continue + match = re.search( + rf"(^## {re.escape(field_id)}\n)(.*?)(?=\n## |\Z)", + rendered, + re.MULTILINE | re.DOTALL, + ) + if not match: + continue + new_body = inject_answer( + match.group(2), + field_id, + answers[field_id], + field_id in boxes, + ) + rendered = replace_section(rendered, field_id, new_body) + + application_path.write_text(rendered if rendered.endswith("\n") else rendered + "\n") + update_progress() + sync_readme() + + +def main() -> int: + root = Path(__file__).resolve().parent.parent + merge_application(root, root / "APPLICATION-orphaned-answers.md") + print(f"Wrote {root / 'APPLICATION.md'}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/render_application_template.py b/scripts/render_application_template.py index 9773931..ece2153 100644 --- a/scripts/render_application_template.py +++ b/scripts/render_application_template.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 """Render APPLICATION.md with checklist checkboxes (template maintenance).""" +from __future__ import annotations + import json import sys from pathlib import Path @@ -9,28 +11,41 @@ from checklist_tracking import issue_token_placeholder ROOT = Path(__file__).resolve().parent.parent -FORM = json.loads((ROOT / ".github/cncf-form.json").read_text()) -LABELS = json.loads((ROOT / "scripts/checklist_checkbox_labels.json").read_text()) -PLACEHOLDERS = json.loads((ROOT / "scripts/application_field_placeholders.json").read_text()) -GUIDES = json.loads((ROOT / "scripts/application_field_guides.json").read_text()) -# First field id per checklist slug (form field order) -SLUG_PRIMARY_FIELD: dict[str, str] = {} -for section in FORM["sections"]: - for field in section["fields"]: - for slug in field.get("checklist", []): - SLUG_PRIMARY_FIELD.setdefault(slug, field["id"]) -CHECKBOX_FIELDS = {"not_reference_architecture", "trademark_agreement", "ip_policy_agreement"} +def load_artifacts(root: Path = ROOT): + form = json.loads((root / ".github/cncf-form.json").read_text()) + labels = json.loads((root / "scripts/checklist_checkbox_labels.json").read_text()) + placeholders = json.loads((root / "scripts/application_field_placeholders.json").read_text()) + guides = json.loads((root / "scripts/application_field_guides.json").read_text()) + return form, labels, placeholders, guides + + +def slug_primary_field(form: dict) -> dict[str, str]: + primary: dict[str, str] = {} + for section in form["sections"]: + for field in section["fields"]: + for slug in field.get("checklist", []): + primary.setdefault(slug, field["id"]) + return primary + +def checkbox_field_ids(form: dict) -> set[str]: + return { + field["id"] + for section in form["sections"] + for field in section["fields"] + if field.get("type") == "checkbox" + } -def checklist_line(slug: str) -> str: - label = LABELS[slug] + +def checklist_line(slug: str, labels: dict[str, str]) -> str: + label = labels[slug] return f"- [ ] {label} {issue_token_placeholder(slug)}" -def emit_guide(lines: list[str], field_id: str) -> None: - guide = GUIDES.get(field_id, "").strip() +def emit_guide(lines: list[str], field_id: str, guides: dict[str, str]) -> None: + guide = guides.get(field_id, "").strip() if not guide: return lines.append("") @@ -39,7 +54,18 @@ def emit_guide(lines: list[str], field_id: str) -> None: lines.append("") -def render() -> str: +def form_option_label(form: dict, field_id: str) -> str: + for section in form["sections"]: + for field in section["fields"]: + if field["id"] == field_id: + return field.get("option_label") or field.get("label") or field_id + return field_id + + +def render(root: Path = ROOT) -> str: + form, labels, placeholders, guides = load_artifacts(root) + primary = slug_primary_field(form) + checkboxes = checkbox_field_ids(form) lines = [ "# CNCF Sandbox Application", "", @@ -62,17 +88,17 @@ def add_section(field_id: str, slug: str | None = None) -> None: lines.append("") show_slug = slug and slug not in emitted_slugs if show_slug: - emit_guide(lines, field_id) - if field_id in CHECKBOX_FIELDS: - text = PLACEHOLDERS[field_id] + emit_guide(lines, field_id, guides) + if field_id in checkboxes: + text = placeholders.get(field_id) or form_option_label(form, field_id) lines.append( f"- [ ] {text} {issue_token_placeholder(slug)}" ) else: - lines.append(checklist_line(slug)) + lines.append(checklist_line(slug, labels)) lines.append("") emitted_slugs.add(slug) - if field_id in CHECKBOX_FIELDS: + if field_id in checkboxes: if show_slug: lines.append( "**Your answer:** (check the box above; add notes below if needed)" @@ -82,7 +108,7 @@ def add_section(field_id: str, slug: str | None = None) -> None: lines.append("") return - body = PLACEHOLDERS.get(field_id, "") + body = placeholders.get(field_id, "") if not body: return if show_slug and body.startswith("_"): @@ -93,11 +119,11 @@ def add_section(field_id: str, slug: str | None = None) -> None: add_section("read_prerequisites", "read-prerequisites") - for section in FORM["sections"]: + for section in form["sections"]: for field in section["fields"]: field_id = field["id"] slugs = field.get("checklist", []) - slug = slugs[0] if slugs and SLUG_PRIMARY_FIELD.get(slugs[0]) == field_id else None + slug = slugs[0] if slugs and primary.get(slugs[0]) == field_id else None add_section(field_id, slug) add_section("final_review", "final-review") @@ -108,3 +134,8 @@ def add_section(field_id: str, slug: str | None = None) -> None: out = ROOT / "APPLICATION.md" out.write_text(render()) print(f"Wrote {out}") + print( + "Warning: this overwrites APPLICATION.md. Prefer " + "`./scripts/sync-cncf-form.sh --write --merge-application`.", + file=sys.stderr, + ) diff --git a/scripts/sync-cncf-form.sh b/scripts/sync-cncf-form.sh new file mode 100755 index 0000000..c2d2bd9 --- /dev/null +++ b/scripts/sync-cncf-form.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Sync local CNCF form artifacts from cncf/sandbox application.yml. +# +# Prerequisites: +# - python3 +# - PyYAML (pip install -r requirements-dev.txt) +# +# Usage: +# ./scripts/sync-cncf-form.sh --report +# ./scripts/sync-cncf-form.sh --check +# ./scripts/sync-cncf-form.sh --write --merge-application +# ./scripts/sync-cncf-form.sh --write --merge-application --ref main + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +SYNC="${ROOT_DIR}/scripts/sync_cncf_form.py" + +if ! command -v python3 >/dev/null 2>&1; then + echo "Error: python3 is required." >&2 + exit 1 +fi + +if ! python3 -c "import yaml" >/dev/null 2>&1; then + echo "Error: PyYAML is required. Install with: pip install -r requirements-dev.txt" >&2 + exit 1 +fi + +exec python3 "${SYNC}" "$@" diff --git a/scripts/sync_cncf_form.py b/scripts/sync_cncf_form.py new file mode 100644 index 0000000..227c10e --- /dev/null +++ b/scripts/sync_cncf_form.py @@ -0,0 +1,564 @@ +#!/usr/bin/env python3 +"""Fetch the live CNCF sandbox application.yml and compile local form artifacts.""" + +from __future__ import annotations + +import argparse +import json +import re +import sys +import urllib.request +from datetime import date +from pathlib import Path +from typing import Any, Dict, Iterable, List, Optional, Tuple + +try: + import yaml +except ImportError: # pragma: no cover + print( + "Error: PyYAML is required. Install with: pip install -r requirements-dev.txt", + file=sys.stderr, + ) + raise SystemExit(1) + +ROOT = Path(__file__).resolve().parent.parent +DEFAULT_REF = "main" +DEFAULT_URL = ( + "https://raw.githubusercontent.com/cncf/sandbox/" + f"{DEFAULT_REF}/.github/ISSUE_TEMPLATE/application.yml" +) + +LOCAL_ONLY_SLUGS = ("read-prerequisites", "final-review") +SKIP_SECTION_HEADINGS = ( + "pre-submission checklist", + "✅ pre-submission checklist", +) + +PHASE_BY_HEADING = { + "basic project information": "phase:basic-info", + "project details": "phase:project-details", + "cloud native context": "phase:cloud-native", + "cncf policies": "phase:cncf-policies", + "contact information": "phase:contact", + "additional information": "phase:contact", +} + +HEADING_RE = re.compile(r"^##\s+(.+?)\s*$", re.MULTILINE) +EMOJI_PREFIX_RE = re.compile(r"^[\W_]+", re.UNICODE) + + +def dump_json(path: Path, data: Any) -> None: + path.write_text(json.dumps(data, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + + +def load_json(path: Path) -> Any: + return json.loads(path.read_text(encoding="utf-8")) + + +def fetch_text(url: str) -> str: + request = urllib.request.Request(url, headers={"User-Agent": "cncf-sandbox-application-sync"}) + with urllib.request.urlopen(request) as response: + return response.read().decode("utf-8") + + +def title_prefix(title: str) -> str: + cleaned = title.replace("", "").strip() + return cleaned.rstrip() + + +def heading_key(heading: str) -> str: + text = heading.strip() + text = re.sub(r"^:[a-z0-9_+-]+:\s*", "", text) + text = EMOJI_PREFIX_RE.sub("", text) + return text.strip().lower() + + +def parse_section_markdown(value: str) -> Optional[Tuple[str, str]]: + match = HEADING_RE.search(value) + if not match: + return None + heading = match.group(1).strip() + if heading_key(heading) in SKIP_SECTION_HEADINGS: + return None + after = value[match.end() :].strip() + after = re.sub(r"", "", after, flags=re.IGNORECASE).strip() + intro = after.split("\n\n")[0].strip() if after else "" + intro = " ".join(intro.split()) + return f"## {heading}", intro + + +def field_ids_from_form(form: Dict[str, Any]) -> List[str]: + ids: List[str] = [] + for section in form.get("sections", []): + for field in section.get("fields", []): + ids.append(field["id"]) + return ids + + +def fields_by_id(form: Dict[str, Any]) -> Dict[str, Dict[str, Any]]: + out: Dict[str, Dict[str, Any]] = {} + for section in form.get("sections", []): + for field in section.get("fields", []): + out[field["id"]] = field + return out + + +def checklist_slugs_from_form(form: Dict[str, Any]) -> List[str]: + slugs: List[str] = [] + seen: set[str] = set() + for section in form.get("sections", []): + for field in section.get("fields", []): + for slug in field.get("checklist", []): + if slug not in seen: + slugs.append(slug) + seen.add(slug) + return slugs + + +def id_to_slug(field_id: str) -> str: + return field_id.replace("_", "-") + + +def resolve_field_id( + item: Dict[str, Any], + aliases: Dict[str, Any], +) -> Optional[str]: + by_id = aliases.get("by_id") or {} + by_label = aliases.get("by_label") or {} + upstream_id = item.get("id") + if upstream_id and upstream_id in by_id: + return by_id[upstream_id] + attrs = item.get("attributes") or {} + label = (attrs.get("label") or "").strip() + if label in by_label: + return by_label[label] + if item.get("type") == "checkboxes": + options = attrs.get("options") or [] + if options: + option_label = (options[0].get("label") or "").strip() + if option_label in by_label: + return by_label[option_label] + return None + + +def map_field_type(item_type: str) -> str: + if item_type == "input": + return "text" + if item_type == "textarea": + return "textarea" + if item_type == "checkboxes": + return "checkbox" + return item_type + + +def field_required(item: Dict[str, Any]) -> bool: + validations = item.get("validations") or {} + if validations.get("required"): + return True + if item.get("type") == "checkboxes": + options = (item.get("attributes") or {}).get("options") or [] + return any(opt.get("required") for opt in options) + return False + + +def seed_placeholder(item: Dict[str, Any]) -> str: + attrs = item.get("attributes") or {} + if item.get("type") == "checkboxes": + options = attrs.get("options") or [] + if options: + return (options[0].get("label") or "").strip() + return (attrs.get("label") or "").strip() + placeholder = (attrs.get("placeholder") or "").strip() + if placeholder: + return f"_{placeholder}_" + description = (attrs.get("description") or "").strip() + if description: + first = description.splitlines()[0].strip() + return f"_{first}_" + return "_Not provided._" + + +def seed_guide(item: Dict[str, Any]) -> str: + attrs = item.get("attributes") or {} + description = attrs.get("description") + if not description: + return "" + return str(description).strip() + + +def compile_form( + template: Dict[str, Any], + aliases: Dict[str, Any], + previous: Dict[str, Any], +) -> Tuple[Dict[str, Any], List[str], Dict[str, Dict[str, Any]]]: + previous_fields = fields_by_id(previous) + unmatched: List[str] = [] + compiled_meta: Dict[str, Dict[str, Any]] = {} + sections: List[Dict[str, Any]] = [] + current: Optional[Dict[str, Any]] = None + + labels = template.get("labels") or ["New"] + if isinstance(labels, str): + labels = [labels] + + form: Dict[str, Any] = { + "title_prefix": title_prefix(template.get("title") or "[Sandbox]"), + "issue_labels": labels, + "sections": sections, + } + + for item in template.get("body") or []: + item_type = item.get("type") + if item_type == "markdown": + parsed = parse_section_markdown((item.get("attributes") or {}).get("value") or "") + if parsed: + heading, intro = parsed + current = {"heading": heading} + if intro: + current["intro"] = intro + current["fields"] = [] + sections.append(current) + continue + if item_type not in {"input", "textarea", "checkboxes"}: + continue + if current is None: + current = {"heading": "## Application", "fields": []} + sections.append(current) + + field_id = resolve_field_id(item, aliases) + attrs = item.get("attributes") or {} + label = (attrs.get("label") or "").strip() + if not field_id: + unmatched.append(f"{item.get('id') or '(no id)'}: {label or item_type}") + continue + + previous_field = previous_fields.get(field_id, {}) + checklist = list(previous_field.get("checklist") or [id_to_slug(field_id)]) + field: Dict[str, Any] = { + "id": field_id, + "label": label, + "type": map_field_type(item_type), + "required": field_required(item), + "checklist": checklist, + } + if item_type == "checkboxes": + options = attrs.get("options") or [] + if options: + field["option_label"] = (options[0].get("label") or "").strip() + current["fields"].append(field) + compiled_meta[field_id] = { + "placeholder": seed_placeholder(item), + "guide": seed_guide(item), + "label": label, + "heading": current["heading"], + "checklist": checklist, + } + + form["sections"] = [section for section in sections if section.get("fields")] + return form, unmatched, compiled_meta + + +def diff_forms(previous: Dict[str, Any], compiled: Dict[str, Any]) -> Dict[str, List[str]]: + old = fields_by_id(previous) + new = fields_by_id(compiled) + added = sorted(set(new) - set(old)) + removed = sorted(set(old) - set(new)) + renamed: List[str] = [] + required_changed: List[str] = [] + for field_id in sorted(set(old) & set(new)): + if old[field_id].get("label") != new[field_id].get("label"): + renamed.append( + f"{field_id}: {old[field_id].get('label')!r} -> {new[field_id].get('label')!r}" + ) + if bool(old[field_id].get("required")) != bool(new[field_id].get("required")): + required_changed.append( + f"{field_id}: required {old[field_id].get('required')} -> {new[field_id].get('required')}" + ) + return { + "added": added, + "removed": removed, + "renamed": renamed, + "required_changed": required_changed, + } + + +def format_report(diff: Dict[str, List[str]], stale_slugs: Iterable[str] = ()) -> str: + lines = ["CNCF application form sync report", ""] + for key, title in ( + ("added", "Added fields"), + ("removed", "Removed fields"), + ("renamed", "Renamed labels"), + ("required_changed", "Required-flag changes"), + ): + items = diff.get(key) or [] + lines.append(f"## {title}") + if items: + lines.extend(f"- {item}" for item in items) + else: + lines.append("- (none)") + lines.append("") + stale = list(stale_slugs) + lines.append("## Stale checklist slugs (existing GitHub issues are not updated)") + if stale: + lines.extend(f"- {slug}" for slug in stale) + else: + lines.append("- (none)") + lines.append("") + return "\n".join(lines) + + +def upsert_placeholders( + path: Path, + compiled_ids: List[str], + meta: Dict[str, Dict[str, Any]], + local_field_ids: Iterable[str], +) -> None: + data = load_json(path) + keep = set(compiled_ids) | set(local_field_ids) + for field_id in list(data): + if field_id not in keep: + del data[field_id] + for field_id in compiled_ids: + if field_id not in data: + data[field_id] = meta[field_id]["placeholder"] + ordered: Dict[str, str] = {} + if "read_prerequisites" in data: + ordered["read_prerequisites"] = data["read_prerequisites"] + for field_id in compiled_ids: + if field_id in data: + ordered[field_id] = data[field_id] + if "final_review" in data: + ordered["final_review"] = data["final_review"] + dump_json(path, ordered) + + +def upsert_guides( + path: Path, + compiled_ids: List[str], + meta: Dict[str, Dict[str, Any]], + local_field_ids: Iterable[str], + force: bool, +) -> None: + data = load_json(path) + keep = set(compiled_ids) | set(local_field_ids) + for field_id in list(data): + if field_id not in keep: + del data[field_id] + for field_id in compiled_ids: + guide = meta[field_id].get("guide") or "" + if not guide: + continue + if field_id not in data or force: + data[field_id] = guide + dump_json(path, data) + + +def phase_for_heading(heading: str) -> str: + key = heading_key(heading.replace("## ", "")) + return PHASE_BY_HEADING.get(key, "phase:prepare") + + +def stub_map_entry(slug: str, field_id: str, label: str, heading: str) -> Dict[str, Any]: + return { + "title": f"[Application] {label}", + "labels": ["checklist-item", f"checklist:{slug}", phase_for_heading(heading)], + "template": "checklist-item.md", + "body": ( + f"Update `{field_id}` in [APPLICATION.md](../APPLICATION.md).\n\n" + "When complete, open a PR with `Closes #ISSUE_NUMBER`." + ), + } + + +def upsert_checklist_artifacts( + labels_path: Path, + map_path: Path, + form: Dict[str, Any], + meta: Dict[str, Dict[str, Any]], + force_map_bodies: bool, +) -> List[str]: + labels = load_json(labels_path) + checklist_map = load_json(map_path) + form_slugs = checklist_slugs_from_form(form) + keep_slugs = list(LOCAL_ONLY_SLUGS[:1]) + form_slugs + list(LOCAL_ONLY_SLUGS[1:]) + + slug_primary: Dict[str, str] = {} + for section in form["sections"]: + for field in section["fields"]: + for slug in field.get("checklist", []): + slug_primary.setdefault(slug, field["id"]) + + stale = sorted(set(checklist_map) - set(keep_slugs)) + new_map: Dict[str, Any] = {} + new_labels: Dict[str, str] = {} + for slug in keep_slugs: + if slug in checklist_map and not force_map_bodies: + new_map[slug] = checklist_map[slug] + elif slug in checklist_map and force_map_bodies and slug in LOCAL_ONLY_SLUGS: + new_map[slug] = checklist_map[slug] + elif slug in LOCAL_ONLY_SLUGS and slug in checklist_map: + new_map[slug] = checklist_map[slug] + else: + field_id = slug_primary.get(slug, slug.replace("-", "_")) + info = meta.get(field_id, {}) + new_map[slug] = stub_map_entry( + slug, + field_id, + info.get("label") or field_id.replace("_", " "), + info.get("heading") or "## Application", + ) + if slug in labels: + new_labels[slug] = labels[slug] + else: + field_id = slug_primary.get(slug, slug.replace("-", "_")) + info = meta.get(field_id, {}) + new_labels[slug] = info.get("label") or slug.replace("-", " ").capitalize() + + dump_json(map_path, new_map) + dump_json(labels_path, new_labels) + return stale + + +def canonical(data: Any) -> str: + return json.dumps(data, indent=2, ensure_ascii=False, sort_keys=True) + "\n" + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser( + description="Sync local CNCF form snapshot from cncf/sandbox application.yml" + ) + parser.add_argument("--url", help="Override application.yml URL") + parser.add_argument( + "--ref", + default=DEFAULT_REF, + help="cncf/sandbox git ref (default: main). Ignored if --url is set.", + ) + parser.add_argument("--check", action="store_true", help="Exit 1 if committed form differs") + parser.add_argument("--write", action="store_true", help="Write compiled artifacts") + parser.add_argument("--report", action="store_true", help="Print a field-change report") + parser.add_argument( + "--merge-application", + action="store_true", + help="Rewrite APPLICATION.md while preserving answers", + ) + parser.add_argument("--force-guides", action="store_true") + parser.add_argument("--force-map-bodies", action="store_true") + return parser.parse_args() + + +def template_url(args: argparse.Namespace) -> str: + if args.url: + return args.url + if args.ref != DEFAULT_REF: + return ( + "https://raw.githubusercontent.com/cncf/sandbox/" + f"{args.ref}/.github/ISSUE_TEMPLATE/application.yml" + ) + return DEFAULT_URL + + +def fetch_compiled_form( + root: Path = ROOT, + url: str = DEFAULT_URL, +) -> Tuple[Dict[str, Any], List[str], Dict[str, List[str]]]: + """Fetch and compile the live CNCF form against local aliases/snapshot. + + Returns (compiled_form, unmatched_field_descriptions, diff_vs_local). + """ + form_path = root / ".github" / "cncf-form.json" + aliases = load_json(root / "scripts" / "cncf_field_aliases.json") + previous = load_json(form_path) if form_path.is_file() else {"sections": []} + raw = fetch_text(url) + template = yaml.safe_load(raw) + compiled, unmatched, _meta = compile_form(template, aliases, previous) + return compiled, unmatched, diff_forms(previous, compiled) + + +def main() -> int: + args = parse_args() + if not (args.check or args.write or args.report or args.merge_application): + args.report = True + + form_path = ROOT / ".github" / "cncf-form.json" + aliases = load_json(ROOT / "scripts" / "cncf_field_aliases.json") + previous = load_json(form_path) if form_path.is_file() else {"sections": []} + + url = template_url(args) + try: + raw = fetch_text(url) + except Exception as exc: # noqa: BLE001 + print(f"Error: failed to fetch {url}: {exc}", file=sys.stderr) + return 1 + + template = yaml.safe_load(raw) + compiled, unmatched, meta = compile_form(template, aliases, previous) + if unmatched: + print("Error: unmatched CNCF form fields. Add aliases in scripts/cncf_field_aliases.json:", file=sys.stderr) + for item in unmatched: + print(f" - {item}", file=sys.stderr) + return 1 + + diff = diff_forms(previous, compiled) + stale_preview: List[str] = [] + previous_slugs = set() + if (ROOT / ".github" / "checklist-map.json").is_file(): + previous_slugs = set(load_json(ROOT / ".github" / "checklist-map.json")) + keep_slugs = set(LOCAL_ONLY_SLUGS) | set(checklist_slugs_from_form(compiled)) + stale_preview = sorted(previous_slugs - keep_slugs) + report = format_report(diff, stale_preview) + + if args.report or args.check or args.write: + print(report) + + form_changed = canonical(previous) != canonical(compiled) + if args.check and not args.write: + if form_changed: + print("Committed .github/cncf-form.json is out of date with upstream.", file=sys.stderr) + return 1 + print("cncf-form.json matches upstream.") + return 0 + + if args.write: + dump_json(form_path, compiled) + compiled_ids = field_ids_from_form(compiled) + upsert_placeholders( + ROOT / "scripts" / "application_field_placeholders.json", + compiled_ids, + meta, + ("read_prerequisites", "final_review"), + ) + upsert_guides( + ROOT / "scripts" / "application_field_guides.json", + compiled_ids, + meta, + ("read_prerequisites", "final_review"), + args.force_guides, + ) + stale = upsert_checklist_artifacts( + ROOT / "scripts" / "checklist_checkbox_labels.json", + ROOT / ".github" / "checklist-map.json", + compiled, + meta, + args.force_map_bodies, + ) + print(f"Wrote {form_path}") + if stale: + print("Removed checklist slugs (close or retitle related issues manually):") + for slug in stale: + print(f" - {slug}") + + if args.merge_application: + sys.path.insert(0, str(ROOT / "scripts")) + from merge_application import merge_application + + orphan_path = ROOT / f"APPLICATION-orphaned-answers-{date.today().isoformat()}.md" + merge_application(ROOT, orphan_path) + print(f"Merged APPLICATION.md") + + if args.check and args.write: + return 0 + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())