Back to Flutter Inner Source homepage
inner source

Using Jenkins with GitHub

Basic Github Jenkins Integration

A basic integration means the ability for a Jenkins Job to build code from Github, by manual trigger, without any automatic triggers or webhooks.

  1. Manual Jenkins job push trigger configuration through Jenkins UI

    1. Navigate to your jenkins Job and in General section check GitHub Project and add the path to your project.
      Be careful to not add .git at the end of path, you can take the path from browser
      Add project path
    2. Go to Source Code Management section and configure it like following Source Code Management
    3. Go to Build Triggers section and check GitHub hook trigger for GITScm polling
      Build triggers

    4. Save the job.
    5. A webhook should have been created in Github after saving the job with the endpoint https://jkm/github-webhook/, we don’t need to edit it.
      GitHub Webhook
  2. Jenkins job push trigger using Jenkins Job Builder

    1. Go to your TLA_JOB.yml file and add the following lines inside your job or template definition, with the name of your Github project instead of <PROJECT_NAME> (i.e.: github_jenkins).

      properties:
        - github_project:
          project_path: "<PROJECT_NAME>"
      scm:
        - clone_github_project:
          project_path: "<PROJECT_NAME>"
      triggers:
        - github
      
    2. Run https://jenkins-prd/job/util_jenkins_job_builder/ for your jenkins job
    3. A webhook should have been created in Github.
      GitHub Webhook

Trigger Jenkins job on Github Pull Request

This enables Github to automatically trigger a Jenkins Job when a Pull Request (Merge Request) is created, using a webhook.

We don’t need to configure the webhook, Jenkins will configure it automatically using svc-jenkins-admin user.

  1. Jenkins job Pull Request trigger using Jenkins Job Builder

    1. Go to your TLA_JOB.yml file and add the following lines inside your job or template definition, with the name of your Github project instead of <PROJECT_NAME>. (i.e.: github_jenkins)

      
      properties:
      - github_project:
          project_path: "<PROJECT_NAME>"
      scm:
      - clone_github_pull_request:
          project_path: "<PROJECT_NAME>"
      triggers:
      - github_trigger_on_pull_requests
      
      
    2. Run https://jenkins-prd/job/util_jenkins_job_builder/ for your jenkins job
    3. A webhook should have been created in Github with the endpoint https://jkm/github-webhook/, we don’t need to edit it.
      GitHub Webhooks