Skip to main content
2025 Python Packaging Survey is now live!  Take the survey now

An integration package connecting Jenkins and LangChain

Project description

langchain-jenkins

This package contains the LangChain integration with Jenkins

Installation

pip install -U langchain-jenkins

And you should configure credentials by setting the following environment variables:

export JENKINS_SERVER="https://example.com"
export USERNAME="admin"
export PASSWORD=""
  • TODO: fill this out

Tools

JenkinsJobRun class exposes tool models from Jenkins.

from langchain_jenkins import JenkinsAPIWrapper, JenkinsJobRun

tools = [
    JenkinsJobRun(
        api_wrapper=JenkinsAPIWrapper(
            jenkins_server="https://example.com",
            username="admin",
            password=os.environ["PASSWORD"],
        )
    )
]

Create the Jenkins job

jenkins_job_content = ""
src_file = "job1.xml"
with open(src_file) as fread:
    jenkins_job_content = fread.read()
tools[0].invoke({"job": "job01", "config_xml": jenkins_job_content, "action": "create"})

Run the job

tools[0].invoke({"job": "job01", "parameters": {}, "action": "run"})

Get job status

resp = tools[0].invoke({"job": "job01", "number": 1, "action": "status"})
if not resp["inProgress"]:
    print(resp["result"])

Delete the job

tools[0].invoke({"job": "job01", "action": "delete"})

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page