File tree Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change 3
3
set -euo pipefail
4
4
shopt -s globstar nullglob
5
5
6
+ find_root () {
7
+ if echo " $BUILDKITE_PLUGINS " | grep -q docker-compose-buildkite-plugin; then
8
+ log ' It looks like this step was run via Docker Compose.'
9
+ ROOT=' '
10
+ if [ -f Dockerfile ]; then
11
+ log ' Attempting to parsed Dockerfile'
12
+ ROOT=" $( awk ' /WORKDIR/ {print $2}' Dockerfile | tail -n 1) "
13
+ else
14
+ log ' No Dockerfile found.'
15
+ fi
16
+
17
+ if [ " $ROOT " == ' ' ]; then
18
+ log ' Could not determine root from Dockerfile. Assuming "/" for root.'
19
+ echo ' /'
20
+ fi
21
+ elif echo " $BUILDKITE_PLUGINS " | grep -q docker-buildkite-plugin; then
22
+ log ' It looks like this step was run via Docker.'
23
+
24
+ if [ " ${BUILDKITE_PLUGIN_DOCKER_WORKDIR:- } " != ' ' ]; then
25
+ log ' Using the configured docker plugin workdir'
26
+ echo " $BUILDKITE_PLUGIN_DOCKER_WORKDIR "
27
+ else
28
+ log ' Using the default docker plugin workdir'
29
+ echo ' /workdir'
30
+ fi
31
+ else
32
+ log ' It looks like this step was run right on the agent. Using PWD for root'
33
+ pwd
34
+ fi
35
+ }
36
+
37
+ log () {
38
+ echo " $@ " 1>&2
39
+ }
40
+
6
41
LABEL=${BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_LABEL:- $BUILDKITE_LABEL }
7
- ROOT=${BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_ROOT:- $(pwd )}
42
+ ROOT=${BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_ROOT:- $(find_root )}
8
43
SHA=$BUILDKITE_COMMIT
9
44
TOKEN=$BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_TOKEN
10
45
URL=${BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_URL:- https:// www.check-run-reporter.com/ api/ v1/ submissions}
11
46
47
+ log ' Running check-run-reporter-buildkite-plugin with the following parameters'
48
+ log " LABEL=$LABEL "
49
+ log " ROOT=$ROOT "
50
+ log " SHA=$SHA "
51
+
12
52
CMD=" curl -v $URL "
13
53
CMD=" $CMD --user token:'$TOKEN '"
14
54
CMD=" $CMD -F label'=$LABEL '"
You can’t perform that action at this time.
0 commit comments