-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathextension.json
184 lines (168 loc) · 4.77 KB
/
extension.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
{
"id": "ibm.devops.services.pipeline.saucelabs",
"version": 1,
"name_key": "ExtName",
"desc_key": "ExtDesc",
"extension_type": "Test",
"message_key": "ExtMessage",
"service_binding": {
"saucelabs": {
"username": "USER_ID",
"key": "ACCESS"
}
},
"inputs": [
{
"type": "Bluemix",
"inclusion" : "always"
}
],
"params": [
{
"name": "USER_ID",
"type": "Text",
"required": "true",
"default_value": "",
"label_key": "USER_ID_KEY",
"desc_key": "USER_ID_DESC"
},
{
"name": "ACCESS",
"type": "Secure",
"required": "true",
"default_value": "",
"label_key": "ACCESS_KEY",
"desc_key": "ACCESS_KEY_DESC"
},
{
"name": "SELECT_CMD",
"type": "Select",
"required": "false",
"default_value": " ",
"label_key": "SELECT_CMD_KEY",
"desc_key": "SELECT_CMD_DESC",
"options": [
{
"label_key": "EMPTY_KEY",
"value": " "
},
{
"label_key": "NPM_KEY",
"value": "npm test"
},
{
"label_key": "GRUNT_KEY",
"value": "grunt"
},
{
"label_key": "GRUNT_T_KEY",
"value": "grunt test"
},
{
"label_key": "ANT_KEY",
"value": "ant test"
},
{
"label_key": "MVN_KEY",
"value": "mvn test"
},
{
"label_key": "CUSTOM_KEY",
"value": "custom"
}
]
},
{
"name": "COMMAND",
"type": "TextArea",
"required": "true",
"default_value" : "#!/bin/bash",
"label_key": "COMMAND_KEY",
"desc_key": "COMMAND_DESC"
},
{
"name": "DL_ASSETS",
"type": "Checkbox",
"required": "true",
"default_value": "true",
"label_key": "ASSET_KEY",
"desc_key": "ASSET_DESC"
}
],
"outputs": [
{
"type": "Artifacts",
"inclusion" : "always"
},
{
"type": "Tests",
"inclusion": "optional"
}
],
"execution": {
"type": "JenkinsDocker",
"shell": "#!/bin/bash
set +x
set +e
export INIT_START_TIME=$(date +\"%s\")
#############
# Colors #
#############
export green=\'\\x1B[0;32m\'
export red=\'\\x1B[0;31m\'
export label_color=\'\\x1B[0;33m\'
export no_color=\'\\x1B[0m\'
export SAUCE_USERNAME=#USER_ID#
export SAUCE_ACCESS_KEY=#ACCESS#
export CMD_CHOICE=\"#SELECT_CMD#\"
export DOWNLOAD_ASSETS=#DL_ASSETS#
#check for defined host/port, if null set defaults
if [ -z \"$HOST\" ]; then
export HOST=ondemand.saucelabs.com
fi
if [ -z \"$PORT\" ]; then
export PORT=80
fi
#check if we have valid saucelabs creds
ENCODED_TOKEN=$(echo -ne \"$SAUCE_USERNAME:$SAUCE_ACCESS_KEY\" | base64);
isAuthed=$(curl --write-out \"%{http_code}\n\" --silent --output /dev/null \"https://saucelabs.com/rest/v1/users/$SAUCE_USERNAME\" -H \"Authorization: basic $ENCODED_TOKEN\")
if [ \"$isAuthed\" != \"200\" ]; then
echo -e \"${red}Authentication against Saucelabs failed, ensure your Saucelabs credentials are correctly set from within your toolchain.${no_color}\"
exit 1
fi
function custom_cmd {
eval #COMMAND#
RESULT=$?
${EXT_DIR}/sauce.py
PY_RES=$?
if [ \"$DOWNLOAD_ASSETS\" == true ]; then
echo \"zipping files\"
zip -q selenium_logs.zip selenium-server-*
zip -q videos.zip video-*
mv selenium_logs.zip ${ARCHIVE_DIR}
mv videos.zip ${ARCHIVE_DIR}
fi
mv job_data_collection.json ${ARCHIVE_DIR}
if [ $RESULT -ne 0 ] || [ $PY_RES -ne 0 ]; then
exit 1
fi
}
export -f custom_cmd
. $EXT_DIR/_init.sh
INIT_END_TIME=$(date +\"%s\")
INIT_EST_TIME=$(($INIT_END_TIME-$INIT_START_TIME))
echo -e \"Init runtime of `date -u -d @\"$INIT_EST_TIME\" +\'%-Mm %-Ss\'`\"
#sudo apt-get install -y python-setuptools
#export PYTHONPATH=$PYTHONPATH:/tmp
#easy_install --install-dir=/tmp prettytable
echo \"Download Assets: \"
echo $DOWNLOAD_ASSETS
. $EXT_DIR/execute.sh
RESULT=$?
if [ $RESULT -ne 0 ]; then
exit 1
fi
"},
"project": "https://hub.jazz.net/project/alchemy/Alchemy-Ostanes",
"project_contact": "[email protected]"
}