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

Git Clone Fails if Revision is refs/heads/* #5629

Closed
kennytrytek opened this issue Apr 8, 2021 · 1 comment
Closed

Git Clone Fails if Revision is refs/heads/* #5629

kennytrytek opened this issue Apr 8, 2021 · 1 comment
Labels

Comments

@kennytrytek
Copy link
Contributor

Summary

If a GitArtifact revision is of the form refs/heads/*, this error will occur (logs from init container):

time="2021-04-08T16:42:29.332Z" level=info msg="Loading script source to /argo/staging/script"
time="2021-04-08T16:42:29.332Z" level=info msg="Start loading input artifacts..."
time="2021-04-08T16:42:29.332Z" level=info msg="Downloading artifact: git-source"
time="2021-04-08T16:42:30.386Z" level=info msg="Checking out revision refs/heads/push-test"
time="2021-04-08T16:42:30.389Z" level=error msg="`[git checkout refs/heads/push-test]` stderr:\nerror: pathspec 'refs/heads/push-test' did not match any file(s) known to git\n"
time="2021-04-08T16:42:30.389Z" level=error msg="executor error: error: pathspec 'refs/heads/push-test' did not match any file(s) known to git"
time="2021-04-08T16:42:30.389Z" level=info msg="Alloc=5707 TotalAlloc=16500 Sys=71104 NumGC=6 Goroutines=4"
time="2021-04-08T16:42:30.416Z" level=fatal msg="error: pathspec 'refs/heads/push-test' did not match any file(s) known to git"

Diagnostics

What Kubernetes provider are you using?

What version of Argo Workflows are you running?

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: "git-clone-test"
spec:
  entrypoint: main
  templates:
  - name: main
    inputs:
      parameters:
        - name: repoOwner
          default: argoproj
        - name: repoName
          default: argo-workflows
        - name: gitRef
          default: refs/heads/release-2.0
      artifacts:
        - name: git-repo
          path: /tmp/src
          git:
            repo: "[email protected]:{{inputs.parameters.repoOwner}}/{{inputs.parameters.repoName}}.git"
            revision: "{{inputs.parameters.gitRef}}"
            depth: 1
            sshPrivateKeySecret:
              name: "cid-workflows-secrets"
              key: GITHUB_PRIVATE_REGISTRY_PULL_PRIVATE_KEY
    outputs:
      artifacts:
        - name: repository
          path: /tmp/src
    script:
      image: alpine:latest
      workingDir: /tmp/src
      command: [/bin/sh]
      env:
        - name: GIT_REF
          value: "{{inputs.parameters.gitRef}}"
      source: |
        echo "Successfully cloned {{inputs.parameters.repoOwner}}/{{inputs.parameters.repoName}} at {{inputs.parameters.gitRef}}"
argo submit ./clone-test.yaml --watch
Name:                git-clone-test8p5nq
Namespace:           argo
ServiceAccount:      argo-workflow
Status:              Error
Message:             failed to load artifacts: error: pathspec 'refs/heads/release-2.0' did not match any file(s) known to git
Conditions:          
 Completed           True
Created:             Thu Apr 08 11:58:30 -0500 (20 seconds ago)
Started:             Thu Apr 08 11:58:30 -0500 (20 seconds ago)
Finished:            Thu Apr 08 11:58:50 -0500 (now)
Duration:            20 seconds
Progress:            1/1
ResourcesDuration:   7s*(1 cpu),7s*(100Mi memory)

STEP                    TEMPLATE  PODNAME              DURATION  MESSAGE
 ⚠ git-clone-test8p5nq  main      git-clone-test8p5nq  10s       failed to load artifacts: error: pathspec 'refs/heads/release-2.0' did not match any file(s) known to git  

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

@kennytrytek
Copy link
Contributor Author

I can submit a fix for this; it is a small change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant