/** * Jenkins Source * * Fetches plugin information from Jenkins CI servers using the REST API * API Docs: https://www.jenkins.io/doc/book/using/remote-access-api/ */ import type { PluginInfo, PluginSourceType } from '../types/index.js'; import { BasePluginSource } from './base.js'; interface JenkinsArtifact { displayPath: string; fileName: string; relativePath: string; } /** * Jenkins build information from lastSuccessfulBuild */ interface JenkinsBuild { number: number; url: string; timestamp: number; duration: number; result: string; displayName?: string; description?: string; artifacts: JenkinsArtifact[]; } export interface JenkinsSourceOptions { /** Base URL of the Jenkins server (e.g., "https://ci.example.com") */ baseUrl: string; /** Username for authentication (optional) */ username?: string; /** API token for authentication (optional) */ apiToken?: string; /** Cache TTL in seconds (default: 300) */ cacheTtlSeconds?: number; } export declare class JenkinsSource extends BasePluginSource { readonly id: string; readonly name = "Jenkins CI"; readonly type: PluginSourceType; private readonly baseUrl; private username; private apiToken; /** * Create a new JenkinsSource * @param options - Configuration options */ constructor(options: JenkinsSourceOptions); /** * Encode a job path for use in URLs * Handles nested folder paths like "Folder/job/JobName" by encoding each segment * but preserving the /job/ separators * @param jobPath - The job path (e.g., "EvenMoreFish/job/EvenMoreFish" or just "JobName") * @returns Properly encoded path segment */ private encodeJobPath; /** * Set authentication credentials * @param username - Jenkins username * @param apiToken - Jenkins API token */ setCredentials(username: string, apiToken: string): void; /** * Resolve a check identifier to its effective Jenkins base URL + job path. * * Identifiers are either a bare job name/path ("Citizens2", * "Folder/job/Name") resolved against this source's configured baseUrl, or * a composite "https://ci.example.com|JobName" produced by * `encodeJenkinsIdentifier` — carrying a per-plugin CI server from registry * data (June 9 2026 audit: Citizens' ci.citizensnpcs.co was stored on the * plugin then never consumed; its job was probed on the wrong Jenkins * servers and 404'd). Per-plugin URLs are SSRF-validated here since they * bypass the constructor's validation. */ private resolveIdentifier; /** * Get plugin info by job name or composite identifier ("baseUrl|job") * @param identifier - Jenkins job name, or "baseUrl|job" for a per-plugin Jenkins server * @returns Plugin info or null if not found */ getPluginInfo(identifier: string): Promise; /** * Search for plugins (not supported by Jenkins) * Jenkins doesn't have a search API, so this returns an empty array * @param _query - Search query (unused) * @param _limit - Maximum results (unused) * @returns Empty array */ searchPlugins(_query: string, _limit?: number): Promise; /** * Get latest version (build number) for a job * @param identifier - Jenkins job name, or "baseUrl|job" for a per-plugin Jenkins server * @returns Build number as string, or null if no successful builds */ getLatestVersion(identifier: string): Promise; /** * Build the download URL for an artifact * @param jobName - Jenkins job name * @param artifactPath - Relative path to the artifact * @param baseUrl - Jenkins base URL (defaults to this source's configured baseUrl) * @returns Download URL */ buildDownloadUrl(jobName: string, artifactPath: string, baseUrl?: string): string; /** * Get all artifacts for a job's latest successful build * @param jobName - Jenkins job name * @returns Array of artifacts */ getArtifacts(jobName: string): Promise; /** * Get build information for a specific build number * @param jobName - Jenkins job name * @param buildNumber - Build number * @returns Build info or null */ getBuild(jobName: string, buildNumber: number): Promise; protected buildHeaders(additional?: Record): Record; /** * Parse Jenkins build into PluginInfo * @param job - Jenkins job information * @param build - Jenkins build information * @param baseUrl - Effective Jenkins base URL for this job (per-plugin or configured) * @returns Plugin info or null if no suitable artifact found */ private parseBuild; /** * Find the best artifact from a build * @param artifacts - List of build artifacts * @returns Best matching artifact or undefined */ private findArtifact; /** * Clean version string (remove 'v' prefix, etc.) * @param version - Raw version string * @returns Cleaned version */ private cleanVersion; } export {}; //# sourceMappingURL=jenkins.d.ts.map