Swiftorial Logo
Home
Swift Lessons
Matchups
CodeSnaps
Tutorials
Career
Resources

Setting up Windows Agents

1. Introduction

Windows agents are essential for running Jenkins jobs on Windows machines. This lesson guides you through setting up Jenkins agents on Windows, enabling seamless integration and execution of tasks.

2. Pre-Requisites

  • Jenkins server already installed and running
  • Windows machine with administrative access
  • Java Runtime Environment (JRE) installed on the Windows machine
  • Network access to the Jenkins server

3. Installation Steps

  1. Download the Jenkins agent.jar file from the Jenkins master server.
  2. Open a command prompt on the Windows machine and create a directory for the agent:
    mkdir C:\jenkins-agent
  3. Move the downloaded agent.jar file into the created directory:
    move agent.jar C:\jenkins-agent
  4. Run the agent using the following command (replace <JENKINS_URL> and <NODE_SECRET> accordingly):
    java -jar C:\jenkins-agent\agent.jar -jnlpUrl <JENKINS_URL>/computer/<NODE_NAME>/jenkins-agent.jnlp -secret <NODE_SECRET>

4. Configuration

After installation, you need to configure the Windows agent:

  • Ensure the agent is connected to the Jenkins master by checking the node status in Jenkins.
  • Configure system properties and environment variables as needed for your builds.
  • Set up tools such as MSBuild, Maven, or any other dependencies required for your projects.

5. Best Practices

  • Run Jenkins agents as a service for better management and automatic startup.
  • Regularly update the Jenkins agent to ensure compatibility and security.
  • Monitor agent performance and resource usage to optimize build times.
  • Implement security best practices like using secure connections and limiting permissions.

6. FAQ

What is an agent in Jenkins?

An agent is a machine that Jenkins uses to execute jobs. It can be a physical or virtual machine.

How do I check if my Windows agent is connected?

Go to Jenkins dashboard, click on "Manage Jenkins" > "Manage Nodes", and check the status of your node.

Can I run multiple agents on the same Windows machine?

Yes, but ensure that each agent has a unique configuration and does not conflict with others.