Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing files #40

Merged
merged 1 commit into from
Oct 2, 2020
Merged

Writing files #40

merged 1 commit into from
Oct 2, 2020

Conversation

g-pavlov
Copy link
Contributor

@g-pavlov g-pavlov commented Sep 29, 2020

What this PR does / why we need it:
Currently, writing files and folders doesn't quite work as expected.

  • Duplicate writes for files and folders
  • Concurrent map writes occur
  • Nodes that do not refer to documents are not handled
    among others.

What we want is a more reliable, manifest-driven materialization of the structure. And as far as hugo is concerned, smarter handling of _index.md files.

Special notes for your reviewer:

Release note:

Documents structures support "folder"-type nodes that have no contentSelector specified and result in a file folder named by the name of the node.
- Node names need not end with .md suffix to have the file written as<name>.md. If there is no .md suffix, it will be appended to the file name prior to writing it down.
Hugo support  
The following features are available when the `--hugo=true` option flag is enabled:  
- Frontmatter that should be written to a document is specified in the properties map of the corresponding documentation structure node with key "frontmatter"
- Documents frontmatter in yaml (only) is supported
- Documents with frontmatter only (no other content) and without line ending on the last line are supported.
- Documents with frontmatter preceded by any amount of whitespace are supported. Whitespace before or after the `---` start/end marks is also supported.
- Documents that start with `---` (potentially preceded by any whitespace) are considered to specify frontmatter. An error is thrown if there is no closing `---` and the content in between is not valid yaml
- Frontmatter specified as node property and frontmatter available in the node document that will be written are merged. Duplicates are not reconciled.
- A minimal frontmatter `title: <node-name-title-case>` is written when no other has been specified as node property or in the document)
- Container nodes that specify a "frontmatter" structure in their `properties` will be written as folders with autogenerated `_index.md` file that contains the specified frontmatter.
- Document nodes that need to be written as hugo section files are identified by an `index": true` entry in their Properties. Such nodes are written as _index.md files regardless of their name.
- A section file node can be inferred automatically too. A document structure node that has content selectors, and with no other peer nodes named `_index` or `_index_md`, will be written as `_index.md` file, provided that its name matches one of the entries specified in the `--hugo-section-files` flag or its default list: readme, read.me, index (case insensitive). To disable this automation, set the `--hugo-section-files` flag value to empty string. 
- Multiple files that will potentially be written as `_index.md` in the same folder are detected and reported as error.

@g-pavlov g-pavlov added the component/documentation Gardener Documentation label Sep 29, 2020
@g-pavlov g-pavlov self-assigned this Sep 29, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 29, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 29, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 29, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 30, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 30, 2020
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 1, 2020
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2020
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2020
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 2, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 2, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 2, 2020
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 2, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 2, 2020
@g-pavlov g-pavlov merged commit 12b19b4 into master Oct 2, 2020
@g-pavlov g-pavlov deleted the writing-files branch October 2, 2020 09:15
@gardener-robot gardener-robot added the needs/review Needs review label Oct 21, 2020
@g-pavlov g-pavlov removed needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/review Needs review labels Oct 21, 2020
@gardener-robot gardener-robot added the needs/review Needs review label Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/documentation Gardener Documentation needs/review Needs review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants