GitOps Sync with Multiple Rollout Steps
Learn how to pass values between GitOps Rollout steps using Harness expressions
This advanced example demonstrates a complete pipeline that starts with a GitOps sync step followed by multiple GitOps Rollout steps, showing how to pass values between steps.
Overview
Harness provides a powerful expression system to access outputs from previous steps. This enables dynamic configuration where steps automatically discover and use the correct rollout details without hardcoding values.
Key Benefits
Dynamic Configuration: Steps automatically discover and use the correct rollout details
Reusability: The same pipeline can work across different environments and applications
Error Reduction: No hardcoded values that could become outdated
Maintainability: Changes to rollout names or namespaces are automatically reflected
Pipeline Overview
Here's a visual representation of the pipeline:

This pipeline consists of the following key steps:
Update Rollout Image: Updates the image tag in your GitOps Application's manifest
GitOps Sync: Synchronizes the GitOps Application to apply the image update, which triggers a new rollout
Resume First Pause for Rollout: Resumes the rollout from the first pause step
Any Intermediate Steps: Optional placeholder steps for custom logic
Resume Second Pause for Rollout: Resumes the rollout from the second pause step
Handle Degraded Rollout: Handles degraded rollout states with retry action
Conditional Execution For Rollout: Conditional execution based on application name
Pipeline YAML
How to Get Values from Previous Steps
Harness provides a powerful expression system to access outputs from previous steps. Here's how it works:
1. Accessing GitOps Sync Outputs
The GitOps Sync step outputs discovered rollouts that can be used in subsequent steps:

Available fields:
agentIdentifier- The GitOps agent identifierappName- The GitOps application namerolloutName- The Rollout resource namenamespace- The namespace where the rollout is deployed
2. Expression Examples
3. Multiple Rollouts
If you have multiple rollouts, access them by index:
4. Accessing Other Step Outputs
You can also access outputs from other step types:
Step-by-Step Explanation
Step 1: Update Rollout Image
Purpose: Updates the container image in your GitOps Application's manifest
Configuration: Uses the
UpdateGitOpsAppstep to modify the image tag in the rollout manifestKey Settings:
targetRevision: Git branch containing your manifestskustomize.images: Specify the new image to deployapplicationName: Your GitOps Application nameagentId: GitOps Agent identifier
Step 2: GitOps Sync
Purpose: Synchronizes the GitOps Application to apply the image update
Configuration: Uses the
GitOpsSyncstep to trigger a sync operationKey Settings:
applicationsList: List of applications to syncsyncOptions: Various sync configuration optionstimeout: Maximum time to wait for sync completion
Step 3: Resume First Pause for Rollout
Purpose: Resumes the rollout from the first pause step
Configuration: Uses the
GitOpsRolloutstep with resume actionKey Settings:
autoRolloutAction: Set toresumewaitUntilHealthStatus: Set toSuspendedto wait for pause stateUses expressions from the Sync step to get rollout details
failureStrategies: Ignore errors to continue pipeline
Step 4: Any Intermediate Steps
Purpose: Placeholder for custom logic or additional processing
Configuration: Uses the
Waitstep for simple delaysUse Cases:
Add custom validation logic
Insert additional processing steps
Create delays between operations
Step 5: Resume Second Pause for Rollout
Purpose: Resumes the rollout from the second pause step
Configuration: Uses the
GitOpsRolloutstep with resume actionKey Settings:
autoRolloutAction: Set toresumewaitUntilHealthStatus: Set toSuspendedto wait for pause stateUses expressions from the Sync step to get rollout details
Step 6: Handle Degraded Rollout
Purpose: Handles degraded rollout states with retry action
Configuration: Uses the
GitOpsRolloutstep with retry actionKey Settings:
autoRolloutAction: Set toretrywhen: Set toFailureto only run on stage failureUses expressions from the Sync step to get rollout details
Step 7: Conditional Execution For Rollout
Purpose: Conditional execution based on application name
Configuration: Uses the
GitOpsRolloutstep with restart actionKey Settings:
autoRolloutAction: Set torestartwhen: Conditional execution with custom conditionUses expressions to check application name
Best Practices
Use descriptive step identifiers for easier reference
Add timeout values appropriate for your deployment size
Include health checks for critical production deployments
Consider manual approval steps for production environments
Test expressions in the pipeline editor before saving
Related Resources
Last updated
Was this helpful?