Trigger Jenkins job from Laravel via Guzzle Request

Trigger Jenkins job from Laravel via Guzzle Request

To trigger a Jenkins job from a Laravel application using Guzzle, you can use the Jenkins API endpoint to build a job. Follow these steps: Create Jenkins Token In Jenkins, click on your User Name from Top Right Navbar, inside that page go to “Configure”. There you will see section “API Token “. Click on “Add new token " and create token. Copy the generated token and save it for future use....

September 15, 2023 · 2 min · Ganesh Bhosale
Install NVM / Node for all users including Jenkins

Install NVM / Node for all users including Jenkins

Node Version Manager (NVM) is normally installed for a single user, typically under ~/.nvm. This works well for development environments, but it can become problematic on servers where multiple users or services need Node.js. For example, on an Ubuntu server you may need Node.js for: Jenkins CI/CD jobs Supervisor-managed applications www-data Deployment scripts Regular SSH users A better approach for this scenario is to install NVM in a shared system location such as /opt/nvm....

July 16, 2023 · 5 min · Ganesh Bhosale
How to Run a Root-Level Shell Script in Jenkins

How to Run a Root-Level Shell Script in Jenkins

Jenkins normally runs shell commands as the jenkins user. However, some server-maintenance tasks require root privileges—for example, cleaning APT caches, removing old packages, or managing system files. A common but unsafe approach is to give the Jenkins user unrestricted sudo access: jenkins ALL=(ALL) NOPASSWD: ALL This allows Jenkins jobs to execute arbitrary commands as root. A much safer approach is to allow Jenkins to run only one specific maintenance script as root....

June 12, 2023 · 4 min · Ganesh Bhosale
Setup Jenkins on Ubuntu 20.04 / 22.04 and run Jobs are root user

Setup Jenkins on Ubuntu 20.04 / 22.04 and run Jobs are root user

Requirements Add the repository key to the system and append the Debian package repository. wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt update Install Java 17 sudo apt install openjdk-17-jre-headless Update JAVA_HOME in .bashrc : nano ~/.bashrc export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 Install Jenkins sudo apt install jenkins Allow firewall for 8080 port...