Skip to content

Commit dc39170

Browse files
committed
feat: b64encode inputs to script
1 parent f4fe7c4 commit dc39170

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

registry/coder-labs/modules/gemini/main.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,30 +74,26 @@ describe("gemini", async () => {
7474
const { id } = await setup();
7575
await execModuleScript(id);
7676
await expectAgentAPIStarted(id);
77-
// const resp = await readFileContainer(id, "/home/coder/.gemini-module/install.log");
78-
// console.error("\n\n\nINSTALL_LOG => ", resp, "\n\n\n")
79-
//
80-
// const resp2 = await readFileContainer(id, "/home/coder/.gemini-module/agentapi-start.log");
81-
// console.error("\n\n\nSTART_LOG => ", resp2, "\n\n\n")
8277
});
8378

8479
test("install-gemini-version", async () => {
80+
const version_to_install = "0.1.13";
8581
const { id } = await setup({
82+
skipGeminiMock: true,
8683
moduleVariables: {
8784
install_gemini: "true",
88-
gemini_version: "v2.5.0",
85+
gemini_version: version_to_install,
8986
},
9087
});
9188
await execModuleScript(id);
92-
// Check for version in install log or binary (customize as needed)
9389
const resp = await execContainer(id, [
9490
"bash",
9591
"-c",
9692
`cat /home/coder/.gemini-module/install.log || true`,
9793
]);
98-
expect(resp.stdout).toContain("v2.5.0");
94+
expect(resp.stdout).toContain(version_to_install);
9995
});
100-
//
96+
10197
test("gemini-settings-json", async () => {
10298
const settings = '{"foo": "bar"}';
10399
const { id } = await setup({

registry/coder-labs/modules/gemini/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ module "agentapi" {
192192
GOOGLE_GENAI_USE_VERTEXAI='${var.use_vertexai}' \
193193
GEMINI_MODEL='${var.gemini_model}' \
194194
GEMINI_START_DIRECTORY='${var.folder}' \
195-
GEMINI_TASK_PROMPT='${data.coder_parameter.ai_prompt.value}' \
195+
GEMINI_TASK_PROMPT='${base64encode(data.coder_parameter.ai_prompt.value)}' \
196196
/tmp/start.sh
197197
EOT
198198

@@ -205,11 +205,11 @@ module "agentapi" {
205205
chmod +x /tmp/install.sh
206206
ARG_INSTALL='${var.install_gemini}' \
207207
ARG_GEMINI_VERSION='${var.gemini_version}' \
208-
ARG_GEMINI_CONFIG='${var.gemini_settings_json}' \
209-
BASE_EXTENSIONS='${replace(local.base_extensions, "'", "'\\''")}' \
210-
ADDITIONAL_EXTENSIONS='${replace(var.additional_extensions != null ? var.additional_extensions : "", "'", "'\\''")}' \
208+
ARG_GEMINI_CONFIG='${base64encode(var.gemini_settings_json)}' \
209+
BASE_EXTENSIONS='${base64encode(replace(local.base_extensions, "'", "'\\''"))}' \
210+
ADDITIONAL_EXTENSIONS='${base64encode(replace(var.additional_extensions != null ? var.additional_extensions : "", "'", "'\\''"))}' \
211211
GEMINI_START_DIRECTORY='${var.folder}' \
212-
GEMINI_INSTRUCTION_PROMPT='${var.gemini_system_prompt}' \
212+
GEMINI_INSTRUCTION_PROMPT='${base64encode(var.gemini_system_prompt)}' \
213213
/tmp/install.sh
214214
EOT
215215
}

registry/coder-labs/modules/gemini/scripts/install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ command_exists() {
99

1010
set -o nounset
1111

12+
ARG_GEMINI_CONFIG=$(echo -n "$ARG_GEMINI_CONFIG" | base64 -d)
13+
BASE_EXTENSIONS=$(echo -n "$BASE_EXTENSIONS" | base64 -d)
14+
ADDITIONAL_EXTENSIONS=$(echo -n "$ADDITIONAL_EXTENSIONS" | base64 -d)
15+
GEMINI_INSTRUCTION_PROMPT=$(echo -n "$GEMINI_INSTRUCTION_PROMPT" | base64 -d)
16+
1217
echo "--------------------------------"
1318
printf "gemini_config: %s\n" "$ARG_GEMINI_CONFIG"
1419
printf "install: %s\n" "$ARG_INSTALL"

registry/coder-labs/modules/gemini/scripts/start.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ else
1313
export PATH="$HOME/.npm-global/bin:$PATH"
1414
fi
1515

16-
printf "Version: %s\n" "$(gemini --version)\n"
16+
printf "Version: %s\n" "$(gemini --version)"
17+
18+
GEMINI_TASK_PROMPT=$(echo -n "$GEMINI_TASK_PROMPT" | base64 -d)
1719

1820
if command_exists gemini; then
1921
printf "Gemini is installed\n"
@@ -41,7 +43,7 @@ else
4143
fi
4244

4345
if [ -n "$GEMINI_TASK_PROMPT" ]; then
44-
printf "Running the task prompt\n"
46+
printf "Running the task prompt %s\n" "$GEMINI_TASK_PROMPT"
4547
PROMPT="Every step of the way, report tasks to Coder with proper descriptions and statuses. Your task at hand: $GEMINI_TASK_PROMPT"
4648
GEMINI_ARGS=(--prompt-interactive "$PROMPT")
4749
else

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy