Name of a parent process name when running Jenkins


I’m looking for a way to determine whether Jenkins is running during an unattended build.

My plan is to search running processes by their parent process names.
But for this I need a parent process name of Jenkins that would tell me “yes, this process is Jenkins running”, and I need to be 100% sure it’s Jenkins and not any other process.

I suppose the parent process name could be simply “java”, as Jenkins is written in it.

Could anyone confirm this or tell me what parent process name is used for Jenkins?

Thank you!

Best regards,

why do you need to be absolutely 100%?

generally people use env variables, like BUILD_NUMBER to determine this.

Thank you for your reply Gavin.
Looking for env. variables seems like an option, we could consider that.

My company (PostSharp) is looking for a way to integrate our new product Metalama with multiple types of CI/CD tools and build servers so that we can provide a free license to the product if it is used for an unattended build.

To make the decision to provide the license we currently use a method of looking for a parent process names that would help us determine if it is an actual build server and not just a regular local device.

Jenkins and many other continuous integration servers provide an environment variable CI=true that indicates the process is running in a CI environment. If you’re looking for a simple check, that environment variable will confirm that you’re running in Jenkins 2.286 or later.

1 Like