Exception while using the plugin
Closed this issue · 9 comments
drone.yml
kind: pipeline
name: default
clone:
depth: 1
steps:
- name: test
image: alpine
commands:
- echo hi
when:
changeset:
includes: [ "OWNERS", "README.*" ]
- name: finisher
image: alpine
commands:
- echo finished
trigger:
branch:
- master
Processing...
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
at app.post (/app/plugin.js:37:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
Interesting, are you on the latest version of the plugin?
There is only one place we are doing a split
and that is here: https://github.com/microadam/drone-config-changeset-conditional/blob/master/lib/parsed-yaml-retriever.js#L15
Where does your drone.yml
file exist within your git repo?
This is my repo https://github.com/nikiai/test-prow/blob/master/.drone.yml. I tried the combindations of removing and adding trailing ---
. Dron file is at in root.
using microadam/drone-config-changeset-conditional:latest
Its nothing to do with the ---
. It can't find your drone yaml file for some reason. My guess is that the API key you have provided doesn't have access to the repo. I would suggest confirming that first. I can probably add some extra logging to try and see if that is the case if you are unable to confirm yourself
shouldn't it throw an exception regarding token then?
Depends on what the underlying library does if its an invalid token, or if it just has the wrong permissions. It might just return an error message in the body which I am currently not checking for. Thats the additional logging I was referring to
I have updated the Dockerfile to my favorite distroless, and it started working
FROM node:8.15.0 AS build-env
ADD . /app
WORKDIR /app
FROM gcr.io/distroless/nodejs
COPY --from=build-env /app /app
WORKDIR /app
CMD ["plugin.js"]
I have pushed the image to gcr.io/niki-ai/drone-config-changeset-conditional:1.0.0
@microadam Sincere thanks for this wonderful plugin :).
It was a silly mistake I used the same docker image microadam/drone-config-plugin-pipeline
for this service as well, its working with microadam/drone-config-changeset-conditional:latest
repo also.
Glad you got it working! I have just published a new version with extra logging anyway :)