Add Docker Hub categories (#2446)
* Add repo metadata, start with categories! scripts for checking repo categories, updating the canonical set added categories to push.pl * Add initial set of semi-acurate categories * Adjustments following tianon's review * Simplify metadata.sh use cases (CI or interactive); just diff and check all the time Update README.md about metadata.sh usage * Unify the categories checks into one jq expressions * Update initial categories * Link to Docker docs for categories; minor categories script adjustments
This commit is contained in:
parent
415954616b
commit
63c9218175
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.."
|
||||||
|
|
||||||
|
# metadata.sh takes directories with a 'metadata.json' in them
|
||||||
|
# metadata.json is expected in every repo
|
||||||
|
# "." so that the canonical source metadata.json is checked too
|
||||||
|
./metadata.sh */ .
|
||||||
|
|
@ -46,3 +46,8 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: .ci/check-pr-no-readme.sh
|
- run: .ci/check-pr-no-readme.sh
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
metadata:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- run: .ci/check-metadata.sh
|
||||||
|
|
|
||||||
13
README.md
13
README.md
|
|
@ -61,6 +61,7 @@ After opening your Pull Request the changes will be checked by an automated `mar
|
||||||
- Create a `license.md` (required)
|
- Create a `license.md` (required)
|
||||||
- Create a `maintainer.md` (required)
|
- Create a `maintainer.md` (required)
|
||||||
- Create a `github-repo` (required)
|
- Create a `github-repo` (required)
|
||||||
|
- Create a `metadata.json` (required)
|
||||||
- Add a `logo.png` (recommended)
|
- Add a `logo.png` (recommended)
|
||||||
|
|
||||||
Optionally:
|
Optionally:
|
||||||
|
|
@ -128,6 +129,18 @@ The image is automatically scaled to a 120 pixel square for the top of the Docke
|
||||||
|
|
||||||
This file should contain a link to the maintainers of the Dockerfile.
|
This file should contain a link to the maintainers of the Dockerfile.
|
||||||
|
|
||||||
|
## `metadata.json`
|
||||||
|
|
||||||
|
This file contains data about the repo for Docker Hub. The minimum file is defined below. `./metadata.sh [repo-name]` must be used to correctly format it (use `-w` to apply its suggested format changes). Only three sorted unique Docker Hub categories are allowed. `metadata.json` in the root contains the list of categories to choose from. See descriptions for the categories on the [Docker docs site](https://docs.docker.com/docker-hub/repos/categories/).
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## `README-short.txt`
|
## `README-short.txt`
|
||||||
|
|
||||||
This is the short description for the Docker Hub, limited to 100 characters in a single line.
|
This is the short description for the Docker Hub, limited to 100 characters in a single line.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"api-management"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"content-management-system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"developer-tools"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"developer-tools"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"web-servers"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"monitoring-and-observability"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"developer-tools"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"developer-tools"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"content-management-system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"message-queues"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"message-queues"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"data-science"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"monitoring-and-observability"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"data-science"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
workdir="$(readlink -f "$BASH_SOURCE")"
|
||||||
|
workdir="$(dirname "$workdir")"
|
||||||
|
|
||||||
|
jsonFile='metadata.json'
|
||||||
|
canonicalMetadataFile="$workdir/$jsonFile"
|
||||||
|
|
||||||
|
# add categories slugs to canonicalMetadataFile without losing other keys there
|
||||||
|
curl -fsSL https://hub.docker.com/v2/categories | jq -s --sort-keys '
|
||||||
|
.[0] as $allCategories
|
||||||
|
| .[1]
|
||||||
|
| .hub.categories = ( [ $allCategories[].slug ] | sort )
|
||||||
|
' - "$canonicalMetadataFile" | tee "$canonicalMetadataFile.new"
|
||||||
|
mv "$canonicalMetadataFile.new" "$canonicalMetadataFile"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"content-management-system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"developer-tools"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"web-servers"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"web-servers"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"web-servers"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"web-servers"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"content-management-system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"monitoring-and-observability"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"monitoring-and-observability"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"api-management"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"message-queues"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"developer-tools"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"monitoring-and-observability"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"operating-systems"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"monitoring-and-observability"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"content-management-system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"api-management",
|
||||||
|
"content-management-system",
|
||||||
|
"data-science",
|
||||||
|
"databases-and-storage",
|
||||||
|
"developer-tools",
|
||||||
|
"integration-and-delivery",
|
||||||
|
"internet-of-things",
|
||||||
|
"languages-and-frameworks",
|
||||||
|
"machine-learning-and-ai",
|
||||||
|
"message-queues",
|
||||||
|
"monitoring-and-observability",
|
||||||
|
"networking",
|
||||||
|
"operating-systems",
|
||||||
|
"security",
|
||||||
|
"web-analytics",
|
||||||
|
"web-servers"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
workdir="$(readlink -f "$BASH_SOURCE")"
|
||||||
|
workdir="$(dirname "$workdir")"
|
||||||
|
cd "$workdir"
|
||||||
|
|
||||||
|
jsonFile='metadata.json'
|
||||||
|
canonicalMetadataFile="./$jsonFile"
|
||||||
|
export maxCategories=3
|
||||||
|
|
||||||
|
self="$(basename "$0")"
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOUSAGE
|
||||||
|
|
||||||
|
usage: $self [--write] REPO[...]
|
||||||
|
eg: $self debian
|
||||||
|
$self -w python
|
||||||
|
|
||||||
|
This script checks a givens repo's metadata.json. It checks formating (providing a diff), checks categories, and can write the formatting changes.
|
||||||
|
|
||||||
|
-h, --help Print this help output and exit.
|
||||||
|
-w, --write Apply json formatting (run without to see the diff that would be applied).
|
||||||
|
|
||||||
|
Arguments are the list of repos with a 'metadata.json' in them. 'metadata.json' is expected in every repo.
|
||||||
|
'.' can also be passed to check the format of the canonical './metadata.json' at
|
||||||
|
the root of the repo, but the max categories of '-c' is skipped for it.
|
||||||
|
EOUSAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg handling
|
||||||
|
opts="$(getopt -o 'hw' --long 'help,write' -- "$@" || { usage >&2 && false; })"
|
||||||
|
eval set -- "$opts"
|
||||||
|
|
||||||
|
write=
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
flag="$1"
|
||||||
|
shift
|
||||||
|
case "$flag" in
|
||||||
|
--help | -h) usage && exit 0 ;;
|
||||||
|
--write | -w) write=1 ;;
|
||||||
|
--) break ;;
|
||||||
|
*)
|
||||||
|
{
|
||||||
|
echo "error: unknown flag: $flag"
|
||||||
|
usage
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
repos=( "$@" )
|
||||||
|
if [ "${#repos[@]}" -eq 0 ]; then
|
||||||
|
repos=( */ )
|
||||||
|
fi
|
||||||
|
repos=( "${repos[@]%/}" )
|
||||||
|
|
||||||
|
failures=0
|
||||||
|
for repo in "${repos[@]}"; do
|
||||||
|
repoFile="$repo/$jsonFile"
|
||||||
|
if [ ! -s "$repoFile" ]; then
|
||||||
|
echo >&2 "error: $repoFile does not exist or is empty"
|
||||||
|
(( failures++ )) || :
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# sort object keys and pretty print with jq as our "cannonical json"
|
||||||
|
# sort categories array, no duplicates
|
||||||
|
if ! repoFileJson="$(jq -s --sort-keys '.[0] | .hub.categories |= unique' "$repoFile")"; then
|
||||||
|
echo >&2 "error parsing '$repoFile'; invalid JSON?"
|
||||||
|
(( failures++ )) || :
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! filediff="$(diff -u "$repoFile" <(cat <<<"$repoFileJson"))"; then
|
||||||
|
cat <<<"$filediff"
|
||||||
|
if [ -n "$write" ]; then
|
||||||
|
cat <<<"$repoFileJson" > "$repoFile"
|
||||||
|
else
|
||||||
|
(( failures++ )) || :
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO also check for required keys and/or types?
|
||||||
|
# the canonicalMetadataFile doesn't have too many categories since it is the source of categories
|
||||||
|
# all other metadata.json files must not be more than maxCategories or have categories that aren't in the canonical set
|
||||||
|
if [ "$repoFile" != "$canonicalMetadataFile" ]; then
|
||||||
|
export repoFile
|
||||||
|
if errorText="$(jq -r --slurpfile canonical "$canonicalMetadataFile" '
|
||||||
|
.hub.categories
|
||||||
|
| (
|
||||||
|
length
|
||||||
|
| if . > (env.maxCategories | tonumber) then
|
||||||
|
"error: \(env.repoFile): too many categories: \(.) (max \(env.maxCategories))"
|
||||||
|
else empty end
|
||||||
|
),
|
||||||
|
(
|
||||||
|
. - $canonical[0].hub.categories
|
||||||
|
| if length > 0 then
|
||||||
|
"error: \(env.repoFile): unknown categories \(.)"
|
||||||
|
else empty end
|
||||||
|
)
|
||||||
|
' "$repoFile")"; then
|
||||||
|
if [ -n "$errorText" ]; then
|
||||||
|
echo >&2 "$errorText"
|
||||||
|
(( failures++ )) || :
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "error parsing '$repoFile'; invalid JSON?"
|
||||||
|
(( failures++ )) || :
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit "$failures"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"content-management-system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"message-queues"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"databases-and-storage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"data-science"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"content-management-system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"web-servers"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"languages-and-frameworks"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"security"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"hub": {
|
||||||
|
"categories": [
|
||||||
|
"content-management-system"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue