From 37a3cfa0e14404a356e29920688a441a61da4203 Mon Sep 17 00:00:00 2001 From: Ethan Rose <33912936+errose28@users.noreply.github.com> Date: Thu, 7 Mar 2024 11:54:04 -0800 Subject: [PATCH 1/3] HDDS-9866. Add GitHub Actions checks for consistent Docusaurus formatting. (#84) See: - https://docusaurus.io/docs/markdown-features#front-matter - https://ajv.js.org/guide/getting-started.html#basic-data-validation --- .github/resource/category.schema.json | 17 ++++++ .github/resource/frontmatter.schema.json | 23 ++++++++ .github/scripts/sidebar.sh | 48 +++++++++++++++ .github/workflows/static.yml | 19 ++++++ CONTRIBUTING.md | 6 +- cspell.yaml | 1 - .../02-data-operations/04-hsync.md | 4 +- .../07-features/05-ratis-streaming.md | 4 +- docusaurus.config.js | 27 +++++++++ package.json | 4 +- pnpm-lock.yaml | 58 +++++++++++++------ 11 files changed, 185 insertions(+), 26 deletions(-) create mode 100644 .github/resource/category.schema.json create mode 100644 .github/resource/frontmatter.schema.json create mode 100755 .github/scripts/sidebar.sh diff --git a/.github/resource/category.schema.json b/.github/resource/category.schema.json new file mode 100644 index 000000000..afa67b906 --- /dev/null +++ b/.github/resource/category.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://ozone.apache.org/category.schema.json", + "title": "Category", + "description": "Validates an allowed subset of keys in Docusaurus _category_.yml files.", + "type": "object", + "properties": { + "label": { + "description": "The name of this section shown in the docs sidebar.", + "type": "string" + } + }, + "required": [ + "label" + ], + "additionalProperties": false +} diff --git a/.github/resource/frontmatter.schema.json b/.github/resource/frontmatter.schema.json new file mode 100644 index 000000000..b6955c08c --- /dev/null +++ b/.github/resource/frontmatter.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://ozone.apache.org/frontmatter.schema.json", + "title": "Frontmatter", + "description": "Validates an allowed subset of Docusaurus docs frontmatter.", + "type": [ "object", "null" ], + "properties": { + "sidebar_label": { + "type": "string" + }, + "slug": { + "description": "Only use slug to specify the base URL for documentation.", + "type": "string", + "enum": [ "/" ] + }, + "draft": { + "description": "Makes pages for incomplete features only visible in development mode.", + "type": "boolean" + } + }, + "additionalProperties": false +} + diff --git a/.github/scripts/sidebar.sh b/.github/scripts/sidebar.sh new file mode 100755 index 000000000..6b270946d --- /dev/null +++ b/.github/scripts/sidebar.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Validates docusaurus _category_.yml files used to configure the docs sidebar. +# Each docs subdirectory should have a _category_.yml file, and it must follow the defined schema. +# The schema is more restrictive than what Docusaurus allows, and can be used to disallow keys or require all category +# files to define the same keys. + +rc=0 + +root="$(git rev-parse --show-toplevel)" +schema="$root"/.github/resource/category.schema.json + +# Make sure all docs directories have a category sidebar file. +for child in $(find "$root"/docs/*); do + if [ -d "$child" ]; then + category_file="$child/_category_.yml" + if [ ! -f "$category_file" ]; then + echo "_category_.yml is required for docs subdirectory $child" 1>&2 + rc=1 + fi + fi +done + +[ "$rc" = 0 ] || exit $rc + +# If all category files are present, make sure they follow the schema. +if ! pnpm ajv validate -s "$schema" -d "$root/docs/**/_category_.yml" 1>/dev/null; then + rc=1 + echo "Sidebar configuration validation failed against JSON schema $schema" 1>&2 +fi + +exit "$rc" diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 7cc1e834b..5f972c71c 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -83,3 +83,22 @@ jobs: working-directory: ${{ env.script_dir }} run: | ./markdownlint.sh + check-sidebar: + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v4 + - name: Enable corepack + run: | + corepack enable + - name: Use Node.js ${{ env.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.node_version }} + cache: pnpm + - name: Install pnpm dependencies + run: pnpm install --dev + - name: Run docs sidebar check + working-directory: ${{ env.script_dir }} + run: | + ./sidebar.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7211f18a5..9c2f1e2b7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,7 +100,7 @@ Docusaurus provides many options for laying out documentation pages and their me - File names and therefore generated URLs should all be `kebab-case`. -- Let Docusaurus automatically generate the page's title from its top level markdown heading instead of using `title` in the frontmatter. This is different from the sidebar label or URL slug. +- Let Docusaurus automatically generate the page's title from its top level markdown heading instead of using `title` in the front matter. This is different from the sidebar label or URL slug. - Use relative file paths for all links between pages. - This keeps page links pointing to the current version of the documentation. @@ -129,7 +129,7 @@ Docusaurus provides many options for laying out documentation pages and their me Object Store Bucket Layout ``` - - Sidebar labels are automatically generated from page titles. To use a different sidebar label, use the `sidebar_label` property in the page's frontmatter. + - Sidebar labels are automatically generated from page titles. To use a different sidebar label, use the `sidebar_label` property in the page's front matter. - Don't rely on Ozone specific acronyms in the sidebar. This makes docs navigation more beginner friendly. - For example, the pages on bucket layouts may be organized as: @@ -178,7 +178,7 @@ The file names and content of all markdown pages are checked for spelling mistak - Option 1: If the word is relevant for the whole Ozone project, add it to the `words` list in *cspell.yaml* so that it is considered valid. -- Option 2: If the word is only relevant for one specific page, add an [inline directive](https://cspell.org/configuration/document-settings/) as a comment in the markdown frontmatter of that page only. +- Option 2: If the word is only relevant for one specific page, add an [inline directive](https://cspell.org/configuration/document-settings/) as a comment in the markdown front matter of that page only. ### Updating Graphics diff --git a/cspell.yaml b/cspell.yaml index 98e176545..2d7b30c8e 100644 --- a/cspell.yaml +++ b/cspell.yaml @@ -78,7 +78,6 @@ words: - gpg - sed - mds -- frontmatter - javadoc # Misc words - acking diff --git a/docs/07-system-internals/02-data-operations/04-hsync.md b/docs/07-system-internals/02-data-operations/04-hsync.md index 0321e317c..f561324ef 100644 --- a/docs/07-system-internals/02-data-operations/04-hsync.md +++ b/docs/07-system-internals/02-data-operations/04-hsync.md @@ -1,6 +1,6 @@ --- -# Page is accessible by direct link only in production site builds. It can be included in the sidebar when the feature is complete. -unlisted: true +# Page is available only in the development server. It can be included in production builds when the feature is complete. +draft: true sidebar_label: HFlush and HSync --- diff --git a/docs/07-system-internals/07-features/05-ratis-streaming.md b/docs/07-system-internals/07-features/05-ratis-streaming.md index d789ec6c7..1c898519d 100644 --- a/docs/07-system-internals/07-features/05-ratis-streaming.md +++ b/docs/07-system-internals/07-features/05-ratis-streaming.md @@ -1,6 +1,6 @@ --- -# Page is accessible by direct link only in production site builds. It can be included in the sidebar when the feature is complete. -unlisted: true +# Page is available only in the development server. It can be included in production builds when the feature is complete. +draft: true sidebar_label: Ratis Streaming --- diff --git a/docusaurus.config.js b/docusaurus.config.js index c7b2f5e85..dd1d60630 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,6 +1,8 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion +import Ajv from 'ajv'; + const {themes} = require('prism-react-renderer'); const lightCodeTheme = themes.github; const darkCodeTheme = themes.dracula; @@ -34,6 +36,31 @@ const config = { locales: ['en'], }, + markdown: { + // Validate markdown frontmatter against a more restrictive schema than what Docusaurus allows. + // This ensures all pages are using a minimal set of consistent keys. + // It can also be used to require all pages to define certain markdown front matter keys. + parseFrontMatter: async (params) => { + // Reuse the default parser. + const result = await params.defaultParseFrontMatter(params); + + // Validate front matter against the schema. + const schemaPath = './.github/resource/frontmatter.schema.json'; + const frontMatterSchema = require(schemaPath); + const ajv = new Ajv(); + const validate = ajv.compile(frontMatterSchema); + const isValid = validate(result.frontMatter); + + if (!isValid) { + console.error('Front matter validation error in', params.filePath + ':\n', validate.errors); + console.error('Front matter validation failed against JSON schema', schemaPath); + process.exit(1); + } + + return result; + }, + }, + presets: [ [ 'classic', diff --git a/package.json b/package.json index 909eaaecd..4ecc7fb73 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "clsx": "^2.1.0", "prism-react-renderer": "^2.3.1", "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "ajv": "^8.12.0" }, "devDependencies": { "@docusaurus/module-type-aliases": "3.1.1", @@ -30,6 +31,7 @@ "@cspell/dict-java": "^5.0.6", "@cspell/dict-markdown": "^2.0.1", "@cspell/dict-shell": "^1.0.6", + "ajv-cli": "^5.0.0", "markdownlint-cli": "^0.39.0" }, "browserslist": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff3c22de8..e119b8834 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ dependencies: '@mdx-js/react': specifier: ^3.0.0 version: 3.0.0(@types/react@18.2.48)(react@18.2.0) + ajv: + specifier: ^8.12.0 + version: 8.12.0 clsx: specifier: ^2.1.0 version: 2.1.0 @@ -43,6 +46,9 @@ devDependencies: '@docusaurus/module-type-aliases': specifier: 3.1.1 version: 3.1.1(react-dom@18.2.0)(react@18.2.0) + ajv-cli: + specifier: ^5.0.0 + version: 5.0.0 cspell: specifier: ^8.2.1 version: 8.4.1 @@ -3404,6 +3410,24 @@ packages: indent-string: 4.0.0 dev: false + /ajv-cli@5.0.0: + resolution: {integrity: sha512-LY4m6dUv44HTyhV+u2z5uX4EhPYTM38Iv1jdgDJJJCyOOuqB8KtZEGjPZ2T+sh5ZIJrXUfgErYx/j3gLd3+PlQ==} + hasBin: true + peerDependencies: + ts-node: '>=9.0.0' + peerDependenciesMeta: + ts-node: + optional: true + dependencies: + ajv: 8.12.0 + fast-json-patch: 2.2.1 + glob: 7.2.3 + js-yaml: 3.14.1 + json-schema-migrate: 2.0.0 + json5: 2.2.3 + minimist: 1.2.8 + dev: true + /ajv-formats@2.1.1(ajv@8.12.0): resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} peerDependencies: @@ -3446,7 +3470,6 @@ packages: json-schema-traverse: 1.0.0 require-from-string: 2.0.2 uri-js: 4.4.1 - dev: false /algoliasearch-helper@3.16.2(algoliasearch@4.22.1): resolution: {integrity: sha512-Yl/Gu5Cq4Z5s/AJ0jR37OPI1H3+z7PHz657ibyaXgMOaWvPlZ3OACN13N+7HCLPUlB0BN+8BtmrG/CqTilowBA==} @@ -3529,7 +3552,6 @@ packages: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: sprintf-js: 1.0.3 - dev: false /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} @@ -3710,7 +3732,6 @@ packages: dependencies: balanced-match: 1.0.2 concat-map: 0.0.1 - dev: false /brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} @@ -4058,7 +4079,6 @@ packages: /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - dev: false /config-chain@1.1.13: resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} @@ -4985,6 +5005,10 @@ packages: /extend@3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} + /fast-deep-equal@2.0.1: + resolution: {integrity: sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==} + dev: true + /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -5003,6 +5027,13 @@ packages: merge2: 1.4.1 micromatch: 4.0.5 + /fast-json-patch@2.2.1: + resolution: {integrity: sha512-4j5uBaTnsYAV5ebkidvxiLUYOwjQ+JSFljeqfTxCrH9bDmlCQaOJFS84oDJ2rAXZq2yskmk3ORfoP9DCwqFNig==} + engines: {node: '>= 0.4.0'} + dependencies: + fast-deep-equal: 2.0.1 + dev: true + /fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -5232,7 +5263,6 @@ packages: /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - dev: false /fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} @@ -5320,7 +5350,6 @@ packages: minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 - dev: false /global-directory@4.0.1: resolution: {integrity: sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==} @@ -5837,7 +5866,6 @@ packages: dependencies: once: 1.4.0 wrappy: 1.0.2 - dev: false /inherits@2.0.3: resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==} @@ -5845,7 +5873,6 @@ packages: /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: false /ini@1.3.8: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} @@ -6119,7 +6146,6 @@ packages: dependencies: argparse: 1.0.10 esprima: 4.0.1 - dev: false /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} @@ -6144,18 +6170,22 @@ packages: /json-parse-even-better-errors@2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + /json-schema-migrate@2.0.0: + resolution: {integrity: sha512-r38SVTtojDRp4eD6WsCqiE0eNDt4v1WalBXb9cyZYw9ai5cGtBwzRNWjHzJl38w6TxFkXAIA7h+fyX3tnrAFhQ==} + dependencies: + ajv: 8.12.0 + dev: true + /json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} /json-schema-traverse@1.0.0: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - dev: false /json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} hasBin: true - dev: false /jsonc-parser@3.2.1: resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} @@ -7026,7 +7056,6 @@ packages: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: brace-expansion: 1.1.11 - dev: false /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} @@ -7186,7 +7215,6 @@ packages: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 - dev: false /onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} @@ -7375,7 +7403,6 @@ packages: /path-is-absolute@1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} - dev: false /path-is-inside@1.0.2: resolution: {integrity: sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==} @@ -8359,7 +8386,6 @@ packages: /require-from-string@2.0.2: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} - dev: false /require-like@0.1.2: resolution: {integrity: sha512-oyrU88skkMtDdauHDuKVrgR+zuItqr6/c//FXzvmxRGMexSDc6hNvJInGW3LL46n+8b50RykrvwSUIIQH2LQ5A==} @@ -8793,7 +8819,6 @@ packages: /sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - dev: false /srcset@4.0.0: resolution: {integrity: sha512-wvLeHgcVHKO8Sc/H/5lkGreJQVeYMm9rlmt8PuR1xE31rIuXhuzznUUqAt8MqLhB3MqJdFzlNAfpcWnxiFUcPw==} @@ -9512,7 +9537,6 @@ packages: /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: false /write-file-atomic@3.0.3: resolution: {integrity: sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==} From c17cd1f0e17e5337cdd295cfc38d0b4705de9d2b Mon Sep 17 00:00:00 2001 From: Ethan Rose <33912936+errose28@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:46:01 -0700 Subject: [PATCH 2/3] HDDS-10506. Reduce directory iterations in sidebar check (#85) --- .github/scripts/sidebar.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/scripts/sidebar.sh b/.github/scripts/sidebar.sh index 6b270946d..330ccc5bd 100755 --- a/.github/scripts/sidebar.sh +++ b/.github/scripts/sidebar.sh @@ -27,13 +27,11 @@ root="$(git rev-parse --show-toplevel)" schema="$root"/.github/resource/category.schema.json # Make sure all docs directories have a category sidebar file. -for child in $(find "$root"/docs/*); do - if [ -d "$child" ]; then - category_file="$child/_category_.yml" - if [ ! -f "$category_file" ]; then - echo "_category_.yml is required for docs subdirectory $child" 1>&2 - rc=1 - fi +for child in $(find "$root"/docs/* -type d); do + category_file="$child/_category_.yml" + if [ ! -f "$category_file" ]; then + echo "_category_.yml is required for docs subdirectory $child" 1>&2 + rc=1 fi done From 0126e8a02a5baf90afb1e8e9d51df3aee53ad191 Mon Sep 17 00:00:00 2001 From: Ethan Rose <33912936+errose28@users.noreply.github.com> Date: Sun, 24 Mar 2024 10:32:45 -0700 Subject: [PATCH 3/3] HDDS-9567. Add GitHub Actions license header check for relevant files. (#86) --- .dockerignore | 17 +++++++++++ .github/workflows/static.yml | 7 +++++ .gitignore | 17 +++++++++++ .licenserc.yaml | 41 +++++++++++++++++++++++++++ babel.config.js | 19 +++++++++++++ docusaurus.config.js | 19 +++++++++++++ progress.sh | 17 +++++++++++ sidebars.js | 19 +++++++++++++ src/css/custom.css | 19 +++++++++++++ src/css/footer.css | 19 +++++++++++++ src/css/header.css | 19 +++++++++++++ src/pages/index.js | 19 +++++++++++++ src/theme/DocSidebar/index.js | 19 +++++++++++++ src/theme/DocSidebar/index.module.css | 19 +++++++++++++ static/doap_ozone.rdf | 19 +++++++++++++ static/img/ozone-logo.svg | 19 +++++++++++++ 16 files changed, 308 insertions(+) create mode 100644 .licenserc.yaml diff --git a/.dockerignore b/.dockerignore index 4848f9a75..7424fca1a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + node_modules build .docusaurus diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 5f972c71c..5b7cded47 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -32,6 +32,13 @@ env: node_version: 20 jobs: + license: + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v4 + - name: Check Apache license headers + uses: apache/skywalking-eyes@v0.5.0 file-names: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index b2d6de306..000fb0093 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + # Dependencies /node_modules diff --git a/.licenserc.yaml b/.licenserc.yaml new file mode 100644 index 000000000..6c5844814 --- /dev/null +++ b/.licenserc.yaml @@ -0,0 +1,41 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +header: + license: + spdx-id: Apache-2.0 + copyright-owner: Apache Software Foundation + + # See https://www.apache.org/legal/src-headers.html#faq-exceptions + # Files already in .gitignore are ignored by default. + paths-ignore: + - LICENSE.txt + # Json does not support comments. + - "**/*.json" + # Docs content does not require headers. + # See examples on https://github.com/apache/www-site and the skywalking-eyes recommended configuration for + # Apache projects at https://github.com/apache/skywalking-eyes?tab=readme-ov-file#github-actions + - "**/*.md" + - "**/_category_.yml" + - pnpm-lock.yaml + + # Do not comment on pull requests. + comment: never + +dependency: + files: + - package.json diff --git a/babel.config.js b/babel.config.js index e00595dae..5c94bb788 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + module.exports = { presets: [require.resolve('@docusaurus/core/lib/babel/preset')], }; diff --git a/docusaurus.config.js b/docusaurus.config.js index dd1d60630..6054289dc 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + // @ts-check // Note: type annotations allow type checking and IDEs autocompletion diff --git a/progress.sh b/progress.sh index cdebeb9a2..caacaa80d 100755 --- a/progress.sh +++ b/progress.sh @@ -1,4 +1,21 @@ #!/usr/bin/env sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + # Run this script to see how many pages are filled in and how many are left. This is an approximation based on the TODO # messages in existing stubbed out pages. Pass -v or --verbose to get a specific list of pages. diff --git a/sidebars.js b/sidebars.js index 606892d09..d6de6651c 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + /** * Creating a sidebar enables you to: - create an ordered group of docs diff --git a/src/css/custom.css b/src/css/custom.css index 6c5bee300..591fbb39e 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + /** * Any CSS included here will be global. The classic template * bundles Infima by default. Infima is a CSS framework designed to diff --git a/src/css/footer.css b/src/css/footer.css index af8748775..63c263310 100644 --- a/src/css/footer.css +++ b/src/css/footer.css @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + /* Make footer dark regardless of the website theme */ :root { --footer-background-color: #202020; diff --git a/src/css/header.css b/src/css/header.css index 0c16f8c51..1edd326eb 100644 --- a/src/css/header.css +++ b/src/css/header.css @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + /* * Style the header at the top of the site. */ diff --git a/src/pages/index.js b/src/pages/index.js index 33ab53b5f..0f2371e3d 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import React from 'react'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Layout from '@theme/Layout'; diff --git a/src/theme/DocSidebar/index.js b/src/theme/DocSidebar/index.js index f4df5f584..a237b8554 100644 --- a/src/theme/DocSidebar/index.js +++ b/src/theme/DocSidebar/index.js @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import React from 'react'; import DocSidebar from '@theme-original/DocSidebar'; import DocsVersionDropdownNavbarItem from '@theme-original/NavbarItem/DocsVersionDropdownNavbarItem'; diff --git a/src/theme/DocSidebar/index.module.css b/src/theme/DocSidebar/index.module.css index 5194f67fe..c3d7447af 100644 --- a/src/theme/DocSidebar/index.module.css +++ b/src/theme/DocSidebar/index.module.css @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + /* * Add a version dropdown to the docs sidebar. */ diff --git a/static/doap_ozone.rdf b/static/doap_ozone.rdf index 0cbb1cfd3..01da5c63a 100644 --- a/static/doap_ozone.rdf +++ b/static/doap_ozone.rdf @@ -1,4 +1,23 @@ + + +