diff --git a/.circleci/config.yml b/.circleci/config.yml index 7721681..86cbb0f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,6 +54,9 @@ jobs: - store_artifacts: path: reports destination: reports + - store_artifacts: + path: workspace/lancachenet-monolithic.tar + destination: docker-lancachenet-monolithic.tar publish_latest: docker: - image: circleci/python:2-jessie diff --git a/overlay/etc/nginx/conf.d/30_maps.conf b/overlay/etc/nginx/conf.d/30_maps.conf index 884957d..89cde18 100644 --- a/overlay/etc/nginx/conf.d/30_maps.conf +++ b/overlay/etc/nginx/conf.d/30_maps.conf @@ -1,4 +1,4 @@ -map $http_host $cacheidentifier { - hostnames; +map "$http_user_agent£££$http_host" $cacheidentifier { default $http_host; + ~Valve\/Steam\ HTTP\ Client\ 1\.0£££.* steam; } diff --git a/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh b/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh index f3c82c7..54bcdfb 100644 --- a/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh +++ b/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh @@ -3,7 +3,7 @@ IFS=' ' mkdir -p /data/cachedomains cd /data/cachedomains -export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostCACHE_IDENTIFIERChecking=no" +export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" if [[ ! -d .git ]]; then git clone ${CACHE_DOMAINS_REPO} . fi @@ -14,9 +14,11 @@ if [[ "${NOFETCH:-false}" != "true" ]]; then fi TEMP_PATH=$(mktemp -d) OUTPUTFILE=${TEMP_PATH}/outfile.conf -echo "map \$http_host \$cacheidentifier {" >> $OUTPUTFILE -echo " hostnames;" >> $OUTPUTFILE +echo "map \"\$http_user_agent£££\$http_host\" \$cacheidentifier {" >> $OUTPUTFILE echo " default \$http_host;" >> $OUTPUTFILE +echo " ~Valve\\/Steam\\ HTTP\\ Client\\ 1\.0£££.* steam;" >> $OUTPUTFILE +#Next line probably no longer needed as we are now regexing to victory +#echo " hostnames;" >> $OUTPUTFILE jq -r '.cache_domains | to_entries[] | .key' cache_domains.json | while read CACHE_ENTRY; do #for each cache entry, find the cache indentifier CACHE_IDENTIFIER=$(jq -r ".cache_domains[$CACHE_ENTRY].name" cache_domains.json) @@ -32,7 +34,9 @@ jq -r '.cache_domains | to_entries[] | .key' cache_domains.json | while read CAC CACHE_HOST=${CACHE_HOST// /} echo "new host: $CACHE_HOST" if [ ! "x${CACHE_HOST}" == "x" ]; then - echo " ${CACHE_HOST} ${CACHE_IDENTIFIER};" >> $OUTPUTFILE + #Use sed to replace . with \. and * with .* + REGEX_CACHE_HOST=$(sed -e "s#\.#\\\.#g" -e "s#\*#\.\*#g" <<< ${CACHE_HOST}) + echo " ~.*£££.*?${REGEX_CACHE_HOST} ${CACHE_IDENTIFIER};" >> $OUTPUTFILE fi done done diff --git a/run-tests.sh b/run-tests.sh index 63e6254..272e9dd 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -13,18 +13,24 @@ GOSS_WAIT_OPS="-r 60s -s 1s" docker build --tag lancachenet/monolithic:goss-test . case $1 in circleci) - shift; - mkdir -p ./reports/goss + shift; + mkdir -p ./reports/goss if [[ "$1" == "keepimage" ]]; then KEEPIMAGE=true shift fi - export GOSS_OPTS="$GOSS_OPTS --format junit" + export GOSS_OPTS="$GOSS_OPTS --format junit" + export CONTAINER_LOG_OUTPUT="reports/goss/docker.log" dgoss run $@ lancachenet/monolithic:goss-test > reports/goss/report.xml #store result for exit code RESULT=$? + #Ensure non blank docker.log + echo \ +"Container Output: +$(cat reports/goss/docker.log)" \ + > reports/goss/docker.log #delete the junk that goss currently outputs :( - sed -i '0,/^.*<\/system-err>/d' reports/goss/report.xml ;;