LogoLogo
HomeBlogGitHubGet Started FreeLogin
Earthly 0.7
Earthly 0.7
  • 👋Introduction
  • 💻Install Earthly
  • 🎓Learn the basics
    • Part 1: A simple Earthfile
    • Part 2: Outputs
    • Part 3: Adding dependencies With Caching
    • Part 4: Args
    • Part 5: Importing
    • Part 6: Using Docker In Earthly
    • Part 7: Using remote runners
    • Part 8a: Using Earthly in your current CI
    • Final words
  • ⭐Featured guides
    • Rust
  • 📖Docs
    • Guides
      • Importing
      • Build arguments and secrets
      • Functions
      • Using Docker in Earthly
      • Multi-platform builds
      • Authenticating Git and image registries
      • Integration Testing
      • Debugging techniques
      • Podman
      • Configuring registries
        • AWS ECR
        • GCP Artifact Registry
        • Azure ACR
        • Self-signed certificates
      • Using the Earthly Docker Images
        • earthly/earthly
        • earthly/buildkitd
      • ✅Best practices
    • Caching
      • Caching in Earthfiles
      • Managing cache
      • Caching via remote runners
      • Caching via a registry (advanced)
    • Remote runners
    • Earthfile reference
      • Builtin args
      • Excluding patterns
      • Version-specific features
    • The earthly command
    • Earthly lib
    • Configuration reference
    • Examples
    • Misc
      • Alternative installation
      • Data collection
      • Definitions
      • Public key authentication
  • 🔧CI Integration
    • Overview
    • Use the Earthly CI Image
    • Build your own Earthly CI Image
    • Pull-Through Cache
    • Remote BuildKit
    • Vendor-Specific Guides
      • Jenkins
      • Circle CI
      • GitHub Actions
      • AWS CodeBuild
      • Kubernetes
      • Google Cloud Build
      • GitLab CI/CD
      • Woodpecker CI
      • Bitbucket Pipelines
  • ☁️ Earthly Cloud
    • Overview
    • Managing permissions
    • Cloud secrets
    • Earthly Satellites
      • Managing Satellites
      • Using Satellites
Powered by GitBook
On this page
  • Overview
  • Compatibility
  • Resources
  • Setup (Standalone)
  • Setup (Docker Cloud)
  • Dependencies
  • Installation
  • Configuration
  • Additional Notes
  • Example
  • Notes

Was this helpful?

Edit on GitHub
  1. CI Integration
  2. Vendor-Specific Guides

Jenkins

PreviousVendor-Specific GuidesNextCircle CI

Last updated 2 years ago

Was this helpful?

Overview

Jenkins has multiple modes of operation, and each of them require some consideration when installing Earthly. These modes include:

  • Standalone, dedicated runners

  • Ephemeral cloud runners

Compatibility

Earthly has been tested with Jenkins in a standalone runner configuration, and using the Docker Cloud provider.

Resources

Setup (Standalone)

This should not differ in any meaningful way from the steps outlined in the .

Setup (Docker Cloud)

Dependencies

Ensure that the Docker Cloud provider is installed and has a Docker daemon available. The Cloud provider does not provide a daemon.

Installation

ARG VERSION=4.9
RUN apk add --update --no-cache curl bash git git-lfs openssh-client openssl procps \
  && curl --create-dirs -fsSLo /usr/share/jenkins/agent.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar \
  && chmod 755 /usr/share/jenkins \
  && chmod 644 /usr/share/jenkins/agent.jar \
  && ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar \
  && apk del curl

VERSION is the version of the Jenkins runner to install.

Configuration

Set DOCKER_HOST to point at a Docker daemon. This can easily be passed through by checking "Expose Docker Host" in the runner template configuration.

Additional Notes

earthly misinterprets the Jenkins environment as a terminal. To hide the ANSI color codes, set NO_COLOR to 1.

Example

Note

earthly ./jenkins+start

This will start a local Jenkins server, minimally configured to spawn earthly builds using the Docker cloud plugin.

  • Click "New Item", on the left

  • Choose "Pipeline", give it a name (we chose "test"), and click "OK".

  • Scroll down to the "Pipeline" section.

  • Make the following changes:

    • Choose "Pipeline script from SCM" for the Definition

    • Choose "Git" as the SCM, once the option appears

    • Set the branch specifier to */main

  • Once those changes are made, click "Save". Jenkins will navigate to the Pipelines' main page. Once there, click "Build Now"

  • Find the build in your build history, and watch it go!

Notes

If you broke the example environment, you can run earthly ./jenkins+cleanup to clean up before trying to run again from scratch.

TLS

To allow the docker client to access a daemon protected with TLS, you will need to add Jenkins credentials. Add the client key, certificate, and the server CA certificate as a credential. In our example, using the Docker Cloud provider, you can add them by choosing "Manage Jenkins", then "Manage Nodes and Clouds", and finally "Configure Clouds". Then, choose the cloud to configure for TLS, and click the "Add" button here:

Also, ensure that you are using the correct port for TLS. In this image of our example cloud, we are using port 2375, which is traditionally the insecure port for a docker daemon. In a TLS environment, docker expects port 2376.

Assuming you are following the steps outlined in the , here are the additional things you need to configure:

You'll need to . Heres an example of what this might look like, when basing your runner off our earthly/earthly image:

This example is not production ready, and is intended to showcase configuration needed to get Earthly off the ground. If you run into any issues, or need help, !

You can find our .

To run it yourself, clone the , and then run (from the root of the repository):

To run a build in this demo, you will need to configure a build pipeline. To do that, we have an . To configure the build pipeline for the example project:

Open the Jenkins demo by going to

Set the repository URL to

The example purposely runs a Docker-In-Docker (DIND) container without TLS for simplicity. This is not a recommended configuration.

If you are using an external earthly-buildkitd with Jenkins, . You will need to add the keys and certificates used there as credentials too.

🔧
Installing Jenkins
Docker Cloud Plugin
Jenkins Credentials
overview
overview
create your own runner image
don't hesitate to reach out
Jenkins example on GitHub
ci-examples repository
example project with a Jenkinsfile
http://localhost:8000
https://github.com/earthly/ci-example-project
Configuring TLS inside Docker.
you should be using mTLS
Jenkins Dashboard with "New Item" highlighted
Setting up a new build named test, configured as a Jenkins pipeline
Configuring all the SCM options for the build
Jenkins Dashboard for the example build, with "Build Now" highlighted
Console output in Jenkins from the test build
Configuring Docker credentials in Jenkins