If using the default clone step with the depth
attribute set to 1
, whenever rebuilding from past build (commit) will throw an error since that commit won’t be part of the tree which was just pulled.
With that in mind, wouldn’t be better to update the built-in clone command to use $DRONE_COMMIT
when pulling with depth: 1
by default?
Something like:
clone: {disable: true}
steps:
- name: pull
image: alpine/git
commands:
- git init
- git remote add origin "$DRONE_REMOTE_URL"
- git fetch --depth 1 origin "$DRONE_COMMIT"
- git checkout -b "$DRONE_BRANCH" FETCH_HEAD