-
Notifications
You must be signed in to change notification settings - Fork 899
feat(site): add create template from scratch #12082
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
811872f
Add scratch as starter template
BrunoQuaresma 4c60dcc
Add create from scratch flow
BrunoQuaresma cdb36a8
Don't show scratch template
BrunoQuaresma 2e756c4
Add stories for create template button
BrunoQuaresma 0609511
Test if scratch template is not displayed
BrunoQuaresma f8a6efc
Add test for scratch flow
BrunoQuaresma 9ee2112
Fix typo
BrunoQuaresma 6ff64f4
Update golden files
BrunoQuaresma d9581d0
Fix tests
BrunoQuaresma 7c24744
Fix e2e tests
BrunoQuaresma 914a724
Apply suggestions from code review
BrunoQuaresma 63bd718
Fix format
BrunoQuaresma 8389b33
Only uses coder_script to def scripts
BrunoQuaresma 66c8e78
Fix gen files
BrunoQuaresma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add scratch as starter template
- Loading branch information
commit 811872fb306bf8f8cf7c28df5a14ea9ff75bf787
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
display_name: Scratch | ||
description: A minimal Scaffolding for a Coder Template | ||
icon: ../../../site/static/emojis/1f4e6.png | ||
maintainer_github: coder | ||
verified: true | ||
tags: [] | ||
--- | ||
|
||
# A minimal Scaffolding for a Coder Template | ||
|
||
Use this starter template as a basis to create your own unique template from scratch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
terraform { | ||
required_providers { | ||
coder = { | ||
source = "coder/coder" | ||
} | ||
} | ||
} | ||
|
||
data "coder_provisioner" "me" {} | ||
|
||
data "coder_workspace" "me" {} | ||
|
||
resource "coder_agent" "main" { | ||
arch = data.coder_provisioner.me.arch | ||
os = data.coder_provisioner.me.os | ||
startup_script_timeout = 180 | ||
BrunoQuaresma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
startup_script = <<-EOT | ||
set -e | ||
# Run programs at workspace startup | ||
EOT | ||
BrunoQuaresma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
metadata { | ||
display_name = "CPU Usage" | ||
key = "0_cpu_usage" | ||
script = "coder stat cpu" | ||
interval = 10 | ||
timeout = 1 | ||
} | ||
|
||
metadata { | ||
display_name = "RAM Usage" | ||
key = "1_ram_usage" | ||
script = "coder stat mem" | ||
interval = 10 | ||
timeout = 1 | ||
} | ||
} | ||
|
||
# Use this to set environment variables in your workspace | ||
# details: https://registry.terraform.io/providers/coder/coder/latest/docs/resources/env | ||
resource "coder_env" "my_env" { | ||
agent_id = coder_agent.main.id | ||
name = "FOO" | ||
value = "bar" | ||
} | ||
BrunoQuaresma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Adds code-server | ||
# See all available modules at https://regsitry.coder.com | ||
module "code-server" { | ||
source = "registry.coder.com/modules/code-server/coder" | ||
version = "1.0.2" | ||
agent_id = coder_agent.main.id | ||
} | ||
|
||
# Runs a script at workspace start/stop or on a cron schedule | ||
# details: https://registry.terraform.io/providers/coder/coder/latest/docs/resources/script | ||
resource "coder_script" "my_script" { | ||
BrunoQuaresma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
agent_id = coder_agent.main.id | ||
display_name = "My Script" | ||
run_on_start = true | ||
script = <<-EOF | ||
echo "Hello ${data.coder_workspace.me.owner}!" | ||
EOF | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.