Skip to content

Commit 0cfa1b6

Browse files
committed
refactor(scripts): Phase 4 β€” reorganize into functional subdirectories
Scripts categorized into: scripts/system/ (health-check, process-monitor-alert, system-monitoring, system-resource-monitor, system-resource-reporter) scripts/backup/ (backup, log-file-cleanup, log-rotation, rotate-old-files, rsync-backup, scp-remote-backup) scripts/monitoring/ (account-expiry-notify, check-ssl-expiry, disk-usage-monitor, http-status, monitor-open-ports) scripts/ci-cd/ (auto-deployment, gc-cleanup, jenkins-job, sonarqube-slack-notify) scripts/kubernetes/ (argo-cd-sync, kubectl-namespace-cleanup, scale-deployment) scripts/devops/ (docker-log-monitor, git-repo-stats, grafana-metrics, package-updates, splunk-search) scripts/notifications/ (create-confluence-page, log-monitor, slack-notify) scripts/utils/ (random-password-generator, restart-containers, user-account-management) Tests mirror the script structure in tests/<category>/. Changes: - Updated utils.sh source path: ../lib/utils.sh β†’ ../../lib/utils.sh (wait no) actually: ${SCRIPT_DIR}/lib β†’ ${SCRIPT_DIR}/../lib in all 34 scripts - Updated BATS load paths to use ${BATS_TEST_DIRNAME}/../test_helper/ - Updated BATS SCRIPT_PATH to use ../../scripts/<category>/ - Updated CI to use find-based test discovery (excludes test_helper/) - Deleted obsolete password-generator.bats (superseded by utils/ version) Test result: 196/196 pass, exit 0
1 parent 759ff5a commit 0cfa1b6

70 files changed

Lines changed: 138 additions & 165 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ jobs:
4141
run: brew install bats-core
4242

4343
- name: Run BATS test suite
44-
run: bats tests/*.bats
44+
run: |
45+
find tests -name '*.bats' -not -path '*/test_helper/*' | sort | xargs bats
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
BACKUP_DIR="${BACKUP_DIR:-/var/backups}"
1010
BACKUP_FILES="${BACKUP_FILES:-/etc /var/www /home /var/lib /var/mail /opt}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
LOG_DIR="${LOG_DIR:-/var/log}"
1010
MAX_DAYS="${MAX_DAYS:-30}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
LOG_FILE="${LOG_FILE:-/var/log/app.log}"
1010
MAX_SIZE_MB="${MAX_SIZE_MB:-100}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
SOURCE_DIR="${SOURCE_DIR:-/opt/app/data}"
1010
ARCHIVE_DIR="${ARCHIVE_DIR:-/opt/app/archive}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
SOURCE_DIR="${SOURCE_DIR:-}"
1010
REMOTE_DEST="${REMOTE_DEST:-}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
SOURCE_DIR="${SOURCE_DIR:-}"
1010
REMOTE_HOST="${REMOTE_HOST:-}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
REPO_DIR="${REPO_DIR:-/path/to/repo}"
1010
SERVICE="${SERVICE:-myapp}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
REPO_DIR="${1:-.}"
1010
EXPIRY_DAYS=30
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -euo pipefail
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "${SCRIPT_DIR}/lib/utils.sh"
7+
source "${SCRIPT_DIR}/../lib/utils.sh"
88

99
JENKINS_URL="${JENKINS_URL:-http://localhost:8080}"
1010
JOB_NAME="${JOB_NAME:-}"

0 commit comments

Comments
Β (0)