wip: move scripts to agentapi module
This commit is contained in:
parent
fde6ae6dc1
commit
c1a3ed53a9
@ -226,41 +226,41 @@ module "agent-helper" {
|
|||||||
start_script = var.start_script
|
start_script = var.start_script
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "coder_script" "agentapi" {
|
# resource "coder_script" "agentapi" {
|
||||||
count = var.enable_agentapi ? 1 : 0
|
# count = var.enable_agentapi ? 1 : 0
|
||||||
agent_id = var.agent_id
|
# agent_id = var.agent_id
|
||||||
display_name = "Start AgentAPI"
|
# display_name = "Start AgentAPI"
|
||||||
icon = var.web_app_icon
|
# icon = var.web_app_icon
|
||||||
script = <<-EOT
|
# script = <<-EOT
|
||||||
#!/bin/bash
|
# #!/bin/bash
|
||||||
set -o errexit
|
# set -o errexit
|
||||||
set -o pipefail
|
# set -o pipefail
|
||||||
|
#
|
||||||
# trap 'coder exp sync complete ${local.agentapi_main_script_name}' EXIT
|
# # trap 'coder exp sync complete ${local.agentapi_main_script_name}' EXIT
|
||||||
# coder exp sync want ${local.agentapi_main_script_name} ${local.start_script_name}
|
# # coder exp sync want ${local.agentapi_main_script_name} ${local.start_script_name}
|
||||||
# coder exp sync start ${local.agentapi_main_script_name}
|
# # coder exp sync start ${local.agentapi_main_script_name}
|
||||||
|
#
|
||||||
echo -n '${base64encode(local.main_script)}' | base64 -d > /tmp/main.sh
|
# echo -n '${base64encode(local.main_script)}' | base64 -d > /tmp/main.sh
|
||||||
chmod +x /tmp/main.sh
|
# chmod +x /tmp/main.sh
|
||||||
|
#
|
||||||
ARG_MODULE_DIR_NAME='${var.module_dir_name}' \
|
# ARG_MODULE_DIR_NAME='${var.module_dir_name}' \
|
||||||
ARG_WORKDIR="$(echo -n '${base64encode(local.workdir)}' | base64 -d)" \
|
# ARG_WORKDIR="$(echo -n '${base64encode(local.workdir)}' | base64 -d)" \
|
||||||
ARG_INSTALL_AGENTAPI='${var.install_agentapi}' \
|
# ARG_INSTALL_AGENTAPI='${var.install_agentapi}' \
|
||||||
ARG_AGENTAPI_VERSION='${var.agentapi_version}' \
|
# ARG_AGENTAPI_VERSION='${var.agentapi_version}' \
|
||||||
ARG_WAIT_FOR_START_SCRIPT="$(echo -n '${local.agentapi_wait_for_start_script_b64}' | base64 -d)" \
|
# ARG_WAIT_FOR_START_SCRIPT="$(echo -n '${local.agentapi_wait_for_start_script_b64}' | base64 -d)" \
|
||||||
ARG_AGENTAPI_PORT='${var.agentapi_port}' \
|
# ARG_AGENTAPI_PORT='${var.agentapi_port}' \
|
||||||
ARG_AGENTAPI_SERVER_TYPE='${var.agent_name}' \
|
# ARG_AGENTAPI_SERVER_TYPE='${var.agent_name}' \
|
||||||
ARG_AGENTAPI_TERM_WIDTH='${var.agentapi_term_width}' \
|
# ARG_AGENTAPI_TERM_WIDTH='${var.agentapi_term_width}' \
|
||||||
ARG_AGENTAPI_TERM_HEIGHT='${var.agentapi_term_height}' \
|
# ARG_AGENTAPI_TERM_HEIGHT='${var.agentapi_term_height}' \
|
||||||
ARG_AGENTAPI_INITIAL_PROMPT="$(echo -n '${local.encoded_initial_prompt}' | base64 -d)" \
|
# ARG_AGENTAPI_INITIAL_PROMPT="$(echo -n '${local.encoded_initial_prompt}' | base64 -d)" \
|
||||||
ARG_AGENTAPI_CHAT_BASE_PATH='${local.agentapi_chat_base_path}' \
|
# ARG_AGENTAPI_CHAT_BASE_PATH='${local.agentapi_chat_base_path}' \
|
||||||
ARG_TASK_ID='${try(data.coder_task.me.id, "")}' \
|
# ARG_TASK_ID='${try(data.coder_task.me.id, "")}' \
|
||||||
ARG_TASK_LOG_SNAPSHOT='${var.task_log_snapshot}' \
|
# ARG_TASK_LOG_SNAPSHOT='${var.task_log_snapshot}' \
|
||||||
/tmp/main.sh
|
# /tmp/main.sh
|
||||||
EOT
|
# EOT
|
||||||
run_on_start = true
|
# run_on_start = true
|
||||||
depends_on = [module.agent-helper]
|
# depends_on = [module.agent-helper]
|
||||||
}
|
# }
|
||||||
|
|
||||||
resource "coder_script" "agentapi_shutdown" {
|
resource "coder_script" "agentapi_shutdown" {
|
||||||
count = var.enable_agentapi ? 1 : 0
|
count = var.enable_agentapi ? 1 : 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user