Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executable file not found in $PATH #1403

Open
2 tasks
JCzz opened this issue Apr 22, 2024 · 1 comment
Open
2 tasks

executable file not found in $PATH #1403

JCzz opened this issue Apr 22, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@JCzz
Copy link

JCzz commented Apr 22, 2024

Describe the bug
I was expecting terratest to use client-go, when run in container within a container?

To Reproduce
Create a Dockerfile:

# syntax=docker/dockerfile:1

FROM golang:1.21.7 AS builder
ARG TEST_FOLDER

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY $TEST_FOLDER/*.go ./
COPY $TEST_FOLDER/*.yml ./

Build using:

TEST_FOLDER=./kubernetes-hello-world-example
DOCKERFILE=./Dockerfile
docker build --build-arg="TEST_FOLDER=$TEST_FOLDER" --target builder -t terratest:latest -q -f Dockerfile .

Pod:

apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
  - name: command-demo-container
    image: docker.io/library/terratest:latest
    imagePullPolicy: Never
    command: ["go"]
    args: ["test", "kubernetes_hello_world_example_test.go"]
  restartPolicy: OnFailure

Error:

kubernetes_hello_world_example_test.go:25
                Error:          Received unexpected error:
                                error while running command: exec: "kubectl": executable file not found in $PATH; 

Expected behavior
A clear and concise description of what you expected to happen.

Nice to have

  • Terminal output
  • Screenshots

Versions

  • Terratest version:
  • Environment details (Ubuntu 20.04, Windows 10, etc.):

Additional context
Add any other context about the problem here.

@JCzz JCzz added the bug Something isn't working label Apr 22, 2024
@denis256
Copy link
Member

Hi,
yes kubectl is required to be in path, AFAIK it is to be able to re-use existing configurations through KUBECONFIG and to be able to use kustomize through kubectl apply -k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants