How to get the API token for Jenkins

Since Jenkins 2.129 the API token configuration has changed: You can now have multiple tokens and name them. They can be revoked individually. Log in to Jenkins. Click you name (upper-right corner). Click Configure (left-side menu). Use “Add new Token” button to generate a new one then name it. You must copy the token when … Read more

How to trigger a build only if changes happen on particular set of files

The Git plugin has an option (excluded region) to use regexes to determine whether to skip building based on whether files in the commit match the excluded region regex. Unfortunately, the stock Git plugin does not have a “included region” feature at this time (1.15). However, someone posted patches on GitHub that work on Jenkins … Read more

How to write Pipeline to discard old builds?

As for declarative syntax, you can use the options block: pipeline { options { buildDiscarder(logRotator(numToKeepStr: ’30’, artifactNumToKeepStr: ’30’)) } … } Parameters for logRotator (from the source code): daysToKeepStr: history is only kept up to this days. numToKeepStr: only this number of build logs are kept. artifactDaysToKeepStr: artifacts are only kept up to this days. … Read more

Jenkins on OS X: xcodebuild gives Code Sign error

Keychains need to be unlocked before they can be used. You can use security unlock-keychain to unlock. You can do that interactively (safer) or by specifying the password on the command line (unsafe), e.g.: security unlock-keychain -p mySecretPassword… Obviously, putting this into a script compromises the security of that keychain, so often people setup an … Read more

Update Jenkins from a war file

You can overwrite the existing jenkins.war file with the new one and then restart Jenkins. This file is usually located in /usr/share/jenkins. If this is not the case for your system, in Manage Jenkins -> System Information, it will display the path to the .war file under executable-war.

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