I have the following code which works in gitlab (without the sh part):

sh '''
mkdir ./pylint
docker run --rm --entrypoint=/usr/local/bin/pylint ${IMAGE_NAME}:${IMAGE_VERSION} --rcfile=.pylintrc --exit-zero ${MODULE} > ./pylint/pylint.log
PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)

What it does, it takes the value 8.25 from this line: Your code has been rated at 8.52/10

I'm trying also to use it in my Jenkinsfile, but gets the following exception:

WorkflowScript: 50: unexpected char: '\' @ line 50, column 75.
   /^Your code has been rated at \([-0-9.]*

any idea how to fix it? maybe use other command than sed to get the require output?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.