feat: error out on Procfile extraction if the procfile is invalid
Refs #2991 Refs #3196
This commit is contained in:
@@ -23,6 +23,9 @@ extract_procfile() {
|
||||
copy_from_image "$IMAGE" "Procfile" "$DOKKU_PROCFILE" 2>/dev/null || true
|
||||
if [[ -f "$DOKKU_PROCFILE" ]]; then
|
||||
dokku_log_info1_quiet "App Procfile file found ($DOKKU_PROCFILE)"
|
||||
# shellcheck disable=SC2069
|
||||
PROCFILE_ERRORS="$(procfile-util check "$DOKKU_PROCFILE" 2>&1 >/dev/null || true)"
|
||||
[[ -n "$PROCFILE_ERRORS" ]] && dokku_log_fail "${PROCFILE_ERRORS}"
|
||||
else
|
||||
dokku_log_info1_quiet "No Procfile found in app image"
|
||||
fi
|
||||
|
||||
5
tests/apps/dockerfile-procfile-bad/CHECKS
Normal file
5
tests/apps/dockerfile-procfile-bad/CHECKS
Normal file
@@ -0,0 +1,5 @@
|
||||
WAIT=2 # wait 2 seconds
|
||||
TIMEOUT=5 # set timeout to 5 seconds
|
||||
ATTEMPTS=2 # try 2 times
|
||||
|
||||
/ nodejs/express
|
||||
11
tests/apps/dockerfile-procfile-bad/Dockerfile
Normal file
11
tests/apps/dockerfile-procfile-bad/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM node:4
|
||||
|
||||
EXPOSE 3001/udp
|
||||
EXPOSE 3000/tcp
|
||||
EXPOSE 3003
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN npm install
|
||||
|
||||
CMD npm start
|
||||
12
tests/apps/dockerfile-procfile-bad/Procfile
Normal file
12
tests/apps/dockerfile-procfile-bad/Procfile
Normal file
@@ -0,0 +1,12 @@
|
||||
###############################
|
||||
# DEVELOPMENT #
|
||||
###############################
|
||||
|
||||
# Procfile for development using the new threaded worker (scheduler, twitter stream and delayed job)
|
||||
cron: node worker.js
|
||||
web: node web.js
|
||||
<<<<<<< HEAD=0
|
||||
worker: node worker.js
|
||||
========0
|
||||
worker: node worker-2.js
|
||||
>>>>>>> 5bb7ec3e2a8f4f6565432a4fc82c92d4a3603d28=0
|
||||
2
tests/apps/dockerfile-procfile-bad/check_deploy
Normal file
2
tests/apps/dockerfile-procfile-bad/check_deploy
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "nodejs/express"
|
||||
13
tests/apps/dockerfile-procfile-bad/package.json
Normal file
13
tests/apps/dockerfile-procfile-bad/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "2.5.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.2.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "false"
|
||||
}
|
||||
}
|
||||
12
tests/apps/dockerfile-procfile-bad/web.js
Normal file
12
tests/apps/dockerfile-procfile-bad/web.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var express = require('express');
|
||||
|
||||
var app = express.createServer(express.logger());
|
||||
|
||||
app.get('/', function(request, response) {
|
||||
response.send('nodejs/express');
|
||||
});
|
||||
|
||||
var port = process.env.PORT || 5000;
|
||||
app.listen(port, function() {
|
||||
console.log("Listening on " + port);
|
||||
});
|
||||
6
tests/apps/dockerfile-procfile-bad/worker.js
Normal file
6
tests/apps/dockerfile-procfile-bad/worker.js
Normal file
@@ -0,0 +1,6 @@
|
||||
function worker() {
|
||||
console.log('sleeping for 60 seconds');
|
||||
setTimeout(worker, 60 * 1000);
|
||||
}
|
||||
|
||||
worker();
|
||||
@@ -117,4 +117,4 @@ teardown() {
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,13 @@ teardown() {
|
||||
done
|
||||
}
|
||||
|
||||
@test "(ps) dockerfile with bad procfile" {
|
||||
deploy_app dockerfile-procfile
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(ps:scale) dockerfile with procfile" {
|
||||
run bash -c "dokku ps:scale $TEST_APP web=2 worker=2"
|
||||
echo "output: "$output
|
||||
@@ -225,4 +232,3 @@ teardown() {
|
||||
assert_success
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user