-
Notifications
You must be signed in to change notification settings - Fork 157
feat(nodejs): add pre and post install scripts using coder-utils #802
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
Open
blinkagent
wants to merge
13
commits into
main
Choose a base branch
from
feat/nodejs-pre-post-install-scripts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+186
−17
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
79cef2e
feat(nodejs): add pre and post install scripts with coder exp sync su…
blink-so[bot] 8bd24f8
simplify: just add pre/post install script variables inline in run.sh
blink-so[bot] acdbd57
fix: align terraform blocks to pass prettier formatting
blink-so[bot] 872fdbc
fix: bump version to 1.1.0 (minor) for new input variables
blink-so[bot] d0ef879
revert: restore unrelated comment in main.test.ts
blink-so[bot] 817238e
refactor(nodejs): use base64 encoding and coder exp sync for pre/post…
blink-so[bot] 0fd0d08
fix: terraform fmt alignment in coder_script.nodejs resource
blink-so[bot] 11a64e9
Merge branch 'main' into feat/nodejs-pre-post-install-scripts
DevelopmentCats 8ee6f2f
refactor(registry/thezoker/modules/nodejs): orchestrate pre/post inst…
35C4n0r b30476e
docs(registry/thezoker/modules/nodejs): source nvm in post_install_sc…
35C4n0r 0cf5aac
Merge branch 'main' into feat/nodejs-pre-post-install-scripts
matifali 353e0d6
docs(registry/thezoker/modules/nodejs): use a valid relative nvm_inst…
35C4n0r 25370de
docs(registry/thezoker/modules/nodejs): use valid node and nvm versio…
35C4n0r 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
There are no files selected for viewing
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,115 @@ | ||
| run "test_nodejs_basic" { | ||
| command = plan | ||
|
|
||
| variables { | ||
| agent_id = "test-agent-123" | ||
| } | ||
|
|
||
| assert { | ||
| condition = var.agent_id == "test-agent-123" | ||
| error_message = "Agent ID variable should be set correctly" | ||
| } | ||
|
|
||
| assert { | ||
| condition = var.nvm_version == "master" | ||
| error_message = "nvm_version should default to master" | ||
| } | ||
|
|
||
| assert { | ||
| condition = var.default_node_version == "node" | ||
| error_message = "default_node_version should default to node" | ||
| } | ||
|
|
||
| assert { | ||
| condition = var.pre_install_script == null | ||
| error_message = "pre_install_script should default to null" | ||
| } | ||
|
|
||
| assert { | ||
| condition = var.post_install_script == null | ||
| error_message = "post_install_script should default to null" | ||
| } | ||
| } | ||
|
|
||
| run "test_custom_options" { | ||
| command = plan | ||
|
|
||
| variables { | ||
| agent_id = "test-agent-custom" | ||
| nvm_version = "v0.39.7" | ||
| nvm_install_prefix = ".custom-nvm" | ||
| node_versions = ["18", "20", "node"] | ||
| default_node_version = "20" | ||
| } | ||
|
|
||
| assert { | ||
| condition = var.nvm_version == "v0.39.7" | ||
| error_message = "nvm_version should be set to v0.39.7" | ||
| } | ||
|
|
||
| assert { | ||
| condition = length(var.node_versions) == 3 | ||
| error_message = "node_versions should have 3 entries" | ||
| } | ||
|
|
||
| assert { | ||
| condition = strcontains(local.install_script, "v0.39.7") | ||
| error_message = "install script should embed the configured nvm_version" | ||
| } | ||
| } | ||
|
|
||
| run "test_script_outputs_install_only" { | ||
| command = plan | ||
|
|
||
| variables { | ||
| agent_id = "test-agent-outputs" | ||
| } | ||
|
|
||
| assert { | ||
| condition = length(output.scripts) == 1 && output.scripts[0] == "thezoker-nodejs-install_script" | ||
| error_message = "scripts output should list only the install script when pre/post are not configured" | ||
| } | ||
| } | ||
|
|
||
| run "test_script_outputs_with_pre_and_post" { | ||
| command = plan | ||
|
|
||
| variables { | ||
| agent_id = "test-agent-outputs-all" | ||
| pre_install_script = "echo 'Pre-install script'" | ||
| post_install_script = "echo 'Post-install script'" | ||
| } | ||
|
|
||
| assert { | ||
| condition = output.scripts == ["thezoker-nodejs-pre_install_script", "thezoker-nodejs-install_script", "thezoker-nodejs-post_install_script"] | ||
| error_message = "scripts output should list pre_install, install, post_install in run order" | ||
| } | ||
| } | ||
|
|
||
| run "test_script_outputs_with_pre_install_only" { | ||
| command = plan | ||
|
|
||
| variables { | ||
| agent_id = "test-agent-pre" | ||
| pre_install_script = "echo 'pre-install'" | ||
| } | ||
|
|
||
| assert { | ||
| condition = output.scripts == ["thezoker-nodejs-pre_install_script", "thezoker-nodejs-install_script"] | ||
| error_message = "scripts output should list pre_install then install when only pre is configured" | ||
| } | ||
| } | ||
|
|
||
| run "test_script_outputs_with_post_install_only" { | ||
| command = plan | ||
|
|
||
| variables { | ||
| agent_id = "test-agent-post" | ||
| post_install_script = "echo 'post-install'" | ||
| } | ||
|
|
||
| assert { | ||
| condition = output.scripts == ["thezoker-nodejs-install_script", "thezoker-nodejs-post_install_script"] | ||
| error_message = "scripts output should list install then post_install when only post is configured" | ||
| } | ||
| } |
Oops, something went wrong.
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.