kpack icon indicating copy to clipboard operation
kpack copied to clipboard

Fails to build git source from annotated tags

Open th3n3rd opened this issue 3 years ago • 0 comments

Currently (kpack 0.4.3) builds fail when trying to use an annotated tag as the value for the git revision:

Let's suppose the following scenario:

Given the current revision is: 79b7d9099c0537503b3cef9696a5ed0a4fc3c1d2 And there is already a build for this commit And I have two tags from the current commit:

git checkout 79b7d9099c0537503b3cef9696a5ed0a4fc3c1d2
git tag simple-tag
git tag annotated-tag -s -m "Annotated"
git push origin simple-tag annotated-tag

When I patch the image with the simple tag, then it works properly

kp image save kp-repo-test --tag th3n3rd/kp-repo-test --builder builder --git https://github.com/th3n3rd/kp-repo-test.git --git-revision simple-tag --wait
Patching Image Resource...
Image Resource "kp-repo-test" patched
+ docker pull th3n3rd/kp-repo-test
Using default tag: latest
latest: Pulling from th3n3rd/kp-repo-test
Digest: sha256:171f58f4b6d9398fec61a8b1e7c66aa9fad82f40d5d73b39a995593d94ec316f
Status: Image is up to date for th3n3rd/kp-repo-test:latest
docker.io/th3n3rd/kp-repo-test:latest

When I patch the image with the annotated tag, then it should also work.

Actual result shows that is instead failing:

kp image save kp-repo-test --tag th3n3rd/kp-repo-test --builder builder --git https://github.com/th3n3rd/kp-repo-test.git --git-revision annotated-tag --wait
Patching Image Resource...
Image Resource "kp-repo-test" patched
===> PREPARE
Build reason(s): COMMIT
COMMIT:
	- 79b7d9099c0537503b3cef9696a5ed0a4fc3c1d2
	+ a4dd0f28832e051395cd4b60eba7765b64cd52d3
Loading secret for "https://index.docker.io/v1/" from secret "image-registry-credentials" at location "/var/build-secrets/image-registry-credentials"
Cloning "https://github.com/th3n3rd/kp-repo-test.git" @ "a4dd0f28832e051395cd4b60eba7765b64cd52d3"...
looking up commit: the requested type does not match the type in the ODB
Error: build failed

th3n3rd avatar Nov 29 '21 16:11 th3n3rd