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:
yosifkit 2024-05-17 11:44:00 -07:00 committed by GitHub
parent 415954616b
commit 63c9218175
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
155 changed files with 1221 additions and 0 deletions

9
.ci/check-metadata.sh Executable file
View File

@ -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 */ .

View File

@ -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

View File

@ -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.

7
adminer/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
aerospike/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
almalinux/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
alpine/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
alt/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"api-management"
]
}
}

7
arangodb/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
archlinux/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
backdrop/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"content-management-system"
]
}
}

7
bash/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"developer-tools"
]
}
}

7
bonita/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"developer-tools"
]
}
}

7
busybox/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
caddy/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"web-servers"
]
}
}

7
cassandra/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

5
centos/metadata.json Normal file
View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

7
chronograf/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"monitoring-and-observability"
]
}
}

7
cirros/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
clearlinux/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
clefos/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
clojure/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
composer/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"developer-tools"
]
}
}

5
consul/metadata.json Normal file
View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

7
convertigo/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
couchbase/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
couchdb/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
crate/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
dart/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
debian/metadata.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
docker/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"developer-tools"
]
}
}

7
drupal/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"content-management-system"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"message-queues"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

5
eggdrop/metadata.json Normal file
View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
elixir/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
emqx/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"message-queues"
]
}
}

7
erlang/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

7
fedora/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
flink/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"data-science"
]
}
}

7
fluentd/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"monitoring-and-observability"
]
}
}

5
friendica/metadata.json Normal file
View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

7
gazebo/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
gcc/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
geonetwork/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"data-science"
]
}
}

16
get-categories.sh Executable file
View File

@ -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"

7
ghost/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"content-management-system"
]
}
}

7
golang/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
gradle/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"developer-tools"
]
}
}

7
groovy/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
haproxy/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"web-servers"
]
}
}

7
haskell/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
haxe/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

7
hitch/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"web-servers"
]
}
}

7
httpd/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"web-servers"
]
}
}

7
hylang/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
ibmjava/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
influxdb/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

5
irssi/metadata.json Normal file
View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

7
jetty/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"web-servers"
]
}
}

5
jobber/metadata.json Normal file
View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

7
joomla/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"content-management-system"
]
}
}

7
jruby/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
julia/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
kapacitor/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"monitoring-and-observability"
]
}
}

7
kibana/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"monitoring-and-observability"
]
}
}

7
kong/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"api-management"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"message-queues"
]
}
}

7
liquibase/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"developer-tools"
]
}
}

7
logstash/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"monitoring-and-observability"
]
}
}

7
mageia/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"operating-systems"
]
}
}

7
mariadb/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
matomo/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"monitoring-and-observability"
]
}
}

7
maven/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
mediawiki/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"content-management-system"
]
}
}

7
memcached/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

22
metadata.json Normal file
View File

@ -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"
]
}
}

118
metadata.sh Executable file
View File

@ -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"

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
mongo/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

7
monica/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"content-management-system"
]
}
}

7
mono/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
mysql/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

View File

@ -0,0 +1,5 @@
{
"hub": {
"categories": []
}
}

7
nats/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"message-queues"
]
}
}

7
neo4j/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"databases-and-storage"
]
}
}

View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"data-science"
]
}
}

7
nextcloud/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"content-management-system"
]
}
}

7
nginx/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"web-servers"
]
}
}

7
node/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"languages-and-frameworks"
]
}
}

7
notary/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"hub": {
"categories": [
"security"
]
}
}

7
odoo/metadata.json Normal file
View File

@ -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