1
0
mirror of synced 2025-12-19 10:00:34 -05:00

ci: add support for enterprise connectors docs path (#65913)

This commit is contained in:
Jose Pefaur
2025-09-04 11:40:29 -05:00
committed by GitHub
parent 07f69b7df8
commit 4ecbcbaa00
3 changed files with 22 additions and 8 deletions

View File

@@ -13,14 +13,25 @@ connector_docs_path() {
# First, remove -strict-encrypt suffix since these connectors
# share documentation with their base connector
local connector_name="$1"
local is_enterprise="$2"
connector_name=$(echo "$connector_name" | sed -r 's/-strict-encrypt$//')
# The regex '^(source|destination)-(.*)' matches strings like source-whatever or destination-something-like-this,
# capturing the connector type (source/destination) and the connector name (whatever / something-like-this).
# We then output '\1s/\2.md', which inserts the captured values as `\1` and `\2`.
# This produces a string like `sources/whatever.md`.
# Then we prepend the 'docs/integrations/' path.
echo $DOCS_BASE_DIR/$(echo $connector_name | sed -r 's@^(source|destination)-(.*)@\1s/\2.md@')
if [ "$is_enterprise" = "true" ]; then
docs_path="$DOCS_BASE_DIR/enterprise-connectors/$connector_name.md"
else
# The regex '^(source|destination)-(.*)' matches strings like source-whatever or destination-something-like-this,
# capturing the connector type (source/destination) and the connector name (whatever / something-like-this).
# We then output '\1s/\2.md', which inserts the captured values as `\1` and `\2`.
# This produces a string like `sources/whatever.md`.
# Then we prepend the 'docs/integrations/' path.
docs_path=$DOCS_BASE_DIR/$(echo $connector_name | sed -r 's@^(source|destination)-(.*)@\1s/\2.md@')
fi
if ! test -f "$docs_path"; then
echo 'Connector documentation file does not exist:' "$docs_path" >&2
fi
echo "$docs_path"
}
# Expects that you have populated a $connectors variable as an array.

View File

@@ -34,7 +34,9 @@ syft_docker_image="anchore/syft:v1.6.0"
sbom_extension="spdx.json"
meta="${CONNECTORS_DIR}/${connector}/metadata.yaml"
doc="$(connector_docs_path $connector)"
# isEnterprise flag is usually only set on enterprise connectors,
is_enterprise=$(yq -r '.data.ab_internal.isEnterprise // false' "$meta")
doc="$(connector_docs_path $connector $is_enterprise)"
docker_repository=$(yq -r '.data.dockerRepository' "$meta")
if test -z "$docker_repository" || test "$docker_repository" = "null"; then

View File

@@ -8,5 +8,6 @@ connector=$(get_only_connector)
echo "---- PROCESSING METADATA FOR $connector ----"
meta="${CONNECTORS_DIR}/${connector}/metadata.yaml"
doc="$(connector_docs_path $connector)"
is_enterprise=$(yq -r '.data.ab_internal.isEnterprise // false' "$meta")
doc="$(connector_docs_path $connector $is_enterprise)"
poetry run --directory $METADATA_SERVICE_PATH metadata_service validate "$meta" "$doc"