diff --git a/poe-tasks/lib/util.sh b/poe-tasks/lib/util.sh index 5d80adb78ed..bda336828d7 100644 --- a/poe-tasks/lib/util.sh +++ b/poe-tasks/lib/util.sh @@ -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. diff --git a/poe-tasks/upload-connector-metadata.sh b/poe-tasks/upload-connector-metadata.sh index 12b79289911..65211a2eede 100755 --- a/poe-tasks/upload-connector-metadata.sh +++ b/poe-tasks/upload-connector-metadata.sh @@ -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 diff --git a/poe-tasks/validate-connector-metadata.sh b/poe-tasks/validate-connector-metadata.sh index 3a52d910d47..886dd3ef699 100755 --- a/poe-tasks/validate-connector-metadata.sh +++ b/poe-tasks/validate-connector-metadata.sh @@ -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"