Conversation
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
| 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) |
| 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" |
There was a problem hiding this comment.
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'.
| command="/Quali.Torque.Cli/torque-cli env end ${params} --token $TORQUE_TOKEN" | |
| command="torque-cli env end ${params} --token $TORQUE_TOKEN" |
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:
Dockerfilethat usesquali/torque-cli:2.5.8as the base image and copies a customentrypoint.shscript, setting it as the entrypoint.action.yamlwith the localDockerfile, ensuring the action uses the new custom image and entrypoint.Entrypoint script and CLI invocation:
entrypoint.shto handle the environment ending process, including parameter parsing, CLI invocation, error handling, and output writing to GitHub Actions outputs.Action configuration and metadata:
action.yamlto match the new entrypoint script, including switching fromenvironment_idtospaceand removing unused arguments.TORQUE_USERAGENTenvironment variable to reflect the new action name for improved tracking and identification.