This package, `jenkins-api`, provides a callback-based Node.js client for interacting with Jenkins CI servers. It allows developers to programmatically trigger builds, retrieve build and job information (like console output, build logs, and test results), and manage job configurations (e.g., enable/disable, create/delete jobs). The current stable version is 0.3.1, last published in March 2016. Due to its age and lack of updates, the package is considered abandoned, and it lacks modern features such as Promise-based APIs, async/await support, ESM compatibility, and TypeScript definitions, which are common in contemporary Node.js libraries. Its primary differentiation was a straightforward, direct API mapping for common Jenkins operations at the time of its active development.
npm install jenkins-apiVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing the Jenkins client with an API token and then fetching all jobs and triggering a specific job build.
Replace calls to `jenkins.last_build_report()` with `jenkins.last_build_info()`.
Migrate to a more actively maintained Jenkins client library, such as `jenkins` (by Silas) or a custom HTTP client, which provides modern features and security assurances.
Wrap callback-based methods in Promises manually or use a promisification utility if migrating to an `async/await` codebase is not feasible immediately.
Ensure the Jenkins user has appropriate permissions. If facing 'Forbidden' errors, investigate Jenkins' CSRF settings. Consider passing `strictSSL: false` to `jenkinsapi.init` options if dealing with self-signed certificates, but be aware of the security implications.
In an ES Module context, use `const jenkinsapi = require('jenkins-api');` if Node.js version supports top-level await for `require`, or otherwise ensure your project is configured for CommonJS.When initializing, pass `strictSSL: false` as an option: `jenkinsapi.init('https://jenkins.yoursite.com', { strictSSL: false });`. Be aware that this disables SSL certificate verification and can expose you to man-in-the-middle attacks.Double-check the username and API token. Ensure the Jenkins user has the necessary permissions. If CSRF protection is enabled on Jenkins, you might need to disable it (not recommended for production) or use a more modern Jenkins client that can handle crumb tokens.
Ensure your file is treated as CommonJS (e.g., use a `.js` extension in a non-module package, or explicitly use `createRequire` from the `module` built-in module for specific imports in ESM contexts if absolutely necessary). The simplest fix is to use CommonJS for files interacting with this library.
No dependency data recorded yet.