You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Click the desired project; everything will be scoped to that project
Changing harness modules
As part of this lab, we will switch between modules several times
In order to switch modules:
Click on the nine dot menu icon
Select the module relevant to the step
The lab begins in the CI/CD module
Lab 1: Build
Key Outcomes
Configure a basic CI pipeline
Build and push artifacts to a remote repository
Run unit tests to verify build success
Overview
In this lab, the user sets up a CI pipeline that runs source code tests, builds the executable, and pushes the artifact to a remote Docker repository. This establishes the foundation for a deployable artifact that can be promoted through environments.
Walkthrough
Step 1: Create a Pipeline
In the Harness UI, from the left-hand menu, navigate to Projects and select your assigned project
From the left-hand side menu, select Pipelines
Click + Create a Pipeline, enter the following values, then click Start
Input
Value
Notes
Name
workshop
How do you want to setup your pipeline
Inline
This indicates that Harness (rather than Git) will be the source of truth for the pipeline
Step 2: Add a Build Stage
From Pipeline Studio, click Add Stage and select Build as the Stage Type
Enter the following values and click on Set Up Stage
Input
Value
Notes
Stage Name
Build
Clone Codebase
Enabled
Repository Name
harness-devsecops
Step 3: Configure Infrastructure
Navigate to the Infrastructure tab
Configure as follows:
Input
Value
Notes
Infrastructure
Cloud
Step 4: Configure Execution Steps
Navigate to the Execution tab and add the following steps:
Test Intelligence Step
Click Add Step, then Add Step again
Select Test Intelligence from the Step Library
Input
Value
Notes
Name
Run Tests With Intelligence
Command
pip install pytest & cd ./python-tests
The GitHub repo is a monorepo with application(s) and configuration in the same repo. Therefore we need to navigate to the application subfolder.
Click Apply Changes
Compile Application (Template)
Click Add Step, then Use Template
Select the Compile Application template
Input
Value
Notes
Name
Compile
Click Apply Changes
Build and Push to Docker
Click Add Step, then Add Step again
Select Build and Push an image to Docker Registry from the Step Library
Input
Value
Notes
Name
Push to DockerHub
Docker Connector
dockerhub
Docker Repository
nikpap/harness-workshop
Tags
<+variable.username>-<+pipeline.sequenceId>
Click on the pin and select expression and paste the value
Optional Configuration
Dockerfile
/harness/frontend-app/harness-webapp/Dockerfile
This tells Harness where the Dockerfile is for building the app
Context
/harness/frontend-app/harness-webapp
This tells from where to run the instructions included in the Dockerfile
Click Apply Changes
Step 5: Save and Test the Pipeline
Click Save to finalize the pipeline
Click Run to manually execute it
Input
Value
Notes
Branch Name
main
Prepopulated
Warning
Pipeline execution is rejected by the policy engine, let's create a compliant pipeline
Proceed to the Lab 2: DevSecOps
Lab 2: DevSecOps
Key Outcomes
Understand how governance plays a role in the path to production
Leverage reusable templates to standardize security scanning
Achieve DevSecOps practices with minimal developer friction
Overview
In this lab, the security team has implemented orchestration of Fortify and OWASP scans in reusable templates. Policies enforce the inclusion of these templates in all pipelines, ensuring security scans are always executed before deployment.
Walkthrough
Step 1: Add Security Scanning Steps
In the existing pipeline, within the Build stage, before the Push to DockerHub step, click the + icon to add a new step
Select Use Template
Select DevX Fortify Scan
Input
Value
Notes
Name
Fortify
Click Apply Changes
Step 2: Add OWASP Scan
In the existing pipeline, within the Build stage, after the Push to DockerHub step, click the + icon to add a new step
Select Use Template
Select OWASP
Input
Value
Notes
Name
OWASP
Click Apply Changes
Step 3: Run the Pipeline
Click Save and then Run to execute the pipeline
Input
Value
Notes
Branch Name
main
After the Build and Push stage is complete, navigate to the Security Tests tab to see the deduplicated, normalized, and prioritized list of vulnerabilities discovered across your scanners
Value Callouts
Aspect
Description
Shift Left Security
Security scans run during the build phase, catching vulnerabilities before deployment.
Template Reusability
Security steps are defined once and reused across all pipelines, ensuring consistency.
Policy Enforcement
Governance policies ensure security scans cannot be skipped.
Unified View
All vulnerabilities are deduplicated and prioritized in a single dashboard.
Lab 3: Continuous Deploy - Frontend
Key Outcomes
Extend pipelines with deployment stages
Deploy Kubernetes services
Create custom Harness variables
Overview
In this lab, the user extends the existing pipeline to take the artifact built in the CI/Build stage and deploy it to a Kubernetes environment using a rolling deployment strategy.
Walkthrough
Step 1: Add a Deployment Stage
In the existing pipeline, click Add Stage and select Deploy as the Stage Type
Enter the following values and click Set Up Stage
Input
Value
Notes
Stage Name
frontend
Deployment Type
Kubernetes
Step 2: Configure Service
Click + Add Service and configure as follows:
Input
Value
Notes
Name
frontend
Deployment Type
Kubernetes
Add Manifest
Manifest Type
K8s Manifest
K8s Manifest Store
Code
Manifest Identifier
templates
Repository
harness-devsecops
Branch
main
File/Folder Path
harness-deploy/frontend/manifests
Values.yaml
harness-deploy/frontend/values.yaml
Add Artifact Source
Artifact Repository Type
Docker Registry
Docker Registry Connector
dockerhub
Artifact Source Identifier
frontend
Image Path
nikpap/harness-workshop
Tag
<+variable.username>-<+pipeline.sequenceId>
Select value, then click on the pin and select expression and paste the value
Click Save to close the service window and then click Continue
Step 3: Configure Environment
The target infrastructure has been pre-created. The application will be deployed to a Kubernetes cluster on the given namespace.
Click - Select - on the Specify Environment input box
Select prod environment and click Apply Selected
Input
Value
Notes
Name
prod
Make sure to select the environment and infrastructure definition
Click - Select - on the Specify Infrastructure input box
From the dropdown select k8s
Input
Value
Notes
Name
k8s
Click Continue
Step 4: Configure Execution Strategy
Select Rolling and click Use Strategy
The frontend is a static application, so no need for canary deployment
Step 5: Save and Run
Click Save to finalize the deployment stage
Click Run to execute the pipeline
Input
Value
Notes
Branch Name
main
Value Callouts
Aspect
Description
Unified Pipeline
CI and CD are managed in a single pipeline, reducing handoffs.
Kubernetes Native
Harness provides native Kubernetes support with manifest management.
Environment Reusability
Environments and infrastructure can be reused across multiple services.
Lab 4: Continuous Deploy - Backend
Key Outcomes
Utilize complex deployment strategies to reduce blast radius
Implement approval gates for production deployments
Overview
In this lab, the user adds a backend deployment stage using a canary deployment strategy with manual approval gates to minimize risk during production releases.
Walkthrough
Step 1: Add Backend Deployment Stage
In the existing pipeline, click Add Stage and select Deploy as the Stage Type
Enter the following values and click Set Up Stage
Input
Value
Notes
Stage Name
backend
Deployment Type
Kubernetes
Step 2: Configure Service
Click - Select - on the Select Service input box
Select backend
Input
Value
Notes
Name
backend
Click Apply Selected and then click Continue
Step 3: Configure Environment
The target infrastructure has been pre-created and was used in the previous stage. To reuse the same environment:
Click - Propagate Environment From
Select Stage [frontend]
Click Continue
Step 4: Configure Canary Deployment
Select Canary and click Use Strategy
After the canary deployment and before the canary delete step, add a Harness Approval step
Input
Value
Notes
Name
Approval
User Groups
All Project Users
Select project to see the "All Project Users" option
Click Apply Changes
Step 5: Save and Run
Click Save and then click Run to execute the pipeline
Input
Value
Notes
Branch Name
main
While the canary deployment is ongoing and waiting for approval, navigate to the web page and see if you can spot the canary (use the check release button)
From the left hand side menu navigate to project settings
Select project variables
The url can exist within the lab_endpoint variable
Step 6: Replace manual approval with continuous verification
Edit the existing pipeline
Select the backend stage and find the Harness Approval between the Canary Deploy and Canary Destroy steps
Delete the Harness Approval step
After the canary deployment and before the canary delete step, add a Verify step
Input
Value
Notes
Name
Verify
Continuous Verification Type
Canary
Duration
5 min
Click Save and then click Run to execute the pipeline
Input
Value
Notes
Branch Name
main
Value Callouts
Aspect
Description
Progressive Delivery
Canary deployments reduce risk by gradually rolling out changes.
Manual Gates
Approval steps ensure human oversight for critical deployments.
Environment Propagation
Reusing environments across stages reduces configuration duplication.
Lab 5: Validate Release
Key Outcomes
Identify traffic differences between normal and canary instances
Automate release validation
Overview
In this lab, the user validates canary deployments by observing traffic distribution and monitoring application behavior during progressive rollouts.
Walkthrough
Step 1: Observe Canary Traffic
While the canary deployment is ongoing, navigate to the web page
From the left hand side menu navigate to project settings
Select project variables
The url can exist within the lab_endpoint variable
Drill down to the Distribution Test tab
Click the Start button to run traffic generation
Observe the traffic distribution between canary and stable instances
Step 2: Validate Pipeline Execution
Return to the pipeline execution in Harness
Validate the outcome of the verification step
Observe how Harness automatically evaluates metrics during the canary phase
Bonus Activities
If verification fails, Harness defaults to manual intervention. Decide what happens next (rollback, ignore, etc.)
Add a canary rollout from 10% to 50% traffic and observe how this impacts traffic distribution
Canary deployments allow controlled traffic distribution for risk mitigation.
Lab 6: Governance / Policy as Code
Key Outcomes
Create policies that evaluate when editing pipelines
Create policies that evaluate during pipeline execution
Test policy enforcement
Overview
In this lab, the user creates and applies policies as code to enable governance and promote self-service. Policies ensure that critical steps like approvals are always included in production pipelines.
Walkthrough
Step 1: Create a Policy to Require Approvals
From the secondary menu, select Project Settings
Under Security & Governance Select Policies
Click New Policy
Enter new policy name
Click Apply
From the suggested list , select Pipeline - Approval and click Use This Sample
Click Save
Input
Value
Notes
Policy Name
Production Approvals
Click Policy Sets
Click New Policy Set
Click Continue
Click +Add Policy
Select Production Approvals
Select Error & Exit for failure strategy
Click Apply
Click Finish
Toggle enabled for the **
Set the values according to the table below and confirm
Input
Value
Notes
Policy Set Name
Production Policies
Entity Type
Pipeline
Trigger Event
On Run
Failure Strategy
Error & exit
Step 2: Test the Policy
Open your pipeline
Try to run the pipeline and note the failure due to lack of an approval stage
Click Save and note the failure due to lack of an approval stage
Step 3: Add Approval Steps to Satisfy Policy
Frontend Stage
Open the pipeline in edit mode and navigate to the frontend stage
Before the rolling deployment step, add a Harness Approval step
Input
Value
Notes
Step Name
Approval
Type of Approval
Harness Approval
User Groups
All Project Users
Click Apply Changes
Backend Stage
Navigate to the backend stage
Before the canary deployment block, add a Harness Approval step with the same configuration
Click Save and note that the save succeeds without any policy failure
Value Callouts
Aspect
Description
Guardrails, Not Roadblocks
Policies surface issues early without slowing down developers who follow best practices.
Policy-as-Code
Governance is defined in code and version-controlled—just like everything else.
Scalable Compliance
Teams can move fast while meeting security and audit requirements at scale.
Lab 7: Governance / Policy as Code (Advanced)
Key Outcomes
Block critical CVEs from reaching production
Enforce security policies during runtime
Overview
In this lab, the user creates an advanced policy that blocks deployments when critical vulnerabilities are detected by security scanners like OWASP.
Walkthrough
Step 1: Create a Policy to Block Critical CVEs
From the secondary menu, select Project Settings
Select Policies
Click the Policies tab
Click + New Policy
Input
Value
Notes
Name
Runtime OWASP CVEs
Click Apply
Set the REGO policy to the following and click Save