Skip to content

Commit 6fb6b06

Browse files
gbartoliniNiccoloFei
authored andcommitted
feat: allow per-extension license metadata
This change introduces a `licenses` field to the metadata schema, allowing each extension to define its own SPDX license identifier. The `docker-bake.hcl` has been updated to use this metadata for OCI labels and annotations instead of a hardcoded "Apache-2.0" string. This enables proper legal transparency for extensions with different, yet compatible, licensing requirements, such as PostGIS (`GPL-2.0-only`). Changes: - Added `licenses` field to metadata.hcl template - Updated docker-bake.hcl to reference `${metadata.licenses}` - Updated `metadata.hcl` for the existing extensions Closes #110 Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
1 parent 2716417 commit 6fb6b06

5 files changed

Lines changed: 11 additions & 2 deletions

File tree

docker-bake.hcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ target "default" {
7474
"index,manifest:org.opencontainers.image.description=A ${metadata.name} ${getExtensionVersion(distro, pgVersion)} container image for PostgreSQL ${pgVersion} on ${distro}",
7575
"index,manifest:org.opencontainers.image.documentation=${url}",
7676
"index,manifest:org.opencontainers.image.authors=${authors}",
77-
"index,manifest:org.opencontainers.image.licenses=Apache-2.0",
77+
"index,manifest:org.opencontainers.image.licenses=${metadata.licenses}",
7878
"index,manifest:org.opencontainers.image.base.name=scratch",
7979
"index,manifest:io.cloudnativepg.image.base.name=${getBaseImage(distro, pgVersion)}",
8080
"index,manifest:io.cloudnativepg.image.base.pgmajor=${pgVersion}",
@@ -91,7 +91,7 @@ target "default" {
9191
"org.opencontainers.image.description" = "A ${metadata.name} ${getExtensionVersion(distro, pgVersion)} container image for PostgreSQL ${pgVersion} on ${distro}",
9292
"org.opencontainers.image.documentation" = "${url}",
9393
"org.opencontainers.image.authors" = "${authors}",
94-
"org.opencontainers.image.licenses" = "Apache-2.0",
94+
"org.opencontainers.image.licenses" = "${metadata.licenses}",
9595
"org.opencontainers.image.base.name" = "scratch",
9696
"io.cloudnativepg.image.base.name" = "${getBaseImage(distro, pgVersion)}",
9797
"io.cloudnativepg.image.base.pgmajor" = "${pgVersion}",

pgaudit/metadata.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ metadata = {
22
name = "pgaudit"
33
sql_name = "pgaudit"
44
image_name = "pgaudit"
5+
licenses = "PostgreSQL"
56
shared_preload_libraries = ["pgaudit"]
67
extension_control_path = []
78
dynamic_library_path = []

pgvector/metadata.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ metadata = {
22
name = "pgvector"
33
sql_name = "vector"
44
image_name = "pgvector"
5+
licenses = "PostgreSQL"
56
shared_preload_libraries = []
67
extension_control_path = []
78
dynamic_library_path = []

postgis/metadata.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ metadata = {
22
name = "postgis"
33
sql_name = "postgis"
44
image_name = "postgis-extension"
5+
licenses = "GPL-2.0-or-later AND Apache-2.0 AND MIT AND LGPL-2.1-only AND LGPL-3.0-or-later"
56
shared_preload_libraries = []
67
extension_control_path = []
78
dynamic_library_path = []

templates/metadata.hcl.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ metadata = {
99
# it identifies the image (e.g. ghcr.io/cloudnative-pg/<image_name>)
1010
image_name = "{{ .Name }}"
1111

12+
# TODO: Remove this comment block after customizing the file.
13+
# `licenses`: The SPDX license identifier for the extension software.
14+
# Examples: "Apache-2.0", "PostgreSQL", "GPL-2.0-only".
15+
# See: https://spdx.org/licenses/
16+
licenses = "Apache-2.0"
17+
1218
# TODO: Remove this comment block after customizing the file.
1319
# `shared_preload_libraries`: list libraries to be added to
1420
# `shared_preload_libraries` in Postgres. Usually empty.

0 commit comments

Comments
 (0)