Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/docs-preview-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ jobs:
- name: 'Prepare artifact for transfer'
run: |
# Save ENV for transfer
echo "PR_HEADSHA=${{ github.event.pull_request.head.sha }}" >> pr.env
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> pr.env
echo "PR_TITLE=${{ github.event.pull_request.title }}" >> pr.env
echo "NETLIFY_SITE_PREFIX=${{ env.NETLIFY_SITE_PREFIX }}" >> pr.env
echo "BUILD_DIR=${{ env.BUILD_DIR }}" >> pr.env

{
echo "PR_HEADSHA=${{ github.event.pull_request.head.sha }}"
echo "PR_NUMBER=${{ github.event.pull_request.number }}"
echo "PR_TITLE=${{ github.event.pull_request.title }}"
echo "NETLIFY_SITE_PREFIX=${{ env.NETLIFY_SITE_PREFIX }}"
echo "BUILD_DIR=${{ env.BUILD_DIR }}"
} >> pr.env
Comment thread
georglauterbach marked this conversation as resolved.
tar --zstd -cf artifact.tar.zst pr.env ${{ env.BUILD_DIR }}

- name: 'Upload artifact for workflow transfer'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/handle_stalled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
- a maintainer removes the `meta/stale` label or adds the `stale-bot/ignore` label
- new activity occurs, such as a new comment
close-pr-label: "meta/closed due to age or inactivity"
closed-pr-message: >
close-pr-message: >
This PR was closed due to inactivity.
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
make shellcheck
env:
SHELLCHECK_VERSION: 0.7.2
SHELLCHECK_VERSION: 0.8.0

- name: ECLint
run: |
Expand Down
1 change: 1 addition & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ LBLUE="\e[94m"
RESET="\e[0m"

set -euEo pipefail
shopt -s inherit_errexit
trap '__err "${BASH_SOURCE}" "${FUNCNAME[0]:-?}" "${BASH_COMMAND:-?}" "${LINENO:-?}" "${?:-?}"' ERR

function __err
Expand Down
2 changes: 1 addition & 1 deletion target/bin/listmailuser
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

function dovecot_quota_to_hr()
{
if [ "${1}" == "-" ]
if [[ ${1} == "-" ]]
then
echo "~"
else
Expand Down
3 changes: 2 additions & 1 deletion target/bin/setquota
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ fi
create_lock # Protect config file with lock to avoid race conditions

touch "${DATABASE}"
if [ -z "${QUOTA}" ]; then
if [[ -z ${QUOTA} ]]
then
read -r -s "Enter quota (e.g. 10M): " QUOTA
echo
[[ -z "${QUOTA}" ]] && errex "Quota must not be empty. Use 0 for unlimited quota"
Expand Down
2 changes: 1 addition & 1 deletion target/scripts/check-for-changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ do
# 0 – files are identical
# 1 – files differ
# 2 – inaccessible or missing argument
if [ $? -eq 1 ]
if [[ ${?} -eq 1 ]]
then
_notify 'inf' "$(_log_date) Change detected"
create_lock # Shared config safety lock
Expand Down
2 changes: 1 addition & 1 deletion target/scripts/helpers/relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _populate_relayhost_map
# note: won't detect domains when lhs has spaces (but who does that?!)
sed -n '/^\s*[^#[:space:]]/ s/^[^@|]*@\([^|]\+\)|.*$/\1/p' /tmp/docker-mailserver/postfix-accounts.cf

[ -f /tmp/docker-mailserver/postfix-virtual.cf ] && sed -n '/^\s*[^#[:space:]]/ s/^\s*[^@[:space:]]*@\(\S\+\)\s.*/\1/p' /tmp/docker-mailserver/postfix-virtual.cf
[[ -f /tmp/docker-mailserver/postfix-virtual.cf ]] && sed -n '/^\s*[^#[:space:]]/ s/^\s*[^@[:space:]]*@\(\S\+\)\s.*/\1/p' /tmp/docker-mailserver/postfix-virtual.cf
} | while read -r DOMAIN
do
# DOMAIN not already present *and* not ignored
Expand Down
8 changes: 6 additions & 2 deletions test/linting/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ fi
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
REPO_ROOT="$(realpath "${SCRIPT_DIR}"/../../)"

HADOLINT_VERSION=2.4.1
HADOLINT_VERSION=2.8.0
ECLINT_VERSION=2.3.5
SHELLCHECK_VERSION=0.7.2
SHELLCHECK_VERSION=0.8.0

set -eEuo pipefail
shopt -s inherit_errexit
trap '__log_err "${FUNCNAME[0]:-?}" "${BASH_COMMAND:-?}" ${LINENO:-?} ${?:-?}' ERR

function __log_err
Expand Down Expand Up @@ -121,6 +122,9 @@ function _shellcheck
--wiki-link-count=50
--enable=all
--exclude=SC2154
--exclude=SC2310
--exclude=SC2311
--exclude=SC2312
--source-path=SCRIPTDIR
"${F_SH} ${F_BIN} ${F_BATS}"
)
Expand Down
2 changes: 1 addition & 1 deletion test/mail_smtponly.bats
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function teardown_file() {
run docker exec mail_smtponly /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/smtp-only.txt"
assert_success
run docker exec mail_smtponly /bin/sh -c 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
[ "${status}" -ge 0 ]
[[ ${status} -ge 0 ]]
}

#
Expand Down
2 changes: 1 addition & 1 deletion test/permit_docker.bats
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ teardown() {
assert_output --partial "250 2.0.0 Ok: queued as "

repeat_until_success_or_timeout 60 run docker exec mail_smtponly_second_network /bin/sh -c 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
[ "${status}" -ge 0 ]
[[ ${status} -ge 0 ]]
}
24 changes: 12 additions & 12 deletions test/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -614,35 +614,35 @@ EOF

run docker exec mail /bin/sh -c "grep '^user3@domain\.tld|' -i /tmp/docker-mailserver/postfix-accounts.cf"
assert_success
[ -n "${output}" ]
[[ -n ${output} ]]
}

@test "checking accounts: auser3 should have been added to /tmp/docker-mailserver/postfix-accounts.cf" {
docker exec mail /bin/sh -c "addmailuser [email protected] mypassword"

run docker exec mail /bin/sh -c "grep '^auser3@domain\.tld|' -i /tmp/docker-mailserver/postfix-accounts.cf"
assert_success
[ -n "${output}" ]
[[ -n ${output} ]]
}

@test "checking accounts: a.ser3 should have been added to /tmp/docker-mailserver/postfix-accounts.cf" {
docker exec mail /bin/sh -c "addmailuser [email protected] mypassword"

run docker exec mail /bin/sh -c "grep '^a\.ser3@domain\.tld|' -i /tmp/docker-mailserver/postfix-accounts.cf"
assert_success
[ -n "${output}" ]
[[ -n ${output} ]]
}

@test "checking accounts: user3 should have been removed from /tmp/docker-mailserver/postfix-accounts.cf but not auser3" {
docker exec mail /bin/sh -c "delmailuser -y [email protected]"

run docker exec mail /bin/sh -c "grep '^user3@domain\.tld' -i /tmp/docker-mailserver/postfix-accounts.cf"
assert_failure
[ -z "${output}" ]
[[ -z ${output} ]]

run docker exec mail /bin/sh -c "grep '^auser3@domain\.tld' -i /tmp/docker-mailserver/postfix-accounts.cf"
assert_success
[ -n "${output}" ]
[[ -n ${output} ]]
}

@test "checking user updating password for user in /tmp/docker-mailserver/postfix-accounts.cf" {
Expand All @@ -654,7 +654,7 @@ EOF
sleep 2
changepass=$(docker exec mail /bin/sh -c "grep '^user4@domain\.tld' -i /tmp/docker-mailserver/postfix-accounts.cf")

[ "${initialpass}" != "${changepass}" ]
[[ ${initialpass} != "${changepass}" ]]

docker exec mail /bin/sh -c "delmailuser -y [email protected]"

Expand All @@ -678,7 +678,7 @@ EOF
-v "$(duplicate_config_for_container without-accounts/ without-accounts-deleting-user)":/tmp/docker-mailserver/ \
"${IMAGE_NAME:?}" /bin/sh -c 'delmailuser -y [email protected]'
assert_success
[ -z "${output}" ]
[[ -z ${output} ]]
}

@test "checking accounts: user3 should have been added to /tmp/docker-mailserver/postfix-accounts.cf even when that file does not exist" {
Expand All @@ -692,7 +692,7 @@ EOF
-v "${PRIVATE_CONFIG}/without-accounts/":/tmp/docker-mailserver/ \
"${IMAGE_NAME:?}" /bin/sh -c 'grep [email protected] -i /tmp/docker-mailserver/postfix-accounts.cf'
assert_success
[ -n "${output}" ]
[[ -n ${output} ]]
}


Expand Down Expand Up @@ -956,7 +956,7 @@ EOF
assert_success

value=$(grep [email protected] "$(private_config_path mail)/postfix-accounts.cf" | awk -F '|' '{print $1}')
[ "${value}" = "[email protected]" ]
[[ ${value} == "[email protected]" ]]
assert_success

wait_for_changes_to_be_detected_in_container mail
Expand All @@ -979,15 +979,15 @@ EOF
assert_success

initialpass=$(grep [email protected] "$(private_config_path mail)/postfix-accounts.cf" | awk -F '|' '{print $2}')
[ "${initialpass}" != "" ]
[[ ${initialpass} != "" ]]
assert_success

run ./setup.sh -c mail email update [email protected] my password
assert_success

updatepass=$(grep [email protected] "$(private_config_path mail)/postfix-accounts.cf" | awk -F '|' '{print $2}')
[ "${updatepass}" != "" ]
[ "${initialpass}" != "${updatepass}" ]
[[ ${updatepass} != "" ]]
[[ ${initialpass} != "${updatepass}" ]]

docker exec mail doveadm pw -t "${updatepass}" -p 'my password' | grep 'verified'
assert_success
Expand Down