Skip to content

Working with cli container#9

Open
davidbquali wants to merge 2 commits intomasterfrom
updated-cli
Open

Working with cli container#9
davidbquali wants to merge 2 commits intomasterfrom
updated-cli

Conversation

@davidbquali
Copy link

This pull request updates the GitHub Action to use a custom Docker image and entrypoint script for ending environments, replacing the previous method that relied on a public image. The changes improve flexibility and control over the CLI invocation and output handling.

Docker image and entrypoint update:

  • Added a new Dockerfile that uses quali/torque-cli:2.5.8 as the base image and copies a custom entrypoint.sh script, setting it as the entrypoint.
  • Replaced the previous public image reference in action.yaml with the local Dockerfile, ensuring the action uses the new custom image and entrypoint.

Entrypoint script and CLI invocation:

  • Introduced entrypoint.sh to handle the environment ending process, including parameter parsing, CLI invocation, error handling, and output writing to GitHub Actions outputs.

Action configuration and metadata:

  • Updated the arguments in action.yaml to match the new entrypoint script, including switching from environment_id to space and removing unused arguments.
  • Changed the TORQUE_USERAGENT environment variable to reflect the new action name for improved tracking and identification.

@davidbquali davidbquali requested a review from Copilot November 7, 2025 07:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the GitHub Action to use a custom Dockerfile and entrypoint script instead of directly invoking the torque-cli Docker image. The changes provide more control over the command execution and output handling.

  • Introduces a custom Dockerfile based on quali/torque-cli:2.5.8
  • Adds an entrypoint.sh script to handle environment termination with custom logging
  • Updates action.yaml to use the local Dockerfile and pass parameters to the entrypoint script

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Dockerfile Defines new container image based on torque-cli with custom entrypoint
entrypoint.sh Implements script to end Torque environments with logging and error handling
action.yaml Updates to use local Dockerfile, modifies args structure, and changes user agent string

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +13
params="\"${ENV_ID}\" --space \"${SPACE}\""

command="/Quali.Torque.Cli/torque-cli env end ${params} --token $TORQUE_TOKEN"
echo "The following command will be executed: ${command}"

echo "Ending environment..."
response=$(eval $command 2>&1)
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using string concatenation and eval for command execution is a security risk and makes the code fragile. The shell can properly handle arguments without eval. Replace lines 7-13 with direct command execution: response=$(/Quali.Torque.Cli/torque-cli env end \"${ENV_ID}\" --space \"${SPACE}\" --token \"$TORQUE_TOKEN\" 2>&1) to avoid eval and properly quote the token.

Suggested change
params="\"${ENV_ID}\" --space \"${SPACE}\""
command="/Quali.Torque.Cli/torque-cli env end ${params} --token $TORQUE_TOKEN"
echo "The following command will be executed: ${command}"
echo "Ending environment..."
response=$(eval $command 2>&1)
echo "The following command will be executed: /Quali.Torque.Cli/torque-cli env end \"${ENV_ID}\" --space \"${SPACE}\" --token \"***\""
echo "Ending environment..."
response=$(/Quali.Torque.Cli/torque-cli env end "${ENV_ID}" --space "${SPACE}" --token "$TORQUE_TOKEN" 2>&1)

Copilot uses AI. Check for mistakes.
echo "Ending environment with id '${ENV_ID}' in space '${SPACE}'"
params="\"${ENV_ID}\" --space \"${SPACE}\""

command="/Quali.Torque.Cli/torque-cli env end ${params} --token $TORQUE_TOKEN"
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI path '/Quali.Torque.Cli/torque-cli' appears incorrect. Based on the Dockerfile using 'quali/torque-cli:2.5.8' base image, the CLI should be available in the system PATH as 'torque-cli' without the full path prefix. Verify the correct path or use just 'torque-cli'.

Suggested change
command="/Quali.Torque.Cli/torque-cli env end ${params} --token $TORQUE_TOKEN"
command="torque-cli env end ${params} --token $TORQUE_TOKEN"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants