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

Honor clone depth property from pipeline on checkout #2

Merged
merged 1 commit into from Nov 2, 2020
Merged

Honor clone depth property from pipeline on checkout #2

merged 1 commit into from Nov 2, 2020

Conversation

cmur2
Copy link
Contributor

@cmur2 cmur2 commented Sep 29, 2020

When using the SSH runner from DockerHub drone/drone-runner-ssh:latest with a pipeline like:

kind: pipeline
type: ssh
name: ci

server:
  host: XXX
  user: XXX
  ssh_key:
    from_secret: XXX

clone:
  depth: 1

steps:
- name: hello
  commands:
  - echo Hello

...the output shows that the depth: 1 property is not respected although the docs say so:

+ git init
Initialized empty Git repository in /tmp/drone-DNfuPrrazu5C3MMX/drone/src/.git/
+ git remote add origin XXX
+ git fetch  origin +refs/heads/add-ci:
From XXX
 * branch            add-ci     -> FETCH_HEAD
 * [new branch]      add-ci     -> origin/add-ci
+ git checkout XXX -b add-ci
Switched to a new branch 'add-ci'

Looking at the source code the relevant code seems to be at

clone.Args{
Branch: c.Build.Target,
Commit: c.Build.After,
Ref: c.Build.Ref,
Remote: c.Repo.HTTPURL,
},
not passing the information.

This PR addresses that problem and I already verified with a locally built Docker image that it works: + git fetch --depth=1 origin +refs/heads/add-ci:

@CLAassistant
Copy link

CLAassistant commented Sep 29, 2020

CLA assistant check
All committers have signed the CLA.

@cmur2
Copy link
Contributor Author

cmur2 commented Oct 2, 2020

@bradrydzewski could you take a look at this PR and also #3 ?

@bradrydzewski bradrydzewski merged commit a3f489f into drone-runners:master Nov 2, 2020
2 checks passed
@cmur2 cmur2 deleted the honor-clone-depth branch Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants