Git not found in executor image

UPDATE: I’m an idiot - I was overwriting the system $PATH with my use of job parameters. Fixed now.

I’m attempting to run custom jobs using CircleCI convenience images, specifically cimg/base:2022.01 and cimg/node:lts. The first step in each of my jobs is “checkout”, to pull the code from GitHub. That step is failing the first time the git executable is called, with the error:

/bin/sh: 10: git: not found
exit status 127

I’ve tried multiple tags of the images, and even pulled cimg/base:current to my local environment, and verified I can run git commands inside that image when run locally. What am I doing wrong here?

Here are the relevant sections of my CircleCI config:

jobs:
  scan-js:
    docker:
      image: cimg/node:lts
    parameters:
      path:
        type: string
        default: "."
    environment:
      PATH: << parameters.path >>
    steps:
      - checkout
      - run: |
          cd $PATH
          npm install
      - snyk/scan:
          organization: DevTech-ADVISE
          severity-threshold: medium

  scan-container:
    docker:
      image: cimg/base:2022.01
    parameters:
      dockerfile-name:
        type: string
        default: "./Dockerfile"
      image_name:
        type: string
        default: myrepo/myapp
      path:
        type: string
        default: "."
    environment:
      DOCKERFILE_NAME: << parameters.dockerfile-name >>
      IMAGE_NAME: << parameters.image_name >>
      PATH: << parameters.path >>
    steps:
      - setup_remote_docker:
          version: 19.03.13
      - checkout
      - run: |
          export DOCKER_CONTENT_TRUST=1
          docker build -t $IMAGE_NAME -f $DOCKERFILE_NAME $PATH
      - snyk/scan:
          docker-image-name: $IMAGE_NAME
          organization: DevTech-ADVISE
          severity-threshold: medium
          target-file: $DOCKERFILE_PATH
      - run: |
          chmod +x ./docker_bench.sh
          ./docker_bench.sh $IMAGE_NAME

You may get a quicker reply if you contact support directly - they do reply (in time) even to users of the free account. They can ask for access to your whole setup and so can easily see the logs and status reports.

One thing, I’ve only ever seen examples with ‘- checkout’ following the ‘steps:’ statement, so you may want to move it around to see if its location dependent.

@rit1010 Opened a support ticket as well - just figured I’d try my luck here too!

Figured out I made a rookie mistake in variable naming - problem solved!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.