From c95843df8d160cfb025eaf7bea542ba525d90927 Mon Sep 17 00:00:00 2001 From: Charles Augello Date: Fri, 24 Jan 2025 14:56:28 -0500 Subject: [PATCH 1/5] Bubble up failures in dotfiles installation Currently, if the dotfiles installation (`coder dotfiles ...`) fails, the script still shows as successful in the Coder UI. --- dotfiles/run.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dotfiles/run.sh b/dotfiles/run.sh index 94634392..2f212dba 100644 --- a/dotfiles/run.sh +++ b/dotfiles/run.sh @@ -20,4 +20,7 @@ if [ -n "$${DOTFILES_URI// }" ]; then DOTFILES_USER_HOME=$(eval echo ~"$DOTFILES_USER") sudo -u "$DOTFILES_USER" sh -c "'$CODER_BIN' dotfiles '$DOTFILES_URI' -y 2>&1 | tee '$DOTFILES_USER_HOME'/.dotfiles.log" fi + if [ $? -ne 0 ]; then + echo "Failed to install dotfiles" + exit 1 fi From e86861d2eb2d5552e05e9232781e4a8486d9a074 Mon Sep 17 00:00:00 2001 From: Charles Augello Date: Mon, 27 Jan 2025 08:54:24 -0500 Subject: [PATCH 2/5] add missing fi --- dotfiles/run.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dotfiles/run.sh b/dotfiles/run.sh index 2f212dba..6ecd1db0 100644 --- a/dotfiles/run.sh +++ b/dotfiles/run.sh @@ -22,5 +22,6 @@ if [ -n "$${DOTFILES_URI// }" ]; then fi if [ $? -ne 0 ]; then echo "Failed to install dotfiles" - exit 1 + exit 1 + fi fi From 7f7d154156c82042839cd1d2fa9e673edcf06897 Mon Sep 17 00:00:00 2001 From: Charles Augello Date: Mon, 27 Jan 2025 14:08:24 -0500 Subject: [PATCH 3/5] bump readme via update-versions.sh --- dotfiles/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dotfiles/README.md b/dotfiles/README.md index fb54bab7..fc8fc11b 100644 --- a/dotfiles/README.md +++ b/dotfiles/README.md @@ -19,7 +19,7 @@ Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/ module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.18" + version = "1.0.28" agent_id = coder_agent.example.id } ``` @@ -32,7 +32,7 @@ module "dotfiles" { module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.18" + version = "1.0.28" agent_id = coder_agent.example.id } ``` @@ -43,7 +43,7 @@ module "dotfiles" { module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.18" + version = "1.0.28" agent_id = coder_agent.example.id user = "root" } @@ -55,14 +55,14 @@ module "dotfiles" { module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.18" + version = "1.0.28" agent_id = coder_agent.example.id } module "dotfiles-root" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.18" + version = "1.0.28" agent_id = coder_agent.example.id user = "root" dotfiles_uri = module.dotfiles.dotfiles_uri @@ -77,7 +77,7 @@ You can set a default dotfiles repository for all users by setting the `default_ module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.18" + version = "1.0.28" agent_id = coder_agent.example.id default_dotfiles_uri = "https://github.com/coder/dotfiles" } From 8471ea72cc39f8f5c078c231475014f4b3ce3d5b Mon Sep 17 00:00:00 2001 From: Charles Augello Date: Wed, 29 Jan 2025 22:24:13 -0500 Subject: [PATCH 4/5] set shell options to exit on error --- dotfiles/run.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dotfiles/run.sh b/dotfiles/run.sh index 6ecd1db0..e0599418 100644 --- a/dotfiles/run.sh +++ b/dotfiles/run.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash + +set -euo pipefail + DOTFILES_URI="${DOTFILES_URI}" DOTFILES_USER="${DOTFILES_USER}" @@ -20,8 +23,4 @@ if [ -n "$${DOTFILES_URI// }" ]; then DOTFILES_USER_HOME=$(eval echo ~"$DOTFILES_USER") sudo -u "$DOTFILES_USER" sh -c "'$CODER_BIN' dotfiles '$DOTFILES_URI' -y 2>&1 | tee '$DOTFILES_USER_HOME'/.dotfiles.log" fi - if [ $? -ne 0 ]; then - echo "Failed to install dotfiles" - exit 1 - fi fi From 2cfc72d086e1f499bdfd47ada1c76a400bec1b1d Mon Sep 17 00:00:00 2001 From: Charles Augello Date: Thu, 30 Jan 2025 06:36:38 -0500 Subject: [PATCH 5/5] bump readme via updadte_version.sh --- dotfiles/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dotfiles/README.md b/dotfiles/README.md index fc8fc11b..4a911f87 100644 --- a/dotfiles/README.md +++ b/dotfiles/README.md @@ -19,7 +19,7 @@ Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/ module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.28" + version = "1.0.29" agent_id = coder_agent.example.id } ``` @@ -32,7 +32,7 @@ module "dotfiles" { module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.28" + version = "1.0.29" agent_id = coder_agent.example.id } ``` @@ -43,7 +43,7 @@ module "dotfiles" { module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.28" + version = "1.0.29" agent_id = coder_agent.example.id user = "root" } @@ -55,14 +55,14 @@ module "dotfiles" { module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.28" + version = "1.0.29" agent_id = coder_agent.example.id } module "dotfiles-root" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.28" + version = "1.0.29" agent_id = coder_agent.example.id user = "root" dotfiles_uri = module.dotfiles.dotfiles_uri @@ -77,7 +77,7 @@ You can set a default dotfiles repository for all users by setting the `default_ module "dotfiles" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/dotfiles/coder" - version = "1.0.28" + version = "1.0.29" agent_id = coder_agent.example.id default_dotfiles_uri = "https://github.com/coder/dotfiles" }