-
Notifications
You must be signed in to change notification settings - Fork 894
refactor: conditionally use dotfiles in dogfood template #5332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
a8af6e0
3fbe100
6f79f9d
97558ea
78541c5
d6d3724
ee48416
7827fd7
1d9254f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,6 +11,17 @@ terraform { | |||||
} | ||||||
} | ||||||
|
||||||
# User parameters | ||||||
|
||||||
variable "dotfiles_uri" { | ||||||
description = <<-EOF | ||||||
Dotfiles repo URI (optional) | ||||||
|
||||||
see https://dotfiles.github.io | ||||||
EOF | ||||||
default = "" | ||||||
} | ||||||
|
||||||
# Admin parameters | ||||||
|
||||||
provider "docker" { | ||||||
|
@@ -34,6 +45,7 @@ resource "coder_agent" "dev" { | |||||
code-server --auth none --port 13337 & | ||||||
sudo service docker start | ||||||
coder dotfiles -y 2>&1 | tee ~/.personalize.log | ||||||
jsjoeio marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
"if [ -n ${var.dotfiles_uri} ]; then coder dotfiles var.dotfiles_uri -y 2>&1 | tee ~/.personalize.log; fi" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsure if this is the exact way to do this interpolation within the Bash script. Smoke-tested locally using Ref: Conditionals There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need to quote the variable in order for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mafredri Shouldn't we have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mtojek Since we're supporting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay found this and these are called Heredoc strings Now I'm second guessing it. Is this what it should be?
Suggested change
Not sure if the quotes will stay so could be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jsjoeio I think a great way to deal with variables is to assign them to a shell variable in the scripts, like this: DOTFILES_URI=${var.dotfiles_uri}
if [ -n "$DOTFILES_URI" ]; then
# ...
fi This way escaping the value becomes a non-issue because the assignment supports basically any input. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Genius! I'll see if I can wrap this up at the end of the day! |
||||||
EOF | ||||||
} | ||||||
|
||||||
|
Uh oh!
There was an error while loading. Please reload this page.