|
10 | 10 | # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to compute the checksum for. |
11 | 11 | # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, |
12 | 12 | # to exclude from the checksum. |
13 | | - # @param {string} [FAIL="true"] If set to "false" the task will not fail. |
| 13 | + # @param {string} [FAIL="true"] If set to "false", the task will not fail. |
14 | 14 | compute: |
15 | 15 | internal: true |
16 | 16 | label: "{{.TASK}}-{{.CHECKSUM_FILE}}" |
@@ -39,28 +39,28 @@ tasks: |
39 | 39 | - defer: "rm -f '{{.TMP_ERR_LOG}}'" |
40 | 40 | - |- |
41 | 41 | if ! \ |
42 | | - {{.ARCHIVER}} \ |
43 | | - --create \ |
44 | | - --file - \ |
45 | | - --group 0 \ |
46 | | - --mtime "UTC 1970-01-01" \ |
47 | | - --numeric-owner \ |
48 | | - --owner 0 \ |
49 | | - --sort name \ |
50 | | - --no-anchored \ |
51 | | - --wildcards \ |
52 | | - {{- range .EXCLUDE_PATTERNS}} |
53 | | - --exclude="{{.}}" \ |
54 | | - {{- end}} |
55 | | - {{- range .INCLUDE_PATTERNS}} |
56 | | - {{.}} \ |
57 | | - {{- end}} |
58 | | - 2> "{{.TMP_ERR_LOG}}" \ |
59 | | - | md5sum > "{{.CHECKSUM_FILE}}" \ |
| 42 | + {{.ARCHIVER}} \ |
| 43 | + --create \ |
| 44 | + --file - \ |
| 45 | + --group 0 \ |
| 46 | + --mtime "UTC 1970-01-01" \ |
| 47 | + --numeric-owner \ |
| 48 | + --owner 0 \ |
| 49 | + --sort name \ |
| 50 | + --no-anchored \ |
| 51 | + --wildcards \ |
| 52 | + {{- range .EXCLUDE_PATTERNS}} |
| 53 | + --exclude="{{.}}" \ |
| 54 | + {{- end}} |
| 55 | + {{- range .INCLUDE_PATTERNS}} |
| 56 | + {{.}} \ |
| 57 | + {{- end}} |
| 58 | + 2> "{{.TMP_ERR_LOG}}" \ |
| 59 | + | md5sum > "{{.CHECKSUM_FILE}}" \ |
60 | 60 | ; then |
61 | 61 | rm -f "{{.CHECKSUM_FILE}}" |
62 | 62 | {{- if eq "true" .FAIL}} |
63 | | - printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" |
| 63 | + printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat '{{.TMP_ERR_LOG}}')" |
64 | 64 | exit 1 |
65 | 65 | {{- else}} |
66 | 66 | exit 0 |
@@ -107,26 +107,26 @@ tasks: |
107 | 107 | {{- range .INCLUDE_PATTERNS}} |
108 | 108 | for path in {{.}}; do |
109 | 109 | test -e "${path}" \ |
110 | | - || ( |
111 | | - echo "Include path does not exist: ${path}" > "{{$.TMP_ERR_LOG}}" |
112 | | - exit 1 |
113 | | - ) |
114 | | - done && \ |
115 | | - {{- end}} |
116 | | - ( |
117 | | - cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ |
118 | 110 | || ( |
119 | | - echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" \ |
120 | | - > "{{.TMP_ERR_LOG}}" |
| 111 | + echo "Include path does not exist: ${path}" > "{{$.TMP_ERR_LOG}}" |
121 | 112 | exit 1 |
122 | | - ) |
123 | | - ) |
124 | | - ) \ |
125 | | - || ( |
126 | | - {{- if eq "true" .FAIL}} |
127 | | - printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" |
| 113 | + ) |
| 114 | + done && \ |
| 115 | + {{- end}} |
| 116 | + ( |
| 117 | + cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ |
| 118 | + || ( |
| 119 | + echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" \ |
| 120 | + > "{{.TMP_ERR_LOG}}" |
128 | 121 | exit 1 |
129 | | - {{- else}} |
130 | | - rm -f "{{.CHECKSUM_FILE}}" |
131 | | - {{- end}} |
| 122 | + ) |
132 | 123 | ) |
| 124 | + ) \ |
| 125 | + || ( |
| 126 | + {{- if eq "true" .FAIL}} |
| 127 | + printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" |
| 128 | + exit 1 |
| 129 | + {{- else}} |
| 130 | + rm -f "{{.CHECKSUM_FILE}}" |
| 131 | + {{- end}} |
| 132 | + ) |
0 commit comments