Test cases / yaml

deft yaml merge

Deep-merge files; later files win

2 runs on real files, 3 tests on generated files, not shown. 0 failed.

Fixed cases

Generated files, compared with ground truth by tools other than deft.

two real filesPassed

deft yaml merge redis-leader-deployment.yaml frontend-deployment.yaml -o out.yaml

Input

apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: frontend
spec:
  selector:
    matchLabels:
      app: guestbook
      tier: frontend
  replicas: 3
  template:
    metadata:
      labels:
        app: guestbook
        tier: frontend
    spec:
      containers:
      - name: php-redis
        image: gcr.io/google-samples/gb-frontend:v5
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 200m
            memory: 100Mi
        
        env:
        - name: GET_HOSTS_FROM
          value: dns
          # If your cluster config does not include a dns service, then to
          # instead access environment variables to find service host
          # info, comment out the 'value: dns' line above, and uncomment the
          # line below:
          # value: env
        ports:
        - containerPort: 80
        readinessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 5
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 15
          periodSeconds: 20
apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: redis-leader
spec:
  selector:
    matchLabels:
      app: redis
      role: leader
      tier: backend
  replicas: 1
  template:
    metadata:
      labels:
        app: redis
        role: leader
        tier: backend
    spec:
      containers:
      - name: leader
        image: registry.k8s.io/redis@sha256:cb111d1bd870a6a471385a4a69ad17469d326e9dd91e0e455350cacf36e1b3ee  # or just image: redis
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 6379

Output

out.yaml 1.3 KB
apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: frontend
spec:
  selector:
    matchLabels:
      app: guestbook
      role: leader
      tier: frontend
  replicas: 3
  template:
    metadata:
      labels:
        app: guestbook
        role: leader
        tier: frontend
    spec:
      containers:
      - name: php-redis
        image: gcr.io/google-samples/gb-frontend:v5 # or just image: redis
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 200m
            memory: 100Mi
        env:
        - name: GET_HOSTS_FROM
          value: dns
        # If your cluster config does not include a dns service, then to
        # instead access environment variables to find service host
        # info, comment out the 'value: dns' line above, and uncomment the
        # line below:
        # value: env
        ports:
        - containerPort: 80
        readinessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 5
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 15
          periodSeconds: 20
What it printed
ok yaml.merge redis-leader-deployment.yaml frontend-deployment.yaml -> out.yaml  1KB  0.01s
Automatic checks (1)
  • python: code = "import yaml; d = yaml.safe_load(open('out.yaml')); assert d['kind'] == 'Deployment' and d['metadata']['name'] == 'frontend', d['metadata']"

Real-file tasks

Real files and a plain-language job, from the agent benchmark. These are the reference answers, not an agent run.

Layer two configsPassed

Merge prod.yaml over config.yaml and save the result as final.yaml.

deft yaml merge config.yaml prod.yaml -o final.yaml

Input

config.yaml 16.0 KB
# Artifact Hub Chart default configuration values

# Common labels to add to all resources
commonLabels: {}

imagePullSecrets: []
imageTag: ""
nameOverride: ""
pullPolicy: IfNotPresent
nodeSelector: {}
tolerations: []

# Enable dynamic resource name prefix
#
# Enabling the dynamic resource name prefix ensures that the resources are named dynamically based on the Helm
# installation's name. This allows multiple installations of this chart in a single Kubernetes namespace. The prefix
# can be defined by using the `fullnameOverride`.
dynamicResourceNamePrefixEnabled: false

# Overwrites the installation's fullname generation (used for the dynamic resource name prefix)
fullnameOverride: ""

# Enable restricted HTTP client
#
# Artifact Hub makes external HTTP requests for several purposes, like getting repositories metadata, dispatching
# webhooks, etc. When this option is enabled, requests to the private network space as well as to some other special
# addresses won't be allowed.
restrictedHTTPClient: false

# Logging configuration
log:
  # Log level
  # Options: "trace", "debug", "info", "warn", "error", "fatal", "panic"
  level: info
  # Enable pretty logging
  pretty: false

# Database configuration
db:
  host: ""
  port: "5432"
  database: hub
  user: hub
  password: hub
  sslmode: prefer

# Email configuration
email:
  # From name used in emails
  fromName: ""
  # From address used in emails. This field is required if you want to enable email sending in Artifact Hub
  from: ""
  # Reply-to address used in emails
  replyTo: ""
  # SMTP server configuration
  smtp:
    # Authentication mechanism
    # Options: "login", "plain"
    auth: plain
    # SMTP host. This field is required if you want to enable email sending in Artifact Hub
    host: ""
    # SMTP port. This field is required if you want to enable email sending in Artifact Hub
    port: 587
    username: ""
    password: ""

# Credentials
creds:
  # Docker registry username
  dockerUsername: ""
  # Docker registry password
  dockerPassword: ""

# Images configuration
images:
  # Images store
  # Options: "pg"
  store: pg

# Events configuration
events:
  # Enable repository scanning errors events
  scanningErrors: false
  # Enable repository tracking errors events
  trackingErrors: false

# Database migrator configuration
dbMigrator:
  job:
    image:
      # Database migrator image repository (without the tag)
      repository: artifacthub/db-migrator
    # Optionally specify extra list of additional labels for the dbMigrator job
    extraJobLabels: {}
    # Optionally specify extra list of additional labels for the dbMigrator pod
    extraPodLabels: {}
    # Limits the lifetime of the job after it has finished execution
    ttlSecondsAfterFinished: null
    automountServiceAccountToken: true
    serviceAccountName: default
    securityContext: {}
    containerSecurityContext: {}
    resources: {}
    # If you do want to specify resources, uncomment the following
    # lines and adjust t
… 13342 more characters
prod.yaml 5.1 KB
restrictedHTTPClient: true

log:
  level: debug
  pretty: false

events:
  scanningErrors: true
  trackingErrors: true

dbMigrator:
  loadSampleData: false

hub:
  ingress:
    annotations:
      kubernetes.io/ingress.class: alb
      alb.ingress.kubernetes.io/scheme: internet-facing
      alb.ingress.kubernetes.io/target-type: ip
      alb.ingress.kubernetes.io/listen-ports: '[{ "HTTP": 80 }, { "HTTPS": 443 }]'
      alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": {"Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301" }}'
      alb.ingress.kubernetes.io/actions.artifacthub-redirect: '{"Type":"redirect", "RedirectConfig": {"Host": "artifacthub.io", "Port": "443", "Protocol": "HTTPS", "StatusCode": "HTTP_301"}}'
    rules:
      - host: hub.helm.sh
        http:
          paths:
            - path: /
              pathType: Prefix
              backend:
                service:
                  name: artifacthub-redirect
                  port:
                    name: use-annotation
      - http:
          paths:
            - path: /
              pathType: Prefix
              backend:
                service:
                  name: ssl-redirect
                  port:
                    name: use-annotation
            - path: /
              pathType: Prefix
              backend:
                # This reference expects a static name of the service.
                # If dynamicResourceNamePrefixEnabled=true, the serviceName needs to be changed to include the dynamic prefix.
                # The "dynamic-prefix" is generated in the helper function `chart.resourceNamePrefix`.
                service:
                  name: hub
                  port:
                    number: 80
  deploy:
    replicaCount: 3
    resources:
      requests:
        cpu: 2
        memory: 8000Mi
  server:
    bannersURL: https://cncf.github.io/banners/banners.yml
    baseURL: https://artifacthub.io
    shutdownTimeout: 20s
    oauth:
      github:
        enabled: true
        redirectURL: https://artifacthub.io/oauth/github/callback
      google:
        enabled: true
        redirectURL: https://artifacthub.io/oauth/google/callback
  theme:
    reportURL: "https://github.com/artifacthub/hub/issues/new?assignees=&labels=abuse+report&template=report-abuse.md&title=%5BABUSE-REPORT%5D+Repository+or+package+name"
    sampleQueries:
      - name: OLM operators for databases
        querystring: "kind=3&category=2"
      - name: Packages of any kind related to etcd
        querystring: "ts_query_web=etcd"
      - name: Falco rules for CVE
        querystring: "kind=1&ts_query_web=cve"
      - name: OLM operators in the monitoring category
        querystring: "kind=3&category=4"
      - name: Packages from verified publishers
        querystring: "verified_publisher=true"
      - name: Official Prometheus packages
        querystring: "ts_query_web=prometheus&official=true"
      - name: Operators with auto pilot 
… 2236 more characters

Output

final.yaml 20.0 KB
# Artifact Hub Chart default configuration values
# Common labels to add to all resources
commonLabels: {}
imagePullSecrets: []
imageTag: ''
nameOverride: ''
pullPolicy: IfNotPresent
nodeSelector: {}
tolerations: []

# Enable dynamic resource name prefix
#
# Enabling the dynamic resource name prefix ensures that the resources are named dynamically based on the Helm
# installation's name. This allows multiple installations of this chart in a single Kubernetes namespace. The prefix
# can be defined by using the `fullnameOverride`.
dynamicResourceNamePrefixEnabled: false

# Overwrites the installation's fullname generation (used for the dynamic resource name prefix)
fullnameOverride: ''

# Enable restricted HTTP client
#
# Artifact Hub makes external HTTP requests for several purposes, like getting repositories metadata, dispatching
# webhooks, etc. When this option is enabled, requests to the private network space as well as to some other special
# addresses won't be allowed.
restrictedHTTPClient: true

# Logging configuration
log:
  # Log level
  # Options: "trace", "debug", "info", "warn", "error", "fatal", "panic"
  level: debug
  # Enable pretty logging
  pretty: false

# Database configuration
db:
  host: ''
  port: '5432'
  database: hub
  user: hub
  password: hub
  sslmode: prefer

# Email configuration
email:
  # From name used in emails
  fromName: ''
  # From address used in emails. This field is required if you want to enable email sending in Artifact Hub
  from: ''
  # Reply-to address used in emails
  replyTo: ''
  # SMTP server configuration
  smtp:
    # Authentication mechanism
    # Options: "login", "plain"
    auth: plain
    # SMTP host. This field is required if you want to enable email sending in Artifact Hub
    host: ''
    # SMTP port. This field is required if you want to enable email sending in Artifact Hub
    port: 587
    username: ''
    password: ''

# Credentials
creds:
  # Docker registry username
  dockerUsername: ''
  # Docker registry password
  dockerPassword: ''

# Images configuration
images:
  # Images store
  # Options: "pg"
  store: pg

# Events configuration
events:
  # Enable repository scanning errors events
  scanningErrors: true
  # Enable repository tracking errors events
  trackingErrors: true

# Database migrator configuration
dbMigrator:
  job:
    image:
      # Database migrator image repository (without the tag)
      repository: artifacthub/db-migrator
    # Optionally specify extra list of additional labels for the dbMigrator job
    extraJobLabels: {}
    # Optionally specify extra list of additional labels for the dbMigrator pod
    extraPodLabels: {}
    # Limits the lifetime of the job after it has finished execution
    ttlSecondsAfterFinished: null
    automountServiceAccountToken: true
    serviceAccountName: default
    securityContext: {}
    containerSecurityContext: {}
    resources: {}
    # If you do want to specify resources, uncomment the following
    # lines and adjust them 
… 17496 more characters
Automatic checks (1)
  • python: code = "import yaml\nd = yaml.safe_load(open('final.yaml'))\nassert d['hub']['deploy']['replicaCount'] == 3, d['hub']['deploy']\nassert d['log']['level'] == 'debug' and d['postgresql']['enabled'] is False\nassert d['hub']['service'] == {'type': 'NodePort', 'port': 80}, 'keys only in config.yaml must stay'\nassert 'imageTag' in d and 'db' in d\n"