Skip to content

Commit 95b5634

Browse files
authored
Merge pull request #18 from QualiTorque/dev
2 parents d8878e0 + ee0c36e commit 95b5634

File tree

2 files changed

+38
-35
lines changed

2 files changed

+38
-35
lines changed

action.yaml

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
1-
name: 'Start Torque Environment'
2-
description: 'Starts an Environment in Torque and returns its details'
3-
author: 'Quali'
1+
name: "Start Torque Environment"
2+
description: "Starts an Environment in Torque and returns its details"
3+
author: "Quali"
44
inputs:
55
space:
6-
description: 'The Torque space to start the environment in'
6+
description: "The Torque space to start the environment in"
77
required: true
88
blueprint_name:
9-
description: 'The name of the Blueprint to use'
9+
description: "The name of the Blueprint to use"
1010
required: true
1111
repository_name:
12-
description: 'The Blueprint repository name'
12+
description: "The Blueprint repository name"
1313
environment_name:
14-
description: 'Provide a name for the Environment'
14+
description: "Provide a name for the Environment"
1515
required: false
16-
default: gh-build-${{ github.repository }}
1716
torque_token:
18-
description: 'A Torque longterm token'
17+
description: "A Torque longterm token"
1918
required: true
2019
torque_hostname:
21-
description: 'Alternative Torque server url'
20+
description: "Alternative Torque server url"
2221
required: false
2322
default: portal.qtorque.io
2423
branch:
25-
description: 'Use the Blueprint version from a remote Git branch'
24+
description: "Use the Blueprint version from a remote Git branch"
2625
required: false
2726
default: ""
2827
duration:
29-
description: 'The Environment will automatically de-provision at the end of the provided duration (minutes)'
28+
description: "The Environment will automatically de-provision at the end of the provided duration (minutes)"
3029
required: false
31-
default: '120'
30+
default: "120"
3231
timeout:
33-
description: 'Set the time (minutes) to wait for the environment to become active. When setting to 0 the action will end with just the Environment ID output.'
32+
description: "Set the time (minutes) to wait for the environment to become active. When setting to 0 the action will end with just the Environment ID output."
3433
required: false
3534
default: 0
3635
inputs:
3736
required: false
38-
description: 'A comma-separated list of key=value pairs. For example: key1=value1, key2=value2'
37+
description: "A comma-separated list of key=value pairs. For example: key1=value1, key2=value2"
3938
default: ""
4039

4140
outputs:
4241
environment_id:
43-
description: 'The ID of launched Torque Environment'
42+
description: "The ID of launched Torque Environment"
4443
environment_details:
45-
description: 'The Full Environment details in a json format'
44+
description: "The Full Environment details in a json format"
4645

4746
runs:
4847
using: "docker"
49-
image: 'Dockerfile'
48+
image: "Dockerfile"
5049
args:
5150
- ${{ inputs.blueprint_name }}
5251
- ${{ inputs.repository_name }}
@@ -61,7 +60,7 @@ runs:
6160
TORQUE_SPACE: ${{ inputs.space }}
6261
TORQUE_HOSTNAME: ${{ inputs.torque_hostname }}
6362
TORQUE_USERAGENT: Torque-Plugin-Github-Start-Environment-Action/v1
64-
63+
6564
branding:
66-
icon: 'play-circle'
67-
color: 'blue'
65+
icon: "play-circle"
66+
color: "blue"

entrypoint.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
#!/bin/sh -l
22

3-
BP_NAME=$1
4-
REPO_NAME=$2
5-
ENV_NAME=$3
6-
BRANCH=$4
7-
DURATION=$5
8-
TIMEOUT=$6
9-
INPUTS=$7
3+
BP_NAME="$1"
4+
REPO_NAME="$2"
5+
ENV_NAME="$3"
6+
BRANCH="$4"
7+
DURATION="$5"
8+
TIMEOUT="$6"
9+
INPUTS="$7"
10+
11+
ENV_NAME="${ENV_NAME:-$BP_NAME-build-$GITHUB_RUN_NUMBER}"
1012

1113
echo "Running torque start environment command"
12-
params="${BP_NAME} --repo ${REPO_NAME} -n ${ENV_NAME} -d ${DURATION}"
14+
params="\"${BP_NAME}\" --repo \"${REPO_NAME}\" -n \"${ENV_NAME}\" -d \"${DURATION}\""
1315

1416
if [ "$TIMEOUT" -gt 0 ]; then
1517
params="$params -w -t ${TIMEOUT}"
1618
fi
17-
if [ ! -z ${INPUTS} ]; then
18-
params="$params -i ${INPUTS}"
19+
if [ ! -z "${INPUTS}" ]; then
20+
params="$params -i \"${INPUTS}\""
1921
fi
20-
if [ ! -z ${BRANCH} ]; then
21-
params="$params -b ${BRANCH}"
22+
if [ ! -z "${BRANCH}" ]; then
23+
params="$params -b \"${BRANCH}\""
2224
fi
2325

24-
echo "The following parameters will be used: ${params}"
26+
command="torque --disable-version-check env start ${params} --output=json"
27+
echo "The following command will be executed: ${command}"
2528

2629
echo "Starting the environment..."
27-
response=$(torque --disable-version-check env start ${params} --output=json) || exit 1
30+
response=$(eval $command) || exit 1
31+
# response=$(torque --disable-version-check env start ${params} --output=json) || exit 1
2832
environment_id=$(echo "$response" | tr -d '"')
2933
echo "Started environment with id '${environment_id}'"
3034

0 commit comments

Comments
 (0)