finalized functionality of git-config, needs tests

pull/47/head
Stephen Kirby 2 years ago
parent ab0ddeeaf7
commit 89e0766f9e

@ -11,13 +11,15 @@ describe("git-config", async () => {
testRequiredVariables(import.meta.dir, {
agent_id: "foo",
allow_username_change: true,
allow_email_change: true,
});
it("fails without git", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
allow_username_change: false,
allow_email_change: false,
allow_username_change: true,
allow_email_change: true,
});
const output = await executeScriptInContainer(state, "alpine");
expect(output.exitCode).toBe(1);
@ -30,6 +32,8 @@ describe("git-config", async () => {
it("runs with git", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
allow_username_change: true,
allow_email_change: true,
});
const output = await executeScriptInContainer(state, "alpine/git");
expect(output.exitCode).toBe(0);

@ -17,7 +17,7 @@ variable "agent_id" {
variable "allow_username_change" {
type = bool
description = "Allow developers to change their git username."
default = false
default = true
}
variable "allow_email_change" {
@ -33,8 +33,8 @@ data "coder_parameter" "user_email" {
count = var.allow_email_change ? 1 : 0
name = "user_email"
type = "string"
default = "" #var.default_email_source
description = "Git user.email to be used for commits"
default = ""
description = "Git user.email to be used for commits. Leave empty to default to Coder username."
display_name = "Git config user.email"
mutable = true
}
@ -44,7 +44,7 @@ data "coder_parameter" "username" {
name = "username"
type = "string"
default = ""
description = "Git user.name to be used for commits"
description = "Git user.name to be used for commits. Leave empty to default to Coder username."
display_name = "Git config user.name"
mutable = true
}

@ -20,5 +20,5 @@ if [ -z $(git config --get user.name) ]; then
git config --global user.name "${GIT_USERNAME}"
fi
printf "$${BOLD}git-config: using email: $(git config --get user.email)\n"
printf "\n$${BOLD}git-config: using username: $(git config --get user.name)\n\n"
printf "\n$${BOLD}git-config: using email: $(git config --get user.email)\n"
printf "$${BOLD}git-config: using username: $(git config --get user.name)\n\n"

Loading…
Cancel
Save