ci: add support for enterprise connectors docs path (#65913)
This commit is contained in:
@@ -13,14 +13,25 @@ connector_docs_path() {
|
|||||||
# First, remove -strict-encrypt suffix since these connectors
|
# First, remove -strict-encrypt suffix since these connectors
|
||||||
# share documentation with their base connector
|
# share documentation with their base connector
|
||||||
local connector_name="$1"
|
local connector_name="$1"
|
||||||
|
local is_enterprise="$2"
|
||||||
connector_name=$(echo "$connector_name" | sed -r 's/-strict-encrypt$//')
|
connector_name=$(echo "$connector_name" | sed -r 's/-strict-encrypt$//')
|
||||||
|
|
||||||
# The regex '^(source|destination)-(.*)' matches strings like source-whatever or destination-something-like-this,
|
if [ "$is_enterprise" = "true" ]; then
|
||||||
# capturing the connector type (source/destination) and the connector name (whatever / something-like-this).
|
docs_path="$DOCS_BASE_DIR/enterprise-connectors/$connector_name.md"
|
||||||
# We then output '\1s/\2.md', which inserts the captured values as `\1` and `\2`.
|
else
|
||||||
# This produces a string like `sources/whatever.md`.
|
# The regex '^(source|destination)-(.*)' matches strings like source-whatever or destination-something-like-this,
|
||||||
# Then we prepend the 'docs/integrations/' path.
|
# capturing the connector type (source/destination) and the connector name (whatever / something-like-this).
|
||||||
echo $DOCS_BASE_DIR/$(echo $connector_name | sed -r 's@^(source|destination)-(.*)@\1s/\2.md@')
|
# 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.
|
# Expects that you have populated a $connectors variable as an array.
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ syft_docker_image="anchore/syft:v1.6.0"
|
|||||||
sbom_extension="spdx.json"
|
sbom_extension="spdx.json"
|
||||||
|
|
||||||
meta="${CONNECTORS_DIR}/${connector}/metadata.yaml"
|
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")
|
docker_repository=$(yq -r '.data.dockerRepository' "$meta")
|
||||||
if test -z "$docker_repository" || test "$docker_repository" = "null"; then
|
if test -z "$docker_repository" || test "$docker_repository" = "null"; then
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ connector=$(get_only_connector)
|
|||||||
|
|
||||||
echo "---- PROCESSING METADATA FOR $connector ----"
|
echo "---- PROCESSING METADATA FOR $connector ----"
|
||||||
meta="${CONNECTORS_DIR}/${connector}/metadata.yaml"
|
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"
|
poetry run --directory $METADATA_SERVICE_PATH metadata_service validate "$meta" "$doc"
|
||||||
|
|||||||
Reference in New Issue
Block a user