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

Add Module layout specification #157

Merged
merged 2 commits into from
Apr 23, 2024
Merged

Conversation

bastelfreak
Copy link
Contributor

This document describes all files/directories that are allowed or mandatory within a module. The forge can use it as an allowlist and filter other files out. r10k/code-manager can use it as an allowlist as well when modules are pulled from version controll systems like github (similar to the --exclude-spec option in r10k).

language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Show resolved Hide resolved
Copy link
Contributor

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I'm in favor of a specific list of what's allowed. I'd suggest the make sure puppet-modulebuilder has this list built in. It may be a breaking change to switch to it, so perhaps at first it should be opt-in.

Short term I think this may work for .pmtignore, if it follows gitignore:

# Ignore everything
*

# except
!manifest/**/*.pp
!metadata.json
!README*
!CHANGELOG*
!LICENSE*
...

language/module.md Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
Copy link
Member

@david22swan david22swan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from that one comment this LGTM.
Would probably need a few more eyes on it before merging though, considering the importance.

@donoghuc
Copy link
Contributor

This is a good start. i would like to see bolt_plugin.json added as well https://www.puppet.com/docs/bolt/latest/writing_plugins.html but having this as a point of reference will be helpful.

@bastelfreak
Copy link
Contributor Author

@donoghuc thanks for the hint, I added it.

Copy link
Contributor

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's useful to show a tree form.

$ mkdir -p docs examples facts.d files functions lib/facter lib/puppet/{type,provider,functions,parser/functions,puppet_x,augeas/lenses} locales plans scripts tasks templates types
$ touch CHANGELOG LICENSE README REFERENCE.md bolt_plugin.json hiera.yaml metadata.json
$ tree
.
├── bolt_plugin.json
├── CHANGELOG
├── docs
├── examples
├── facts.d
├── files
├── functions
├── hiera.yaml
├── lib
│   ├── facter
│   └── puppet
│       ├── augeas
│       │   └── lenses
│       ├── functions
│       ├── parser
│       │   └── functions
│       ├── provider
│       ├── puppet_x
│       └── type
├── LICENSE
├── locales
├── manifests
├── metadata.json
├── plans
├── README
├── REFERENCE.md
├── scripts
├── tasks
├── templates
└── types

24 directories, 7 files

On the console it helpfully shows directories as blue and files as white so it's even easier to understand.

I'd even consider a separate chapter for each file/directory describing it. Some descriptions are already quite long, but many of them could be further enhanced with references to official documentation. For example, files can explain the puppet:// mechanism, but also the file() function. And that the Puppetserver will serve the files as a fileserver. Similarly, for lib which things are synced to agents.

language/module.md Outdated Show resolved Hide resolved
@Ramesh7
Copy link

Ramesh7 commented Nov 8, 2023

Just a thought : as we have consider bolt scenario here so should we consider below 2 files also to be part of specification ?

  • Puppetfile
  • bolt-project.yaml

@donoghuc
Copy link
Contributor

@Ramesh7 no those are for bolt projects. A bolt project is not a module. This spec is for modules.

language/module.md Outdated Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
language/module.md Show resolved Hide resolved
language/module.md Outdated Show resolved Hide resolved
| `/lib/augeas/lenses/` | Custom [Augeas](https://augeas.net/) lenses |
| `/functions/` | Can contain [functions written in Puppet DSL](https://www.puppet.com/docs/puppet/latest/lang_write_functions_in_puppet.html) |
| `/metadata.json` | The `metadata.json` file MUST be present and MUST adhere to [Puppet's metadata](https://www.puppet.com/docs/puppet/latest/modules_metadata.html). [metadata-json-lint](https://github.com/voxpupuli/metadata-json-lint#metadata-json-lint) can be used to validate your file. |
| `/README` | A README that describes what the module does. It's best practice to add a file extension like `.md`, `.rst` when a markup language is used |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it says at the end .md/,rst, would it make sense to do README.md by default, given that is the community standard.


## Schema versioning

This is version 0 of the schema. A changelog will be added when the schema is
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we semver this? so 0.1.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at other places Puppet only used major versions for schema. For example for the report format. I'm fine with everything here.

This document describes all files/directories that are allowed or
mandatory within a module. The forge can use it as an allowlist and
filter other files out. r10k/code-manager can use it as an allowlist as
well when modules are pulled from version controll systems like github
(similar to the `--exclude-spec` option in r10k).

Co-authored-by: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
Co-authored-by: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
@joshcooper joshcooper merged commit 3722883 into puppetlabs:master Apr 23, 2024
2 checks passed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request May 25, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request May 25, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/modulesync_config that referenced this pull request May 25, 2024
puppetlabs/puppet-specifications#157 defines
which files are allowed in a puppet module release. This commit
basically changes the .pmtignore into an allowlist, not a denylist
anymore.
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request May 25, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request May 25, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request May 25, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request May 25, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/modulesync_config that referenced this pull request Jun 15, 2024
puppetlabs/puppet-specifications#157 defines
which files are allowed in a puppet module release. This commit
basically changes the .pmtignore into an allowlist, not a denylist
anymore.
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request Jun 15, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request Jun 15, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request Jun 15, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request Jul 5, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request Jul 5, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
bastelfreak added a commit to bastelfreak/puppet-modulebuilder that referenced this pull request Jul 23, 2024
This implements puppetlabs/puppet-specifications#157

* By default every file is ignored
* Only files from the official specification for puppet modules are
  added to the allowlist
* support for .pdkignore, .pmtignore and .gitignore is removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.