Converting a string to int in Groovy

Use the toInteger() method to convert a String to an Integer, e.g. int value = “99”.toInteger() An alternative, which avoids using a deprecated method (see below) is int value = “66” as Integer If you need to check whether the String can be converted before performing the conversion, use String number = “66” if (number.isInteger()) … Read more

How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

The latest version of the pipeline sh step allows you to do the following; // Git committer email GIT_COMMIT_EMAIL = sh ( script: ‘git –no-pager show -s –format=\’%ae\”, returnStdout: true ).trim() echo “Git committer email: ${GIT_COMMIT_EMAIL}” Another feature is the returnStatus option. // Test commit message for flags BUILD_FULL = sh ( script: “git log … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)