Building a Small Jenkins Project with Email Notifications and Remote Job Execution

·

2 min read

I recently created a small Jenkins project to explore two very useful features:

  1. Automated Email Notifications – to get alerts on build status.

  2. Remote Shell Execution – to transfer and run scripts on another server.


1. Automated Email Notifications

I set up Jenkins to send an email after every build — whether it passed or failed.

Steps:

  • Installed the Email Extension Plugin.

  • Configured SMTP details under Manage Jenkins → Configure System (I used Gmail SMTP for testing).

  • Added Editable Email Notification in Post-build Actions.

  • Customized the subject and message to include build results.

  • Ran a sample build to verify — I instantly received the build status in my inbox.

Email config in Jenkins Manager

Adding post build action in job

Outcome:

The team gets real-time build updates without checking the Jenkins dashboard.


2. Remote Shell Execution via Jenkins

I wanted Jenkins to automatically transfer a shell script to a remote server and execute it, creating a testfile in /tmp.

Steps I followed:

  1. Generated SSH keys on the Jenkins server and copied the public key to the remote server’s ~/.ssh/authorized_keys.

  2. Installed the Publish Over SSH plugin in Jenkins.

  3. Configured the remote server in Manage Jenkins → Configure System:

    • Added the IP address.

    • Specified the SSH key for authentication.

  4. Created a Jenkins job and selected Build Step → Send files or execute commands over SSH.

  5. Added the source file path (the shell script) and specified the remote execution command.

  6. Clicked Build — Jenkins transferred the script and executed it.

  7. Verified that the testfile was successfully created in /tmp on the remote server.

Added key and ip i n Manage jenkins

Job

Remote server (successfully executed shell code)

Outcome:
This approach allows automated deployments, remote server configurations, and test runs without manual SSH login.


Conclusion

This small project gave me hands-on experience with:

  • Automated notifications for better communication.

  • Remote job execution for seamless integration between Jenkins and external servers.

Even simple setups like this can save time and make CI/CD workflows more powerful.