File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ The JSON string should represent an object with the following information:
39
39
"command" : " command to run to perform the check (empty in case you dont want to excecute any command)" ,
40
40
"additional_composer_arguments" : [
41
41
" arguments which will be passed to `composer install` or `composer update`, passed as a list or as a list; e.g. --no-scripts"
42
+ ],
43
+ "after_script" : [
44
+ " post process tool result"
42
45
]
43
46
}
44
47
```
@@ -120,6 +123,9 @@ The `.laminas-ci/post-run.sh` command will receive these arguments:
120
123
- `$3` : the WORKDIR path
121
124
- `$4` : the `$JOB` passed to the entrypoint (see above)
122
125
126
+ It is also possible to pass `after_script` with a list of commands via the `$JOB` variable.
127
+ ` $STATUS` is a variable containing the exit code of the command and can be used in the commands listed in `after_script`.
128
+
123
129
# ### Parsing the $JOB
124
130
125
131
You may want to grab elements of the `$JOB` argument in order to branch logic.
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ function help {
14
14
echo " - dependencies: the dependency set to run against (lowest, latest, locked)"
15
15
echo " - ignore_php_platform_requirement: flag to enable/disable the PHP platform requirement when executing composer \` install\` or \` update\` "
16
16
echo " - additional_composer_arguments: a list of composer arguments to be added when \` install\` or \` update\` is called."
17
+ echo " - after_script: a list of commands to run after the real command"
17
18
echo " "
18
19
}
19
20
@@ -138,6 +139,9 @@ if [[ "${PHP}" == "" ]];then
138
139
exit 1
139
140
fi
140
141
142
+ declare -a AFTER_SCRIPT=()
143
+ readarray -t AFTER_SCRIPT=" $( echo " ${JOB} " | jq -rc ' (.after_script // [])[]' ) "
144
+
141
145
echo " Marking PHP ${PHP} as configured default"
142
146
update-alternatives --quiet --set php " /usr/bin/php${PHP} "
143
147
update-alternatives --quiet --set php-config " /usr/bin/php-config${PHP} "
@@ -231,4 +235,9 @@ if [ -x ".laminas-ci/post-run.sh" ];then
231
235
./.laminas-ci/post-run.sh " ${STATUS} " testuser " ${PWD} " " ${JOB} "
232
236
fi
233
237
238
+ for AFTER_SCRIPT_COMMAND in " ${AFTER_SCRIPT[@]} " ; do
239
+ echo " Running before_script: ${AFTER_SCRIPT_COMMAND} "
240
+ sudo --preserve-env --set-home -u testuser /bin/bash -c " ${AFTER_SCRIPT_COMMAND} "
241
+ done
242
+
234
243
exit ${STATUS}
You can’t perform that action at this time.
0 commit comments