A2oz

How do I add a project in Jenkins workspace?

Published in Jenkins 2 mins read

You can add a project to your Jenkins workspace by creating a new job. Here's a breakdown of the process:

1. Access Jenkins

  • Open your web browser and navigate to your Jenkins server's URL.
  • Log in using your credentials.

2. Create a New Job

  • Click on "New Item" in the left sidebar.
  • Enter a descriptive name for your project.
  • Choose the appropriate job type from the available options. The most common types are:
    • Freestyle Project: Offers flexibility in configuring build steps and triggers.
    • Pipeline: Defines build processes using a code-based approach.
    • Multibranch Pipeline: Automatically manages and builds branches from a version control system.

3. Configure the Job

  • After selecting the job type, you'll be directed to the configuration page.
  • Customize the job according to your project's needs. This includes:
    • Source Code Management: Specify the repository (e.g., Git, SVN) and branch where your code resides.
    • Build Triggers: Define when to start a build (e.g., scheduled, on commit, manually).
    • Build Steps: Add tasks to be performed during the build (e.g., compiling, testing, deploying).
    • Post-Build Actions: Configure actions to be executed after the build completes (e.g., email notifications, archiving artifacts).

4. Save the Job

  • Once you've finished configuring the job, click "Save" to create the project.

5. Access the Workspace

  • Your new project's workspace will be located within the Jenkins server's file system.
  • The specific path can be found in the project's configuration page, usually under the "Workspace" section.

You can now access the project's workspace and work with the source code and build artifacts.

Examples:

  • Freestyle Project: To build a simple Java application from a Git repository, you would configure a Freestyle project with the Git repository URL, a build step to compile the code, and a post-build action to archive the compiled JAR file.
  • Pipeline: To define a complex build pipeline for a web application, you would create a Pipeline job with a Groovy script that specifies the build steps, including code checkout, unit testing, deployment, and integration with external services.

Related Articles