mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 21:17:58 +08:00
86af38abfc
Description ==================== zot currently stores session cookies in memory or in a local directory. For cases where the session cookies should be independent of the instance where they were created such as multiple instances of zot, or a fully stateless zot instance, there is a need to support a remote session storage. This change adds support for using Redis and Redis-compatible services as a remote session driver as well as introduces a new configuration option for it. What has changed ======================= - New config added under Auth config to specify configuration for the session driver. - Examples README updated with details of the new Auth config. - The config supports only 2 drivers in this change - local and redis - Using the local driver is backwards compatible and behaves the same way that zot currently works for local session storage. - Omitting this config does not result in an error. In this case, zot behaves as it normally does for local session storage. - When configured, zot can use redis for persisting cookie information for zot UI. - The cookie in the store is deleted on logout or after the max expiry time for the cookie. - Configuration for the redis session driver accepts the same configuration values as that of the remote meta cache. - A separate connection is established for the session driver. An existing connection for meta cache will not be re-used for the session driver. - A key prefix is configurable for the redis session driver. The value will be converted into a string for use. If no value is provided, a default prefix of "zotsession" will be used. - Redis sessions does not support hash key or encryption in this change. - New BATS test added to verify zot behavior with Redis session store. - Github workflow updated to install valkey-tools dependency for BATS. Signed-off-by: Vishwas Rajashekar <dev@vrajashkr.com>
39 lines
1.2 KiB
Bash
Executable File
39 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
BATS_FLAGS=${BATS_FLAGS:-"--print-output-on-failure"}
|
|
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
|
BATS=${SCRIPTPATH}/../../hack/tools/bin/bats
|
|
PATH=$PATH:${SCRIPTPATH}/../../hack/tools/bin
|
|
|
|
tests=("pushpull" "pushpull_authn" "delete_images" "referrers" "metadata" "anonymous_policy"
|
|
"annotations" "detect_manifest_collision" "cve" "sync" "sync_docker" "sync_replica_cluster"
|
|
"scrub" "garbage_collect" "metrics" "metrics_minimal" "multiarch_index" "docker_compat" "redis_local" "redis_session_store"
|
|
"events_nats" "events_http" "events_nats_lint_failure" "events_http_lint_failure" "events_sink_failure" "events_config_decoding")
|
|
|
|
for test in ${tests[*]}; do
|
|
${BATS} ${BATS_FLAGS} ${SCRIPTPATH}/${test}.bats > ${test}.log & pids+=($!)
|
|
done
|
|
|
|
i=0
|
|
success="true"
|
|
for pid in ${pids[*]}; do
|
|
if ! wait $pid; then
|
|
echo "${tests[$i]} test returns an error !!!"
|
|
cat ${tests[$i]}.log
|
|
success="false"
|
|
# we still need to wait for other PIDs to finish for the script to return properly
|
|
else
|
|
echo "${tests[$i]} test completed successfully."
|
|
fi
|
|
rm ${tests[$i]}.log
|
|
i=$((i+1))
|
|
done
|
|
|
|
if [ "$success" == "false" ]; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "Successfully run all tests"
|