Hi,
I have a deployment pipeline which has been working find for the past couple of years. Yesterday It did deploy successfully. Today 10 feb 2021 an error started occurring when trying to deploy:
> upmcontainer@1.0.0 clean:dist /opt/atlassian/pipelines/agent/build
> rimraf dist
sh: 1: rimraf: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
My initial guess is that the bitbucket agent might have changed ?
I have removed rimraf and sorted out my problem, but I'm curios to understand the cause of the problem.
Any theories or ideas are welcome.
Many thanks,
Hey @Alvaro Valderrama ,
you didn't share in your question whether or not the checksum of the pipeline container image has changed. I would first of all suspect that it changed and this caused the configuration change.
From first sight I wouldn't assume it's the Bitbucket Agent. However I remember being wrong once with this and that was this issue: https://jira.atlassian.com/browse/BCLOUD-16846
There it was not the Bitbucket Agent but AWS (where Bitbucket likely runs) and then an Alpine Linux based image (due to use of libmusl underneath).
Despite that I'd say as this is an npm module it is likely not the bitbucket agent that has changed -or- a change of the agent would not cause this error at all:
rimraf dist
sh: 1: rimraf: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
this is reportedly an issue not having the `rimraf` utility available which is confirmed by the first error message: `sh: 1: rimraf: not found` which means that the shell (sh) can not find the binary/command `rimraf`.
You can easily reproduce this by executing the command as well (with any command that is n/a). Example:
$ sh -c 'rimraf'
sh: 1: rimraf: not found
In context of your pipeline it is just that there npm shell-executes that command `rimraf dist` and then fails for the said reason that `rimraf` is not found.
The rest is `npm` offering more error information in/from the npm execution context.
Technically this is an issue with the script that npm is executing as it does not verify all its requirements before it is doing the work.
There might have been a time where `rimraf` was available globally installed (in $PATH so that the shell is able to find it) and that time is over or within some configuration not in $PATH any longer.
As long as this is an npm managed project your can add rimraf to the projects package.json scripts section and this may already solve the issue:
"scripts": {
...
"rimraf": "./node_modules/rimraf/bin.js",
}
Ref: https://stackoverflow.com/a/57816466
Likely you have not done any changes to your package.json and it did fail while it didn't earlier.
What could have changed - independent to the bitbucket agent - is the pipeline image in use.
If you don't use container image hashes but tags, they can change anytime. And with that the build can change anytime, and these changes include failures like in your question.
What helps is to pin the build container image revision so that you know in advance with what you build and then have a defined process to test and accept the images used for the build.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.