argoproj / argoproj/argo-workflows
Ill-formed scp-like `git clone` URLs lead to unintuitive error message
- Dominant language
- Go
- Stars
- 17k
- Forks
- 3.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 138
Description
### Pre-requisites
- [X] I have double-checked my configuration
- [X] I can confirm the issues exists when I tested with `:latest`
- [X] I'd like to contribute the fix myself (see [contributing guide](https://github.com/argoproj/argo-workflows/blob/master/docs/CONTRIBUTING.md)) - please let me try until 2023/11/12 😄
### What happened/what you expected to happen?
When I use a repo of the form `user@host/repo` instead of `user@host:repo` for git input artifacts (i.e., I accidentally use an incorrect forward slash instead of the correct colon), the pipeline fails with an unintuitive error message of `exec: \"git\": executable file not found in $PATH`
Here is how I reproduced it:
```
$ argo submit -n argo-workflows repro.yaml --wait
Name: repro-lnkfl
Namespace: argo-workflows
ServiceAccount: unset (will run with the default ServiceAccount)
Status: Pending
Created: Sun Nov 05 14:25:19 +0000 (now)
Progress:
repro-lnkfl Failed at 2023-11-05 14:25:29 +0000 GMT
$ argo logs -n argo-workflows repro-lnkfl -c init
repro-lnkfl: time="2023-11-05T14:25:20.472Z" level=info msg="Starting Workflow Executor" version=v3.5.1
repro-lnkfl: time="2023-11-05T14:25:20.477Z" level=info msg="Using executor retry strategy" Duration=1s Factor=1.6 Jitter=0.5 Steps=5
repro-lnkfl: time="2023-11-05T14:25:20.477Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=argo-workflows podName=repro-lnkfl template="{\"name\":\"git-clone\",\"inputs\":{\"artifacts\":[{\"name\":\"argo-source\",\"path\":\"/src\",\"git\":{\"repo\":\"git@github.com/argoproj/argo-workflows.git\",\"revision\":\"v3.5.1\",\"sshPrivateKeySecret\":{\"name\":\"github-credentials\",\"key\":\"ssh-private-key\"}}}]},\"outputs\":{},\"metadata\":{},\"container\":{\"name\":\"\",\"image\":\"golang:1.10\",\"command\":[\"sh\",\"-c\"],\"args\":[\"git status \\u0026\\u0026 ls\"],\"workingDir\":\"/src\",\"resources\":{}}}" version="&Version{Version:v3.5.1,BuildDate:2023-11-03T18:37:58Z,GitCommit:877c5523066e17687856fe3484c9b2d398e986f5,GitTag:v3.5.1,GitTreeState:clean,GoVersion:go1.21.3,Compiler:gc,Platform:linux/amd64,}"
repro-lnkfl: time="2023-11-05T14:25:20.604Z" level=info msg="Start loading input artifacts..."
repro-lnkfl: time="2023-11-05T14:25:20.604Z" level=info msg="Downloading artifact: argo-source"
repro-lnkfl: time="2023-11-05T14:25:20.605Z" level=info msg="Load artifact" artifactName=argo-source duration=1.234711ms error="failed to clone \"git@github.com/argoproj/argo-workflows.git\": exec: \"git\": executable file not found in $PATH" key=
repro-lnkfl: time="2023-11-05T14:25:20.605Z" level=error msg="executor error: artifact argo-source failed to load: failed to clone \"git@github.com/argoproj/argo-workflows.git\": exec: \"git\": executable file not found in $PATH"
repro-lnkfl: time="2023-11-05T14:25:20.605Z" level=info msg="Alloc=9280 TotalAlloc=13289 Sys=25189 NumGC=3 Goroutines=4"
repro-lnkfl: time="2023-11-05T14:25:20.605Z" level=fatal msg="artifact argo-source failed to load: failed to clone \"git@github.com/argoproj/argo-workflows.git\": exec: \"git\": executable file not found in $PATH"
```
### Version
v3.5.1
### Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.
```YAML
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: repro-
spec:
entrypoint: git-clone
templates:
- name: git-clone
inputs:
artifacts:
- name: argo-source
path: /src
git:
repo: git@github.com/argoproj/argo-workflows.git # note the incorrect use of a / instead of a : for this clone
revision: "v3.5.1"
sshPrivateKeySecret:
name: github-credentials
key: ssh-private-key
container:
image: golang:1.10
command: [sh, -c]
args: ["git status && ls"]
workingDir: /src
```
### Logs from the workflow controller
```text
time="2023-11-05T14:25:19.701Z" level=info msg="Processing workflow" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:19.706Z" level=info msg="Updated phase -> Running" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:19.706Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:19.706Z" level=info msg="was unable to obtain node for , letting display name to be nodeName" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:19.706Z" level=info msg="Pod node repro-lnkfl initialized Pending" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:19.721Z" level=info msg="Created pod: repro-lnkfl (repro-lnkfl)" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:19.721Z" level=info msg="TaskSet Reconciliation" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:19.721Z" level=info msg=reconcileAgentPod namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:19.732Z" level=info msg="Workflow update successful" namespace=argo-workflows phase=Running resourceVersion=858422 workflow=repro-lnkfl
time="2023-11-05T14:25:29.725Z" level=info msg="Processing workflow" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:29.725Z" level=info msg="Task-result reconciliation" namespace=argo-workflows numObjs=0 workflow=repro-lnkfl
time="2023-11-05T14:25:29.725Z" level=info msg="Pod failed: Error (exit code 1): artifact argo-source failed to load: failed to clone \"git@github.com/argoproj/argo-workflows.git\": exec: \"git\": executable file not found in $PATH" displayName=repro-lnkfl namespace=argo-workflows pod=repro-lnkfl templateName=git-clone workflow=repro-lnkfl
time="2023-11-05T14:25:29.725Z" level=info msg="marking node as failed since init container has non-zero exit code" namespace=argo-workflows new.phase=Failed workflow=repro-lnkfl
time="2023-11-05T14:25:29.725Z" level=info msg="node changed" namespace=argo-workflows new.message="Error (exit code 1): artifact argo-source failed to load: failed to clone \"git@github.com/argoproj/argo-workflows.git\": exec: \"git\": executable file not found in $PATH" new.phase=Failed new.progress=0/1 nodeID=repro-lnkfl old.message= old.phase=Pending old.progress=0/1 workflow=repro-lnkfl
time="2023-11-05T14:25:29.726Z" level=info msg="TaskSet Reconciliation" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:29.726Z" level=info msg=reconcileAgentPod namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:29.726Z" level=info msg="Updated phase Running -> Failed" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:29.726Z" level=info msg="Updated message -> Error (exit code 1): artifact argo-source failed to load: failed to clone \"git@github.com/argoproj/argo-workflows.git\": exec: \"git\": executable file not found in $PATH" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:29.726Z" level=info msg="Marking workflow completed" namespace=argo-workflows workflow=repro-lnkfl
time="2023-11-05T14:25:29.731Z" level=info msg="cleaning up pod" action=deletePod key=argo-workflows/repro-lnkfl-1340600742-agent/deletePod
time="2023-11-05T14:25:29.737Z" level=info msg="Workflow update successful" namespace=argo-workflows phase=Failed resourceVersion=858437 workflow=repro-lnkfl
time="2023-11-05T14:25:29.749Z" level=info msg="cleaning up pod" action=labelPodCompleted key=argo-workflows/repro-lnkfl/labelPodCompleted
```
### Logs from in your workflow's wait container
```text
Error from server (BadRequest): container "wait" in pod "repro-lnkfl" is waiting to start: PodInitializing
```
Contributor guide
Research direction
Reproduce the malformed scp-like URL in the supplied workflow using `argo submit`, then inspect the git input-artifact handling reached by the executor. The fix is done when `user@host/repo` produces an actionable URL error instead of `exec: "git": executable file not found in $PATH`, with coverage for the reproduced case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, go, kubernetes
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100