Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-nodejs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-nodejs
Commits
34818989
Unverified
Commit
34818989
authored
Mar 28, 2019
by
Jeremy Morrell
Committed by
GitHub
Mar 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add metadata logging when the build fails (#630)
* Add metadata logging when the build fails
parent
99ebd7cb
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
15 deletions
+79
-15
compile
bin/compile
+2
-0
builddata.sh
lib/builddata.sh
+1
-0
failure.sh
lib/failure.sh
+61
-11
run
test/run
+15
-4
No files found.
bin/compile
View file @
34818989
...
@@ -70,6 +70,7 @@ handle_failure() {
...
@@ -70,6 +70,7 @@ handle_failure() {
echo
" Read more: https://devcenter.heroku.com/changelog-items/1573"
echo
" Read more: https://devcenter.heroku.com/changelog-items/1573"
echo
""
echo
""
meta_set
"node-build-success"
"false"
header
"Build failed"
header
"Build failed"
fail_yarn_outdated
"
$LOG_FILE
"
fail_yarn_outdated
"
$LOG_FILE
"
fail_yarn_lockfile_outdated
"
$LOG_FILE
"
fail_yarn_lockfile_outdated
"
$LOG_FILE
"
...
@@ -81,6 +82,7 @@ handle_failure() {
...
@@ -81,6 +82,7 @@ handle_failure() {
warn_angular_resolution
"
$LOG_FILE
"
warn_angular_resolution
"
$LOG_FILE
"
warn_missing_devdeps
"
$LOG_FILE
"
"
$BUILD_DIR
"
warn_missing_devdeps
"
$LOG_FILE
"
"
$BUILD_DIR
"
warn_econnreset
"
$LOG_FILE
"
warn_econnreset
"
$LOG_FILE
"
log_meta_data
>>
"
$BUILDPACK_LOG_FILE
"
failure_message | output
"
$LOG_FILE
"
failure_message | output
"
$LOG_FILE
"
}
}
trap
'handle_failure'
ERR
trap
'handle_failure'
ERR
...
...
lib/builddata.sh
View file @
34818989
#!/usr/bin/env bash
#!/usr/bin/env bash
log_initial_state
()
{
log_initial_state
()
{
meta_set
"buildpack"
"nodejs"
if
"
$YARN
"
;
then
if
"
$YARN
"
;
then
meta_set
"node-package-manager"
"yarn"
meta_set
"node-package-manager"
"yarn"
meta_set
"has-node-lock-file"
"true"
meta_set
"has-node-lock-file"
"true"
...
...
lib/failure.sh
View file @
34818989
This diff is collapsed.
Click to expand it.
test/run
View file @
34818989
...
@@ -1043,11 +1043,9 @@ testMemoryMetrics() {
...
@@ -1043,11 +1043,9 @@ testMemoryMetrics() {
}
}
testBuildMetaData
()
{
testBuildMetaData
()
{
env_dir
=
$(
mktmpdir
)
local
log_file
=
$(
mktemp
)
local
log_file
=
$(
mktemp
)
echo
"
$log_file
"
>
$env_dir
/BUILDPACK_LOG_FILE
compile
"pre-post-build-scripts"
"
$(
mktmpdir
)
"
$env_dir
BUILDPACK_LOG_FILE
=
"
$log_file
"
compile
"pre-post-build-scripts"
# build info
# build info
assertFileContains
"node-package-manager=npm"
$log_file
assertFileContains
"node-package-manager=npm"
$log_file
...
@@ -1084,7 +1082,7 @@ testBuildMetaData() {
...
@@ -1084,7 +1082,7 @@ testBuildMetaData() {
# erase the log file
# erase the log file
echo
""
>
$log_file
echo
""
>
$log_file
compile
"yarn"
"
$(
mktmpdir
)
"
$env_dir
BUILDPACK_LOG_FILE
=
"
$log_file
"
compile
"yarn"
assertFileContains
"node-package-manager=yarn"
$log_file
assertFileContains
"node-package-manager=yarn"
$log_file
assertFileContains
"has-node-lock-file=true"
$log_file
assertFileContains
"has-node-lock-file=true"
$log_file
...
@@ -1095,6 +1093,19 @@ testBuildMetaData() {
...
@@ -1095,6 +1093,19 @@ testBuildMetaData() {
assertFileContains
"node-build-success=true"
$log_file
assertFileContains
"node-build-success=true"
$log_file
}
}
testFailingBuildMetaData
()
{
local
log_file
=
$(
mktemp
)
BUILDPACK_LOG_FILE
=
"
$log_file
"
compile
"bad-json"
assertFileContains
"failure=invalid-package-json"
$log_file
assertCapturedError
echo
""
>
$log_file
BUILDPACK_LOG_FILE
=
"
$log_file
"
compile
"yarn-lockfile-out-of-date"
assertFileContains
"failure=outdated-yarn-lockfile"
$log_file
assertCapturedError
}
testPropagateAppUUID
()
{
testPropagateAppUUID
()
{
env_dir
=
$(
mktmpdir
)
env_dir
=
$(
mktmpdir
)
local
log_file
=
$(
mktemp
)
local
log_file
=
$(
mktemp
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment