Skip to content

pantheon-systems/sites-yml-validator

Repository files navigation

Pantheon Sites.yml Validator

Early Access

Codacy Badge

A utility for validating a sites.yml file on a Pantheon site during a WordPress multisite's search and replace tasks. For more information, see Pantheon's Multisite Docs.

Usage

sites.yml

To validate the sites.yml file, run:

$ sites-yml-validator sites path/to/sites.yml

Valid File Example

See this annotated fixture for an example of a valid sites.yml file.

The basic format for the file is:

api_version: 1
domain_maps:
  {env_name}:
    {site_id}: {site_url}

A sites.yml file is valid if:

  • the api_version is 1
  • convert_to_subdirectory is a boolean true or false, or the integers 1 or 0.
  • the key for each item in domain_maps is a valid Pantheon environment name (dev, test, multidev, etc.)
  • For each site listed for an environment:
    • the key is an integer
    • the value is a valid Pantheon hostname
  • there are no more than 25 sites listed for any environment

Install

Use wget to download, gzipped pre-compiled binaries: For instance, VERSION=v0.0.11 and BINARY=sites-yml-validator_linux_amd64 Refer to the Releases page for VERSION and BINARY parameters

Compressed via tar.gz

wget https://github.com/pantheon-systems/sites-yml-validator/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\
  tar xz && mv ${BINARY} /usr/bin/sites-yml-validator

Plain binary

wget https://github.com/pantheon-systems/sites-yml-validator/releases/download/${VERSION}/${BINARY} -O /usr/bin/sites-yml-validator &&\
    chmod +x /usr/bin/sites-yml-validator

Latest version Linux

wget https://github.com/pantheon-systems/sites-yml-validator/releases/latest/download/sites-yml-validator_linux_amd64 -O /usr/bin/sites-yml-validator &&\
    chmod +x /usr/bin/sites-yml-validator

Latest version Intel processor Mac

curl -LO https://github.com/pantheon-systems/sites-yml-validator/releases/latest/download/sites-yml-validator_Darwin_x86_64.tar.gz && tar -xf sites-yml-validator_Darwin_x86_64.tar.gz && sudo mv sites-yml-validator /usr/local/bin/sites-yml-validator && sudo chmod +x /usr/local/bin/sites-yml-validator

Latest version Apple Silicon processor Mac

curl -LO https://github.com/pantheon-systems/sites-yml-validator/releases/latest/download/sites-yml-validator_Darwin_arm64.tar.gz && tar -xf sites-yml-validator_Darwin_arm64.tar.gz && sudo mv sites-yml-validator /usr/local/bin/sites-yml-validator && sudo chmod +x /usr/local/bin/sites-yml-validator

Testing

make test runs linting and testing.

Releases

Automatically releases on merge to main via autotag + goreleaser. See Autotag Readme for details on how the SemVer is determined. With goreleaser, each commit merged will become a line item in the release's Changelog. Take note to use squashing and/or rebase to ensure helpful and informative commit messages.