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.
-
Create a GitHub Account or use an existing one
-
Fork this repository into your GitHub account.
-
If you are new to Harness CI, signup for Harness CI
- Select the
Continuous Integration
module and choose theStarter pipeline
wizard to create your first pipeline using the forked repo from #2. - Go to the newly created pipeline and hit the
Triggers
tab. If everything went well, you should see two triggers auto-created. APull Request
trigger and aPush
trigger. For this exercise, we only needPull Request
trigger to be enabled. So, please disable or delete thePush
trigger.
-
If you are an existing Harness CI user, create a new pipeline to use the cloud option for infrastructure and setup the PR trigger.
-
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.
-
Create a Pull Request in a new branch by updating the
build.gradle
file. (e.g. add a comment or new line). This should trigger a build in Harness CI -
Merge the PR after the pipeline runs successfully.
-
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 theActions
tab on GitHub. -
Create any other
Pull Request
with a few source or test file changes. You can consider cherry-picking any of the commits from theApache Kafka
repo such as this one -
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.