-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix extension installation reporting #409
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tombruijn
force-pushed
the
report-install-result
branch
3 times, most recently
from
July 8, 2021 08:14
f7567d4
to
7565e9c
Compare
tombruijn
commented
Jul 8, 2021
@@ -21,9 +21,15 @@ const { | |||
} = require("./report") | |||
|
|||
const EXT_PATH = path.join(__dirname, "/../ext/") | |||
const testExtensionFailure = | |||
process.env._TEST_APPSIGNAL_EXTENSION_FAILURE == "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
process.env._TEST_APPSIGNAL_EXTENSION_FAILURE == "true" | |
process.env._TEST_APPSIGNAL_EXTENSION_FAILURE === "true" |
tombruijn
commented
Jul 8, 2021
packages/nodejs-ext/test/filter.js
Outdated
"use strict" | ||
|
||
const testExtensionFailure = | ||
process.env._TEST_APPSIGNAL_EXTENSION_FAILURE == "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
process.env._TEST_APPSIGNAL_EXTENSION_FAILURE == "true" | |
process.env._TEST_APPSIGNAL_EXTENSION_FAILURE === "true" |
jeffkreeftmeijer
approved these changes
Jul 9, 2021
When the extension installed we never stored if it installed correctly or not. Originally it would always report it as a "success" status. In a previous commit cb08b7a, PR #373, I changed the report status to "unknown", because after the `extension.js` script was run the `node-gyp rebuild` command was run through the `package.json` `install` script. After the node-gyp command was run it would not return to the extension.js script and we couldn't check the exit status of that command. Instead of running the node-gyp command after the `extension.js` script, run the node-gyp command from the `extension.js` script so we can listen to the exit status and report the installation as a success or "error" when it encounters an error. This should fix #371, the issue describing the scenario above, the install report not accurately describing the installation status. I am not sure why the originally implementation was chosen. The original implementation was present since the initial commit of the project. There may be a problem with this new implementation that I am unaware of now, because I'm no Node.js expert. But we call out to other commands like `tar` from the `extension.js` script as well, so I figure it will be fine. ## CI build update I've added tests for the extension build failure scenario, and the success scenario. For this I needed to have Jest run certain specs only some of the time, based on the `_TEST_APPSIGNAL_EXTENSION_FAILURE` environment variable (same as in the Ruby gem CI setup). This is done with the `--filter` option (which links to a file with a filter function), which is configured through the `package.json` test scripts. Since these new tests are only for the `nodejs-ext` package I found it unnecessary to spin up a new job for it, and instead add it as `extra_commands` to the package's test commands. Before the failure state is tested, the extension installation is cleaned up, so it doesn't think it has installed correctly. Because we install the extension in the "Build" task, and it's not present in the project dir, but instead the `/tmp` dir on the system, I've also copied the report location from the "Build" task to the job that tests this report. Otherwise it would fail on a missing file, or we'd need to install the extension again. Hopefully we can find a better location for the install report location in issue #372.
tombruijn
force-pushed
the
report-install-result
branch
from
July 9, 2021 09:26
7565e9c
to
249149d
Compare
tombruijn
added a commit
that referenced
this pull request
Oct 7, 2021
The installation reuslt was hardcoded to always be `success`, because previously we couldn't track it. But since PR #409 we now run the `node-gyp` command from the `extension.js` install script so we can track the installation result. Read the status from the report so the diagnose report is more accurate. Since there are more fields in case of an error or failure, print those as well if present.
tombruijn
added a commit
that referenced
this pull request
Oct 7, 2021
The installation result was hardcoded to always be `success`, because previously we couldn't track it. But since PR #409 we now run the `node-gyp` command from the `extension.js` install script so we can track the installation result. Read the status from the report so the diagnose report is more accurate. Since there are more fields in case of an error or failure, print those as well if present.
tombruijn
added a commit
that referenced
this pull request
Oct 11, 2021
The installation result was hardcoded to always be `success`, because previously we couldn't track it. But since PR #409 we now run the `node-gyp` command from the `extension.js` install script so we can track the installation result. Read the status from the report so the diagnose report is more accurate. Since there are more fields in case of an error or failure, print those as well if present.
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the extension installed we never stored if it installed correctly
or not. Originally it would always report it as a "success" status. In a
previous commit cb08b7a, PR #373, I
changed the report status to "unknown", because after the
extension.js
script was run the
node-gyp rebuild
command was run through thepackage.json
install
script. After the node-gyp command was run itwould not return to the extension.js script and we couldn't check the
exit status of that command.
Instead of running the node-gyp command after the
extension.js
script,run the node-gyp command from the
extension.js
script so we can listento the exit status and report the installation as a success or "error"
when it encounters an error.
This should fix #371, the issue describing the scenario above, the
install report not accurately describing the installation status.
I am not sure why the originally implementation was chosen. The original
implementation was present since the initial commit of the project.
There may be a problem with this new implementation that I am unaware of
now, because I'm no Node.js expert. But we call out to other commands
like
tar
from theextension.js
script as well, so I figure it willbe fine.
CI build update
I've added tests for the extension build failure scenario, and the
success scenario. For this I needed to have Jest run certain specs only
some of the time, based on the
_TEST_APPSIGNAL_EXTENSION_FAILURE
environment variable (same as in the Ruby gem CI setup). This is done
with the
--filter
option (which links to a file with a filterfunction), which is configured through the
package.json
test scripts.Since these new tests are only for the
nodejs-ext
package I found itunnecessary to spin up a new job for it, and instead add it as
extra_commands
to the package's test commands.Before the failure state is tested, the extension installation is
cleaned up, so it doesn't think it has installed correctly.
Because we install the extension in the "Build" task, and it's not
present in the project dir, but instead the
/tmp
dir on the system,I've also copied the report location from the "Build" task to the job
that tests this report. Otherwise it would fail on a missing file, or
we'd need to install the extension again. Hopefully we can find a better
location for the install report location in issue #372.