Git Product home page Git Product logo

Comments (11)

ndegory avatar ndegory commented on June 14, 2024 3

I made it work by specifying an entrypoint:

default:
  image:
    name: cytopia/ansible-lint:latest
    entrypoint: ["/bin/sh", "-c"]

stages:
  - lint

ansible-linter:
  stage: lint
  script:
    - ansible-lint *.yaml
  only:
    - merge_requests
    - master

from docker-ansible-lint.

katanacrimson avatar katanacrimson commented on June 14, 2024 2

FWIW - gitlab ci only requires an empty entrypoint.

You can just use:

    entrypoint: ['']

And it'll work fine.

from docker-ansible-lint.

DutchessNicole avatar DutchessNicole commented on June 14, 2024 1
stages:
  - lint

ansible-linter:
  image: cytopia/ansible-lint
  stage: lint
  tags: ['generic']
  script:
    - echo $PATH
    - pwd
    - which ansible-lint
    - ansible-lint inventories/bootstrap.yml
    - ansible-lint inventories/configure.yml

Given the preceding gitlab-ci file, we still get the missing sh lines:

WARNING: Couldn't open sh - No such file or directory
WARNING: Couldn't open sh - No such file or directory

I looked through the linked issues #17 and #18 but I don't quite see how they relate to this issue?
Could you elaborate on what the fix would be?

from docker-ansible-lint.

Jamesking56 avatar Jamesking56 commented on June 14, 2024 1

Can confirm setting the entrypoint works 👍

from docker-ansible-lint.

cytopia avatar cytopia commented on June 14, 2024

@Jamesking56 how does GitLab invoke it? Are you able to see the full run command?

from docker-ansible-lint.

DutchessNicole avatar DutchessNicole commented on June 14, 2024

Gitlab checks out the code repository inside a directory in /builds/<namespace>/<project name> and tries to cd into it.

From there it'll try to run the script block with any elements passed to it

so given this config:

stages:
  - lint
ansible-linter:
  variables:
    CI_DEBUG_TRACE: "true"
  image: cytopia/ansible-lint
  stage: lint
  tags: ['generic']
  script:
    - ansible-lint inventories/playbook.yml

gitlab starts a docker container, checks out the code as mentioned above, tries to cd to the code directory and that is where it fails.
It never gets to the script block where the ansible-lint command is.

from docker-ansible-lint.

cytopia avatar cytopia commented on June 14, 2024

I am adding the option to have it run without any arguments by default (#17)

#18

from docker-ansible-lint.

xmariopereira avatar xmariopereira commented on June 14, 2024

I have the same issue, running in gitlab too.

from docker-ansible-lint.

cytopia avatar cytopia commented on June 14, 2024

Thanks @ndegory Is this also working for @Jamesking56 , @DutchessNicole and @xmariopereira ?

Might also be related: cytopia/docker-yamllint#14

from docker-ansible-lint.

cytopia avatar cytopia commented on June 14, 2024

I will add this to the README

from docker-ansible-lint.

cytopia avatar cytopia commented on June 14, 2024

Thanks everyone for figuring this out :)

from docker-ansible-lint.

Related Issues (9)

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.