diff --git a/Makefile b/Makefile index cd28487..34f4597 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,10 @@ -SHELL := /bin/bash # Use bash syntax +# define some defaults https://tech.davis-hansson.com/p/make/ +SHELL := bash +.ONESHELL: +.SHELLFLAGS := -eu -o pipefail -c +.DELETE_ON_ERROR: +MAKEFLAGS += --warn-undefined-variables +MAKEFLAGS += --no-builtin-rules docker_repo := zokradonh # if not run in travis, get docker_login and _pwd from file diff --git a/base/create-kopano-repo.sh b/base/create-kopano-repo.sh index 178ffd5..d899180 100755 --- a/base/create-kopano-repo.sh +++ b/base/create-kopano-repo.sh @@ -17,7 +17,7 @@ function h5ai_query { filename=$(curl -s -XPOST "https://download.kopano.io/$channel/?action=get&items\[href\]=/$channel/$component:/$branch&items\[what\]=1" | \ jq -r '.items[].href' | \ - grep "$distribution-all\|$distribution-amd64" | sed "s#/$channel/$component:/##") + grep "$distribution-all\|$distribution-amd64" | sed "s#/$channel/$component:/##" | sed "s#/$channel/$component%3A/##") if [ -z "${filename// }" ]; then echo "unknown component" @@ -44,8 +44,8 @@ function dl_and_package_community { tar xf "$filename2" # save buildversion - currentVersion=$(version_from_filename "$filename") - echo "$component-$currentVersion" >> /kopano/buildversion + #currentVersion=$(version_from_filename "$filename") + #echo "$component-$currentVersion" >> /kopano/buildversion # save disk space rm "$filename2" diff --git a/base/test.sh b/base/test.sh new file mode 100755 index 0000000..58847ee --- /dev/null +++ b/base/test.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DEBUG=true +WORK_DIR=$(mktemp -d) +component=${1:-core} + +function cleanup { + rm -rf "$WORK_DIR" + echo "Deleted temp working directory $WORK_DIR" +} + +trap cleanup EXIT + +cd "$WORK_DIR" +# shellcheck source=base/create-kopano-repo.sh +. "$DIR"/create-kopano-repo.sh +dl_and_package_community "$component" diff --git a/tests/commander.yaml b/tests/commander.yaml index 8ac1d1c..7d9b7ec 100755 --- a/tests/commander.yaml +++ b/tests/commander.yaml @@ -51,4 +51,16 @@ tests: not-contains: - Debian - amd64 - - tar.gz \ No newline at end of file + - tar.gz + download core nightly: + command: ./base/test.sh core + exit-code: 0 + stderr: + not-contains: + - "tar: This does not look like a tar archive" + download webapp nightly: + command: ./base/test.sh webapp + exit-code: 0 + stderr: + not-contains: + - "tar: This does not look like a tar archive"