kompose icon indicating copy to clipboard operation
kompose copied to clipboard

[BUG] Unable to process YAML 1.2 files

Open mdvthu opened this issue 1 year ago • 2 comments

Expected Behavior

Should be able to process YAML 1.2 files

Actual Behavior

docker-compose.yaml files with %YAML 1.2 in the header aren't currently supported, producing the error output:

FATA Unable to load files: parsing /home/username/services/example-service/docker-compose.yaml: yaml: found incompatible YAML document

Steps To Reproduce

docker-compose.yaml file with the following first line:

%YAML 1.2

Run:

kompose convert

Removing %YAML 1.2 or changing to %YAML 1.1 and it works

Kompose Version

1.30.0 (HEAD)

Docker-Compose file

%YAML 1.2
---
# SPDX-FileCopyrightText: 2023 Mark Thurston
# SPDX-License-Identifier: Apache-2.0
version: "2.1"
services:
  unifi-controller:
    image: ghcr.io/linuxserver/unifi-controller:7.5.174-ls206
    container_name: unifi-controller
    environment:
      - PUID=1000
      - PGID=1000
      - MEM_LIMIT=1024
    volumes:
      - '$HOME/.local/share/unifi/config:/config'
    ports:
      - 3478:3478/udp
      - 10001:10001/udp
      - 8080:8080
      - 8443:8443
      - 1900:1900/udp
      - 8843:8843
      - 8880:8880
      - 6789:6789
      - 5514:5514/udp
    restart: unless-stopped
    labels:
      kompose.service.type: LoadBalancer

Anything else?

No response

mdvthu avatar Sep 19 '23 06:09 mdvthu

This is most likely due to this bug in the go yaml library, a dependency . Although I've not tested the most recent version of the upstream library, from the bug report, it doesn't look like an update has been released yet. It's therefore not a straightforward fix.

%YAML 1.2 is very similar to %YAML 1.1. A workaround could therefore be:

sed -i 's/%YAML 1.2/%YAML 1.1/g' *.yaml

For any YAML files that kompose can't currently process.

mdvthu avatar Sep 20 '23 05:09 mdvthu

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 28 '24 16:01 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Feb 27 '24 17:02 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Mar 28 '24 18:03 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Mar 28 '24 18:03 k8s-ci-robot