Allows performing serialization on an object
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| data | object | - | |
| replacer | array | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| serialized | string | - |
Usage Examples
Serialize Helm values and inject into a chart
This serializes a structured object to YAML for a Helm values file. Use it to compute values from parameters and pass them into fetch:template for file generation.
steps:
- id: serializeHelmValues
action: roadiehq:utils:serialize:yaml
input:
data:
replicaCount: ${{ parameters.replicas }}
image:
repository: ghcr.io/acme/${{ parameters.serviceName }}
tag: ${{ parameters.imageTag }}
pullPolicy: IfNotPresent
resources:
limits:
cpu: "500m"
memory: "512Mi"
requests:
cpu: "200m"
memory: "256Mi"
env:
- name: APP_ENV
value: ${{ parameters.environment }}
- name: LOG_LEVEL
value: info
- id: generateFiles
action: fetch:template
input:
url: https://github.com/acme/platform-templates//helm-service
targetPath: .
values:
serviceName: ${{ parameters.serviceName }}
valuesYaml: ${{ steps.serializeHelmValues.output.serialized }}Serialize selected env vars to a ConfigMap using replacer
This serializes a flat object to YAML while whitelisting keys with replacer. Use it to exclude sensitive fields before passing the result to fetch:template for Kubernetes manifests.
steps:
- id: serializeConfigData
action: roadiehq:utils:serialize:yaml
input:
data:
APP_NAME: ${{ parameters.serviceName }}
APP_ENV: ${{ parameters.environment }}
LOG_LEVEL: debug
DEBUG: "false"
SECRET_KEY: ${{ parameters.secretKey }}
replacer:
- APP_NAME
- APP_ENV
- LOG_LEVEL
- DEBUG
- id: generateConfigMap
action: fetch:template
input:
url: https://github.com/acme/platform-templates//k8s-configmap
targetPath: .
values:
name: ${{ parameters.serviceName }}-config
namespace: ${{ parameters.namespace }}
configDataYaml: ${{ steps.serializeConfigData.output.serialized }}