Documentation
¶
Index ¶
- func BuildTestDeploy(name, namespace, buildImage, testImage, deployImage string, ...) (*v1alpha1.Workflow, error)
- func BuildTestDeployWithCleanup(name, namespace, buildImage, cleanupImage string, opts ...builder.Option) (*v1alpha1.Workflow, error)
- func ConditionalDeploy(name, namespace, image string, opts ...builder.Option) (*v1alpha1.Workflow, error)
- func FanOutFanIn(name, namespace, image string, tasks []string, opts ...builder.Option) (*v1alpha1.Workflow, error)
- func MapReduce(name, namespace, image string, inputs []string, mapCmd, reduceCmd string, ...) (*v1alpha1.Workflow, error)
- func MultiEnvironmentDeploy(name, namespace, deployImage string, environments []string, ...) (*v1alpha1.Workflow, error)
- func ParallelDataProcessing(name, namespace, image string, dataItems []string, processingCommand string, ...) (*v1alpha1.Workflow, error)
- func ParallelDeployment(name, namespace, deployImage string, environments []string, ...) (*v1alpha1.Workflow, error)
- func ParallelTestSuite(name, namespace, image string, testSuites map[string]string, ...) (*v1alpha1.Workflow, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTestDeploy ¶
func BuildTestDeploy(name, namespace, buildImage, testImage, deployImage string, opts ...builder.Option) (*v1alpha1.Workflow, error)
BuildTestDeploy creates a simple CI/CD workflow pattern with build, test, and deploy stages. This is a common pattern for continuous integration and deployment pipelines.
Example:
wf := patterns.BuildTestDeploy(
"myapp", "argo",
"golang:1.25",
"myregistry/myapp:latest",
"myregistry/deployer:v1",
)
func BuildTestDeployWithCleanup ¶
func BuildTestDeployWithCleanup(name, namespace, buildImage, cleanupImage string, opts ...builder.Option) (*v1alpha1.Workflow, error)
BuildTestDeployWithCleanup creates a CI/CD workflow with cleanup on exit. The cleanup always runs regardless of workflow success or failure.
Example:
wf := patterns.BuildTestDeployWithCleanup(
"myapp", "argo",
"golang:1.25",
"busybox:latest",
)
func ConditionalDeploy ¶
func ConditionalDeploy(name, namespace, image string, opts ...builder.Option) (*v1alpha1.Workflow, error)
ConditionalDeploy creates a workflow that deploys only if tests pass and rolls back if the deployment fails. It demonstrates conditional execution using the 'when' clause combined with 'continueOn' so the rollback step is actually reachable.
Execution semantics:
- test runs first. If it fails, the workflow aborts (nothing is deployed, so there is nothing to roll back) and the workflow is marked Failed.
- deploy runs only when test Succeeded ({{steps.test.status}} == Succeeded). It sets continueOn.failed so that a deploy failure does NOT abort the workflow before the rollback step can evaluate its condition.
- rollback runs only when deploy Failed ({{steps.deploy.status}} == Failed). Because deploy tolerates failure via continueOn, the rollback is recovery logic and the workflow completes rather than aborting mid-deploy.
Note: gating on step status ({{steps.X.status}}) rather than {{steps.X.outputs.exitCode}} avoids depending on the step actually emitting an exitCode output, which Argo only populates for templates that declare it.
Example:
wf := patterns.ConditionalDeploy(
"conditional-deploy", "argo",
"golang:1.25",
)
func FanOutFanIn ¶
func FanOutFanIn(name, namespace, image string, tasks []string, opts ...builder.Option) (*v1alpha1.Workflow, error)
FanOutFanIn creates a workflow that executes multiple tasks in parallel, then aggregates results in a final step.
Example:
wf := patterns.FanOutFanIn(
"parallel-processing", "argo",
"busybox:latest",
[]string{"task-1", "task-2", "task-3"},
)
func MapReduce ¶
func MapReduce(name, namespace, image string, inputs []string, mapCmd, reduceCmd string, opts ...builder.Option) (*v1alpha1.Workflow, error)
MapReduce creates a map-reduce style workflow where: 1. Map phase: Process items in parallel 2. Reduce phase: Aggregate results sequentially
Example:
wf := patterns.MapReduce(
"word-count", "argo",
"alpine:latest",
[]string{"file1.txt", "file2.txt", "file3.txt"},
"wc -w", // map command
"awk '{sum+=$1} END {print sum}'", // reduce command
)
func MultiEnvironmentDeploy ¶
func MultiEnvironmentDeploy(name, namespace, deployImage string, environments []string, opts ...builder.Option) (*v1alpha1.Workflow, error)
MultiEnvironmentDeploy creates a workflow that deploys to multiple environments sequentially.
Example:
wf := patterns.MultiEnvironmentDeploy(
"multi-env-deploy", "argo",
"myregistry/deployer:v1",
[]string{"staging", "production"},
)
func ParallelDataProcessing ¶
func ParallelDataProcessing(name, namespace, image string, dataItems []string, processingCommand string, opts ...builder.Option) (*v1alpha1.Workflow, error)
ParallelDataProcessing creates a workflow that processes multiple data items in parallel. Each item is processed independently with the same processing logic.
Example:
wf := patterns.ParallelDataProcessing(
"batch-processor", "argo",
"myregistry/processor:v1",
[]string{"data-1.csv", "data-2.csv", "data-3.csv"},
"process.sh",
)
func ParallelDeployment ¶
func ParallelDeployment(name, namespace, deployImage string, environments []string, opts ...builder.Option) (*v1alpha1.Workflow, error)
ParallelDeployment creates a workflow that deploys to multiple environments in parallel. This is useful when environments are independent and can be deployed simultaneously.
Example:
wf := patterns.ParallelDeployment(
"multi-region-deploy", "argo",
"myregistry/deployer:v1",
[]string{"us-west", "us-east", "eu-central"},
)
func ParallelTestSuite ¶
func ParallelTestSuite(name, namespace, image string, testSuites map[string]string, opts ...builder.Option) (*v1alpha1.Workflow, error)
ParallelTestSuite creates a workflow that runs multiple test suites in parallel. This is useful for speeding up CI/CD pipelines with independent test suites.
Example:
wf := patterns.ParallelTestSuite(
"test-suite", "argo",
"golang:1.25",
map[string]string{
"unit": "go test ./internal/...",
"integration": "go test ./tests/integration/...",
"e2e": "go test ./tests/e2e/...",
},
)
Types ¶
This section is empty.