From 936040afae7865a96ac8b3557bb8a2317977b293 Mon Sep 17 00:00:00 2001 From: Stephen Kirby Date: Fri, 22 Sep 2023 19:59:02 +0000 Subject: [PATCH] testing simple coder script --- .icons/git.svg | 1 + git-config/README.md | 12 ++++++++++++ git-config/main.tf | 29 +++++++++++++++++++++++++++++ git-config/run.sh | 8 ++++++++ 4 files changed, 50 insertions(+) create mode 100644 .icons/git.svg create mode 100644 git-config/README.md create mode 100644 git-config/main.tf create mode 100644 git-config/run.sh diff --git a/.icons/git.svg b/.icons/git.svg new file mode 100644 index 0000000..5bf444b --- /dev/null +++ b/.icons/git.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/git-config/README.md b/git-config/README.md new file mode 100644 index 0000000..0827ff5 --- /dev/null +++ b/git-config/README.md @@ -0,0 +1,12 @@ +--- +display_name: Git Config +description: Stores Git configuration from Coder credentials +icon: ../.icons/git.svg +maintainer_github: coder +verified: true +tags: [helper] +--- + +# git-config + +Runs a script that checks for stored Git credentials, populating them with coder credentials when missing. \ No newline at end of file diff --git a/git-config/main.tf b/git-config/main.tf new file mode 100644 index 0000000..9a63f6b --- /dev/null +++ b/git-config/main.tf @@ -0,0 +1,29 @@ +terraform { + required_version = ">= 1.0" + + required_providers { + coder = { + source = "coder/coder" + version = ">= 0.12" + } + } +} + +variable "agent_id" { + type = string + description = "The ID of a Coder agent." +} + +# variable "path" { +# type = string +# description = "The path to a script that will be ran on start enabling a user to personalize their workspace." +# default = "~/personalize" +# } + +resource "coder_script" "personalize" { + agent_id = var.agent_id + script = templatefile("${path.module}/run.sh") + display_name = "Git Config" + icon = "/emojis/1f58c.png" # TODO: test if the local git icon works + run_on_start = true +} diff --git a/git-config/run.sh b/git-config/run.sh new file mode 100644 index 0000000..d14a8cb --- /dev/null +++ b/git-config/run.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + + +BOLD='\033[0;1m' +CODE='\033[36;40;1m' +RESET='\033[0m' + +printf "✨ $${BOLD}Running git config script!\n\n"