diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 51891d5..6b48893 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -62,12 +62,11 @@ jobs: kubectl describe pods -n k8dev-system -l app.kubernetes.io/name=ingress-nginx-controller exit 1 } - - k8dev install + k8dev create www.domain.dev k8dev start www.domain.dev k8dev stop www.domain.dev - k8dev uninstall + echo "yes" | k8dev uninstall - name: Cleanup if: always() diff --git a/k8dev.sh b/k8dev.sh index e69067b..3bc29ec 100755 --- a/k8dev.sh +++ b/k8dev.sh @@ -86,37 +86,20 @@ handle_dependencies() { local force_update=${1:-false} local chart_lock="${CHART_DIR}/Chart.lock" local chart_yaml="${CHART_DIR}/Chart.yaml" - local last_update_mac - local last_update_linux - local last_update - local current_time - local time_diff if [[ -f "${chart_lock}" ]]; then - last_update_mac=$(stat -f %m "${chart_lock}" 2>/dev/null) - last_update_linux=$(stat -c %Y "${chart_lock}" 2>/dev/null) - last_update=${last_update_mac:-$last_update_linux} - - if [[ -n "${last_update}" ]]; then - current_time=$(date +%s) - time_diff=$((current_time - last_update)) - - if [[ "$force_update" == "true" ]] || [[ $time_diff -gt 86400 ]]; then - output info "Updating Helm repositories..." - helm repo update || output error "Failed to update Helm repositories" - else - output info "Skipping repository update (less than 24h since last update)" - fi - else - output info "Could not determine Chart.lock timestamp, updating repositories..." + if "$force_update" || find "${chart_lock}" -mtime +0 >/dev/null 2>&1; then + output info "Updating Helm repositories..." helm repo update || output error "Failed to update Helm repositories" + else + output info "Skipping repository update (less than 24h since last update)" fi else output info "No Chart.lock found, updating repositories..." helm repo update || output error "Failed to update Helm repositories" fi - if [ ! -d "${CHART_DIR}/charts" ] || [ ! -f "${chart_lock}" ]; then + if [ ! -d "${CHART_DIR}/charts" ] || [ -z "$(ls -A "${CHART_DIR}/charts" 2>/dev/null)" ] || [ ! -f "${chart_lock}" ]; then output info "Initial dependency build required..." helm dependency build "${CHART_DIR}" || output error "Failed to build dependencies" elif [ "${chart_yaml}" -nt "${chart_lock}" ]; then