File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ The JSON string should represent an object with the following information:
44
44
" tool configuration linting" ,
45
45
" tool specific setting overrides" ,
46
46
" specific composer dependency to be installed prior executing command"
47
+ ],
48
+ "after_script" : [
49
+ " post process tool result"
47
50
]
48
51
}
49
52
```
@@ -127,6 +130,9 @@ The `.laminas-ci/post-run.sh` command will receive these arguments:
127
130
- `$3` : the WORKDIR path
128
131
- `$4` : the `$JOB` passed to the entrypoint (see above)
129
132
133
+ It is also possible to pass `after_script` with a list of commands via the `$JOB` variable.
134
+ ` $STATUS` is a variable containing the exit code of the command and can be used in the commands listed in `after_script`.
135
+
130
136
# ### Parsing the $JOB
131
137
132
138
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 @@ -16,6 +16,7 @@ function help {
16
16
echo " - ignore_php_platform_requirement: flag to enable/disable the PHP platform requirement when executing composer \` install\` or \` update\` "
17
17
echo " - additional_composer_arguments: a list of composer arguments to be added when \` install\` or \` update\` is called."
18
18
echo " - before_script: a list of commands to run before the real command"
19
+ echo " - after_script: a list of commands to run after the real command"
19
20
echo " "
20
21
}
21
22
143
144
declare -a BEFORE_SCRIPT=()
144
145
readarray -t BEFORE_SCRIPT=" $( echo " ${JOB} " | jq -rc ' (.before_script // [])[]' ) "
145
146
147
+ declare -a AFTER_SCRIPT=()
148
+ readarray -t AFTER_SCRIPT=" $( echo " ${JOB} " | jq -rc ' (.after_script // [])[]' ) "
149
+
150
+
146
151
echo " Marking PHP ${PHP} as configured default"
147
152
update-alternatives --quiet --set php " /usr/bin/php${PHP} "
148
153
update-alternatives --quiet --set php-config " /usr/bin/php-config${PHP} "
@@ -241,4 +246,9 @@ if [ -x ".laminas-ci/post-run.sh" ];then
241
246
./.laminas-ci/post-run.sh " ${STATUS} " testuser " ${PWD} " " ${JOB} "
242
247
fi
243
248
249
+ for AFTER_SCRIPT_COMMAND in " ${AFTER_SCRIPT[@]} " ; do
250
+ echo " Running before_script: ${AFTER_SCRIPT_COMMAND} "
251
+ sudo --preserve-env --set-home -u testuser /bin/bash -c " ${AFTER_SCRIPT_COMMAND} "
252
+ done
253
+
244
254
exit ${STATUS}
You can’t perform that action at this time.
0 commit comments