Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 3.1 KB

README.md

File metadata and controls

52 lines (38 loc) · 3.1 KB

Build and Test Apache Kafka on Harness CI

This is a fork of Apache Kafka project. This project was used to demo the new capabilities of Harness CI at Unscripted Conference 2022. This file contains instructions on how to run the Apache Kafka pipeline shown during the demo.

Setting up this pipeline on Harness CI Hosted Builds

  1. Create a GitHub Account or use an existing one

  2. Fork this repository into your GitHub account.

  3. If you are new to Harness CI, signup for Harness CI

  • Select the Continuous Integration module and choose the Starter pipeline wizard to create your first pipeline using the forked repo from #2.
  • Go to the newly created pipeline and hit the Triggerstab. If everything went well, you should see two triggers auto-created. A Pull Requesttrigger and a Pushtrigger. For this exercise, we only need Pull Requesttrigger to be enabled. So, please disable or delete the Pushtrigger.
  1. If you are an existing Harness CI user, create a new pipeline to use the cloud option for infrastructure and setup the PR trigger.

  2. Enable Test Intelligence:

  • Edit the pipeline yaml in the yaml editor to add this new step:
- step:
    type: RunTests
    name: Run Tests with Intelligence
    identifier: Run_Tests_with_Intelligence
    spec:
      language: Java
      buildTool: Gradle
      args: "--build-cache unitTest -PmaxParallelForks=32 -PignoreFailures=true"
      packages: org.apache.kafka,kafka.test,kafka.testkit,kafka.server,kafka.tools,kafka.examples,test.plugins
      runOnlySelectedTests: true
      preCommand: ls
      reports:
        type: JUnit
        spec:
          paths:
            - "**/*.xml"
  • The generated yaml should look like below.

cikafkademo

  • Create a Pull Request in a new branch by updating the build.gradlefile. (e.g. add a comment or new line). This should trigger a build in Harness CI

  • Merge the PR after the pipeline runs successfully.

  1. Enable GitHub Actions : The repository forked in Step 2 already has a GitHub Actions workflow file added. You can choose to enable this workflow from the Actions tab on GitHub.

  2. Create any other Pull Request with a few source or test file changes. You can consider cherry-picking any of the commits from the Apache Kafka repo such as this one

  3. This PR will trigger the Harness CI pipeline (as well as GitHub Actions workflow if enabled in Step-9). Depending on what files got changed in the PR, only those tests related to the changed source/test code will be selected to run in the Harness pipeline. GitHub Actions workflow, however, will run all the unit tests for every PR.