Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: Could not unmarshal '<nil>' to type <nil> #388

Closed
Hashfyre opened this issue Jan 22, 2017 · 6 comments
Closed

error: Could not unmarshal '<nil>' to type <nil> #388

Hashfyre opened this issue Jan 22, 2017 · 6 comments

Comments

@Hashfyre
Copy link

Platform:
os: OS X Yosemite - 10.10.5 (14F2109)
kompose: version 0.1.2 (92ea047)
compose-file:

version: '2'
services:
  <project>:
    build:
      context: .
      args:
        GIT_TOKEN:
    image: <private-img>
    links:
      - db_live
    depends_on:
      - db_live
    ports:
      - 28090:80
    environment:
      DB_HOST: db_live
  db_live:
    image: mysql:5.6
    ports:
      - 23306:3306
    environment:
      MYSQL_ROOT_PASSWORD: <passwd>
      MYSQL_DATABASE: <project>
      MYSQL_USER: <project>
      MYSQL_PASSWORD: <passwd>

Angular brackets are indicative of replacement text.

Command:

  • kompose -f docker-compose.yml convert

Error Output:

  • ERRO[0000] Could not parse config for project <project> : Cannot unmarshal '<nil>' to type <nil> into a string value
@cdrage
Copy link
Member

cdrage commented Jan 23, 2017

@kadel Could it be because GIT_TOKEN is passed as GIT_TOKEN: ?

@cdrage
Copy link
Member

cdrage commented Jan 23, 2017

@kadel @Hashfyre

Yup.. Seems that a blank GIT_TOKEN: is the cause of the issue, removing it I don't have an error:

    MYSQL_USER: foo                                                                                                                                                                                                                                                         [0/49]
  image: mysql:5.6
  ports:
  - 23306:3306
foo:
  build:
    args:
      GIT_TOKEN: null
    context: .
  depends_on:
  - db_live
  environment:
    DB_HOST: db_live
  image: foo
  links:
  - db_live
  ports:
  - 28090:80
 
ERRO Could not parse config for project wikus : Cannot unmarshal '<nil>' to type <nil> into a string value 
FATA Failed to load compose file: Cannot unmarshal '<nil>' to type <nil> into a string value 

~                                                                                                                                                                                                                                                                               ⍉
▶ vim docker-compose.yml

~                                                                                                                                                                                                                                                                                
▶ kompose convert       
WARN Unsupported depends_on key - ignoring        
WARN Kubernetes provider doesn't support build key - ignoring 
INFO file "db_live-service.yaml" created          
INFO file "foo-service.yaml" created              
INFO file "db_live-deployment.yaml" created       
INFO file "foo-deployment.yaml" created         

@cdrage
Copy link
Member

cdrage commented Jan 23, 2017

@Hashfyre

Could you change your docker-compose file to use this instead?

args:
  - GIT_TOKEN

instead of

args:
 GIT_TOKEN:

@kadel
Copy link
Member

kadel commented Jan 23, 2017

I have yet to check this deeper, but it looks like that that error message is coming from libcompose. We should check if libcompose has the same problem parsing it.

@Hashfyre
Copy link
Author

Hashfyre commented Jan 27, 2017

The same syntax works as per docker-compose. As in, the compose file works with:
docker-compose up -d --build
once I have exported GIT_TOKEN to my shell.

Currently, the following syntax works with kompose -f docker-compose.yml convert:

      args:
        - GIT_TOKEN

with output,

WARN[0000] Unsupported key build - ignoring
WARN[0000] Unsupported key depends_on - ignoring
INFO[0000] file "db_live-service.json" created
INFO[0000] file "app-service.json" created
INFO[0000] file "db_live-deployment.json" created
INFO[0000] file "app-deployment.json" created

If docker-compose supports the initial syntax of

      args:
        GIT_TOKEN:

shouldn't kompose also support it?
Also, from the output's WARN messages, we see build and depends_on keys seem to be unsupported, which could be because k8s doen't support builds.

I think this solves my issue, but do look into whether you could support a syntax already supported by docker-compose to retain 1:1 correspondence.

@surajssd
Copy link
Member

@Hashfyre thanks for the feedback, build support for k8s is WIP and @rtnpro is looking at it right now in #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants