kbld icon indicating copy to clipboard operation
kbld copied to clipboard

kbld does not work with git error messages set to a different language

Open Rock981119 opened this issue 3 years ago • 3 comments

I use brew install kbld, Version 0.32.0.

Here is my input Yaml file: Deploy.yaml

#@ scaling_factor = 2
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: go-http-svr
  labels:
    app: http-svr
spec:
  replicas: #@ scaling_factor
  selector:
    matchLabels:
      app: http-svr
  template:
    metadata:
      labels:
        app: http-svr
    spec:
      containers:
      - name: go-http-svr
        image: rock981119/go-http:gitlabv1
        ports:
        - containerPort: 9000

kbld.yaml

---
apiVersion: kbld.k14s.io/v1alpha1
kind: Sources
sources:
- image: rock981119/go-http:gitlabv1
  path: .

---
apiVersion: kbld.k14s.io/v1alpha1
kind: ImageDestinations
destinations:
- image: rock981119/go-http:gitlabv1
  newImage: rock981119/go-http

command line execution:

kbld -f kbld.yaml -f Deploy.yaml

error message:

kbld: Error:
- Resolving image 'rock981119/go-http:gitlabv1': Getting details from git for directory '/Users/zangr/Desktop/Temp/Linux/demo-go-ci': Checking HEAD tags: exit status 128 (stderr 'fatal: 没有发现名称,无法描述任何东西。
')

Chinese part is 'No name found, can't describe anything'

At the same time, I did the same test in the Linux (PhotonOS) environment and it was successful.

My MacOS Version: 11.6.2

Rock981119 avatar Jan 22 '22 05:01 Rock981119

Hi @Rock981119. I was about to create an issue about this same error, but I know why this is happening, so I may be able to help you: Your local GIT is using a language different than english. If you check the source of https://github.com/vmware-tanzu/carvel-kbld/blob/develop/pkg/kbld/image/git.go, you'll see there are some checks done with contains trying to match some strings, and if git is answering in a different language, it won't match any of those.

You might be able to make it work by executing this before your kbld command:

> export LC_ALL=en_US.UTF-8

NOTE: This will only change the language for your terminal session. If you want to persist it, you need to do some extra step, like adding it to your .bashrc or .zshrc file.

I have my GIT working in spanish, and kbld doesn't work for me either, so can you change the title of this issue to something like kbld doesn't work properly if GIT is configured in a language different than English, and point to the file I shared above these lines?

visomar avatar Jan 24 '22 14:01 visomar

@visomar Cool, thanks a lot, it worked.

Rock981119 avatar Jan 24 '22 17:01 Rock981119

@Rock981119 thanks for opening this issue.

@visomar Thanks for helping out with this debug

Going to reopen this issue as a bug because it looks like something that kbld should try to address instead of forcing the users to add an extra command-line variable for it to work.

joaopapereira avatar Jan 24 '22 17:01 joaopapereira