Skip to content

Commit 58787cb

Browse files
committed
Remove command "test" from script docker.sh
Most of the tests are migrated to "npm test"
1 parent 88ba997 commit 58787cb

File tree

4 files changed

+2
-142
lines changed

4 files changed

+2
-142
lines changed

.husky/pre-commit

100644100755
File mode changed.

.husky/pre-push

100644100755
File mode changed.

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121

2222
- Drop support for i-doit open/pro `1.14` and `1.15` branches
2323
- Drop support for PHP `7.1`, `7.2`, and `7.3` (end of life)
24+
- Remove command `./docker.sh test` in favor of `npm test`
2425

2526
## [0.3.0][] – 2020-10-23
2627

docker.sh

+1-142
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ function execute {
4141
"scan")
4242
scanImages
4343
;;
44-
"test")
45-
runTests
46-
;;
4744
*)
4845
printUsage
4946
;;
@@ -190,144 +187,6 @@ function scanImage {
190187
docker run --rm -v /tmp/trivy:/root/.cache/ aquasec/trivy "$tag"
191188
}
192189

193-
function runTests {
194-
log "Run tests…"
195-
196-
pullImagesForTesting
197-
installNodePackages
198-
auditNodePackages
199-
lintMarkdownFiles
200-
lintYAMLFiles
201-
lintDockerfiles
202-
lintShellScripts
203-
testExecutableBits
204-
}
205-
206-
function pullImagesForTesting {
207-
log "Pull Docker images…"
208-
209-
pullImage hadolint/hadolint:latest
210-
pullImage koalaman/shellcheck:latest
211-
pullImage node:lts
212-
pullImage cytopia/yamllint:latest
213-
pullImage aquasec/trivy:latest
214-
}
215-
216-
function installNodePackages {
217-
log "Install Node packages…"
218-
219-
docker run --rm --name idoitdocker-npm \
220-
-v "$PWD":/usr/src/app -w /usr/src/app node:lts \
221-
npm install || abort "No good"
222-
}
223-
224-
function auditNodePackages {
225-
docker run --rm --name idoitdocker-npm \
226-
-v "$PWD":/usr/src/app -w /usr/src/app node:lts \
227-
npm audit || abort "No good"
228-
}
229-
230-
function lintMarkdownFiles {
231-
while read -r filePath; do
232-
lintMarkdownFile "$filePath"
233-
done < <(
234-
find "$(git rev-parse --show-toplevel)" \
235-
-type f -name "*.md" -not \
236-
-exec git check-ignore -q {} \; -printf '%P\n'
237-
)
238-
}
239-
240-
function lintMarkdownFile {
241-
local filePath="$1"
242-
243-
log "Lint markdown file $filePath"
244-
245-
docker run --rm --name idoitdocker-npm \
246-
-v "$PWD":/usr/src/app -w /usr/src/app node:lts \
247-
./node_modules/.bin/remark \
248-
--frail --quiet < "$filePath" > /dev/null || \
249-
abort "No good"
250-
}
251-
252-
function lintYAMLFiles {
253-
while read -r filePath; do
254-
lintYAMLFile "$filePath"
255-
done < <(
256-
find "$(git rev-parse --show-toplevel)" \
257-
-type f -name "*.y*ml" -not \
258-
-exec git check-ignore -q {} \; -printf '%P\n'
259-
)
260-
}
261-
262-
function lintYAMLFile {
263-
local filePath="$1"
264-
265-
log "Lint YAML file $filePath"
266-
267-
docker run --rm --name idoitdocker-yamllint \
268-
-v "$PWD":/data cytopia/yamllint:latest \
269-
"$filePath" || \
270-
abort "No good"
271-
}
272-
273-
function lintDockerfiles {
274-
while read -r filePath; do
275-
lintDockerfile "$filePath"
276-
done < <(
277-
find "$(git rev-parse --show-toplevel)" \
278-
-type f -name "Dockerfile" -not \
279-
-exec git check-ignore -q {} \; -printf '%P\n'
280-
)
281-
}
282-
283-
function lintDockerfile {
284-
local dockerfile="$1"
285-
286-
log "Lint $dockerfile"
287-
288-
docker run --rm -i -v "$PWD:/opt/hadolint/" hadolint/hadolint:latest \
289-
hadolint --config /opt/hadolint/.hadolint.yaml - < \
290-
"$dockerfile" || \
291-
abort "No good"
292-
}
293-
294-
function lintShellScripts {
295-
while read -r filePath; do
296-
lintShellScript "$filePath"
297-
done < <(
298-
git ls-files | grep -e '.sh$'
299-
)
300-
}
301-
302-
function lintShellScript {
303-
local filePath="$1"
304-
305-
log "Lint shell script $filePath"
306-
307-
docker run \
308-
-v "$(pwd):/scripts" \
309-
koalaman/shellcheck:latest \
310-
"/scripts/$filePath" || \
311-
abort "No good"
312-
}
313-
314-
function testExecutableBits {
315-
while read -r filePath; do
316-
testExecutableBit "$filePath"
317-
done < <(
318-
git ls-files | grep -e '.sh$'
319-
)
320-
}
321-
322-
function testExecutableBit {
323-
local filePath="$1"
324-
325-
log "Check executable bit on shell script $filePath"
326-
327-
test -x "$filePath" || \
328-
abort "Script is not executable"
329-
}
330-
331190
function fix {
332191
fixFilePermissions
333192
}
@@ -467,7 +326,7 @@ function cleanUp {
467326
}
468327

469328
function printUsage {
470-
log "build|clean|fix|help|login|logout|print|pull|push|scan|test"
329+
log "build|clean|fix|help|login|logout|print|pull|push|scan"
471330
}
472331

473332
function setUp {

0 commit comments

Comments
 (0)