kustomize build failure in GitLab pipelines

181 Views Asked by At

kustomize build is failing with GitLab pipelines but working locally.

kustomize build .

Kustomize version: 5.2.1 (locally and on GitLab runner)

The kustomization.yaml file


    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    
    namespace: namespace
    
    namePrefix: app-name
    
    images:
      - name: app-image
        newName: image_name
        newTag: image_tag
    
    resources:
      - https://gitlab.link/group_name/app_name//apps/app_one/base?ref=master    ## This does not work 
    
    resources:             ## This works fine
      - ../../base

What I have tried:

  • Updating git version
  • Updating Kustomize version
  • Making sure git credentials are valid
  • Logging into git before running kustomize build command (git config)
  • With git:: in resources

Error message:

Error: accumulating resources: accumulation err='accumulating resources from evalsymlink failure on Error: accumulating resources: accumulating resources from 'https://gitlab.link/group_name/app_name//apps/app_one/base?ref=master': MalformedYAMLError: yaml: line 36: mapping values are not allowed in this context in File: https://gitlab.link/group_name/app_name//apps/app_one/base?ref=master

This works when I run the kustomize build command locally with exakt same kustomization.yaml file

Any ideas on what's wrong here? I appreciate all help / tips.

1

There are 1 best solutions below

0
On

I got it to work by adding this before kustomize build command:

- git config --global url."https://${USER}:${TOKEN}@url.com".insteadOf https://url.com