From acfdc072722013104621baaee3e9fdc651f70345 Mon Sep 17 00:00:00 2001 From: Nazarii Sliusarchuk Date: Sat, 29 Mar 2025 00:25:37 +0200 Subject: [PATCH 1/6] debugging ubuntu build --- k8dev.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/k8dev.sh b/k8dev.sh index e69067b..4903554 100755 --- a/k8dev.sh +++ b/k8dev.sh @@ -86,37 +86,36 @@ 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 + # Check if Chart.lock exists and get its timestamp 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..." + last_update=$(stat -f %m "${chart_lock}" 2>/dev/null || stat -c %Y "${chart_lock}") + output info "last_update: ${last_update}" + + current_time=$(date +%s) + output info "current_time: ${current_time}" + + if [[ -z "${last_update}" ]] || [[ -z "${current_time}" ]]; then + output error "Failed to get timestamps" + fi + + 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 "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 @@ -129,6 +128,10 @@ handle_dependencies() { infra_install() { output info "🪁 K8dev Starting installation..." + # Debug output + output info "CHART_DIR is: ${CHART_DIR}" + [[ -d "${CHART_DIR}" ]] && output info "Chart directory exists" || output error "Chart directory not found" + [[ -f "${CHART_DIR}/Chart.yaml" ]] && output info "Chart.yaml exists" || output error "Chart.yaml not found" handle_dependencies true From 6db7363f733c0d2181676be5545eec859aa13254 Mon Sep 17 00:00:00 2001 From: Nazarii Sliusarchuk Date: Sat, 29 Mar 2025 00:34:51 +0200 Subject: [PATCH 2/6] debugging ubuntu build --- k8dev.sh | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/k8dev.sh b/k8dev.sh index 4903554..1fe9951 100755 --- a/k8dev.sh +++ b/k8dev.sh @@ -92,16 +92,8 @@ handle_dependencies() { # Check if Chart.lock exists and get its timestamp if [[ -f "${chart_lock}" ]]; then - last_update=$(stat -f %m "${chart_lock}" 2>/dev/null || stat -c %Y "${chart_lock}") - output info "last_update: ${last_update}" - + last_update=$(stat -f %m "${chart_lock}" 2>/dev/null || stat --format=%Y "${chart_lock}") current_time=$(date +%s) - output info "current_time: ${current_time}" - - if [[ -z "${last_update}" ]] || [[ -z "${current_time}" ]]; then - output error "Failed to get timestamps" - fi - time_diff=$((current_time - last_update)) if [[ "$force_update" == "true" ]] || [[ $time_diff -gt 86400 ]]; then @@ -128,10 +120,6 @@ handle_dependencies() { infra_install() { output info "🪁 K8dev Starting installation..." - # Debug output - output info "CHART_DIR is: ${CHART_DIR}" - [[ -d "${CHART_DIR}" ]] && output info "Chart directory exists" || output error "Chart directory not found" - [[ -f "${CHART_DIR}/Chart.yaml" ]] && output info "Chart.yaml exists" || output error "Chart.yaml not found" handle_dependencies true From 0bc4d2234e33067803a07a3cc1767233d7eb951b Mon Sep 17 00:00:00 2001 From: Nazarii Sliusarchuk Date: Sat, 29 Mar 2025 00:40:57 +0200 Subject: [PATCH 3/6] debugging ubuntu build --- k8dev.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/k8dev.sh b/k8dev.sh index 1fe9951..e13c40e 100755 --- a/k8dev.sh +++ b/k8dev.sh @@ -94,6 +94,7 @@ handle_dependencies() { if [[ -f "${chart_lock}" ]]; then last_update=$(stat -f %m "${chart_lock}" 2>/dev/null || stat --format=%Y "${chart_lock}") current_time=$(date +%s) + output info "timestamps: ${last_update} & ${current_time}" time_diff=$((current_time - last_update)) if [[ "$force_update" == "true" ]] || [[ $time_diff -gt 86400 ]]; then From 51ee95dedded3fdb7586167dda8d98f974665832 Mon Sep 17 00:00:00 2001 From: Nazarii Sliusarchuk Date: Sat, 29 Mar 2025 00:51:10 +0200 Subject: [PATCH 4/6] debugging ubuntu build --- k8dev.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/k8dev.sh b/k8dev.sh index e13c40e..3bc29ec 100755 --- a/k8dev.sh +++ b/k8dev.sh @@ -86,18 +86,9 @@ handle_dependencies() { local force_update=${1:-false} local chart_lock="${CHART_DIR}/Chart.lock" local chart_yaml="${CHART_DIR}/Chart.yaml" - local last_update - local current_time - local time_diff - # Check if Chart.lock exists and get its timestamp if [[ -f "${chart_lock}" ]]; then - last_update=$(stat -f %m "${chart_lock}" 2>/dev/null || stat --format=%Y "${chart_lock}") - current_time=$(date +%s) - output info "timestamps: ${last_update} & ${current_time}" - time_diff=$((current_time - last_update)) - - if [[ "$force_update" == "true" ]] || [[ $time_diff -gt 86400 ]]; then + 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 From 69b7cf249d544025045115f2db52b98dc38478e0 Mon Sep 17 00:00:00 2001 From: Nazarii Sliusarchuk Date: Sat, 29 Mar 2025 01:02:48 +0200 Subject: [PATCH 5/6] debugging ubuntu build --- .github/workflows/makefile.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 51891d5..9ebbbb7 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -62,8 +62,7 @@ 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 From dc56688c243c531e9131ff8fec26637f6846d62b Mon Sep 17 00:00:00 2001 From: Nazarii Sliusarchuk Date: Sat, 29 Mar 2025 01:09:22 +0200 Subject: [PATCH 6/6] debugging ubuntu build --- .github/workflows/makefile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 9ebbbb7..6b48893 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -66,7 +66,7 @@ jobs: 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()