GithubHelp home page GithubHelp logo

Witout TTY docker on CI about kubeval HOT 9 CLOSED

instrumenta avatar instrumenta commented on July 24, 2024 2
Witout TTY docker on CI

from kubeval.

Comments (9)

xanonid avatar xanonid commented on July 24, 2024 2

@albertoig @johscheuer You can also redirect stdin from /dev/null: kubeval *.yaml < /dev/null

from kubeval.

johscheuer avatar johscheuer commented on July 24, 2024 1

@albertoig I solved this issue by running kubeval with script e.g.script -q -e -c "kubeval -v 1.8.1 ./deploy/*"

from kubeval.

garethr avatar garethr commented on July 24, 2024

Hi @albertoig could you post an example of the command you're running? I'll try and recreate.

from kubeval.

albertoig avatar albertoig commented on July 24, 2024

Hi!

I am using Gitlab CI with some pipelines to deploy a project. I think is interesting to validate my YML kubernetes files with Kubeval. I execute on a pipeline this thing like this:

yaml-validator:
stage: doctor
image: garethr/kubeval
tags:
- linux
- docker
script:
- kubeval -v 1.8.1 ./deploy/*

If a execute on terminal it work because the docker commmand use TTY, but gitlab CI does not. Why the kubeval have to be TTY?

captura de pantalla 2017-11-23 a las 17 17 59

from kubeval.

Tombar avatar Tombar commented on July 24, 2024

FTR the same thing happens when using kubeval in the context of an ansible template validation

    - name: setup-k8s | template image pull secret
      template:
        src: k8s/image-pull-secret.yml.j2
        dest: "{{ deploy_dir }}/010-image-pull-secret.yml"
        validate: '/usr/bin/kubeval %s'
      tags: k8s-tasks
TASK [setup-k8s | template image pull secret] ****************************************************************************************************************
Tuesday 06 March 2018  03:13:00 +0000 (0:00:01.031)       0:00:10.130 *********
fatal: [localhost]: FAILED! => {"changed": false, "checksum": "28a4d034ca2f8202789bb7e0ac11439c06fa0ff1", "exit_status": 1, "msg": "failed to validate", "stderr": "", "stderr_lines": [], "stdout": "***PRINTED BY CALLBACK***", "stdout_lines": "***PRINTED BY CALLBACK***"}

stdout: The document stdin appears to be empty

the script -q -e -c workaround seems to work only for some cases where the < /dev/null doesn't work in any scenario

from kubeval.

Neirda24 avatar Neirda24 commented on July 24, 2024

Having the same trouble here.... :/ can't find a way around so far...

I am using kubeval like this:

unalias kubeval 2> /dev/null > /dev/null || true
kubeval() {
	docker run \
		--rm \
		-v "${CURRENT_DIR}/.fixtures:/temp_kubeval/.fixtures" \
		-w "/temp_kubeval" \
		garethr/kubeval $*
}
export -f kubeval

then:

kubeval "./.fixtures/${PROJECT_NAME}/*" --strict

from kubeval.

Neirda24 avatar Neirda24 commented on July 24, 2024

@garethr : Hi, we greatly appreciate your work on this. It helps us a lot when debugging helm on local with no access to a kubernetes cluster. We'd like to use it in our CI as well (gitlab-ci) (see the above post). Do you have any news on this bug ?

from kubeval.

iomv avatar iomv commented on July 24, 2024

Hi, I am having the same issue here, we are using TeamCity CI to spin up a linux box and I pass a list of paths to kubeval:
kubeval -v $K8S_VERSION -f $FILES_LIST_DEV
it works locally on my machine but on the build agent I get:
The document 01_deploy.yml appears to be empty

None of the workarounds above works for my case unfortunately.

Might come useful to specify that I copy the app from source and I install the binary while on #40 seems to imply that it might work when building from docker?

from kubeval.

keegancsmith avatar keegancsmith commented on July 24, 2024

This is an issue with how kubeval decides to use STDIN vs reading files from arguments. You can very easily reproduce with the docker image provided

docker run --rm=true --entrypoint=/bin/sh -v `pwd`/fixtures:/fixtures garethr/kubeval:0.7.1 -c 'find /fixtures | xargs /kubeval'

I don't know why kubeval checks stdin's mode to decide to use stdin. Every other tool I know of just uses stdin if no args are provided or have - mean stdin.

https://github.com/garethr/kubeval/blob/master/cmd/root.go#L42-L43

from kubeval.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.