3131 value : 5d
3232 - name : dockerfile
3333 value : Dockerfile
34- - name : version
35- value : " "
3634 - name : prefetch-input
3735 value : " "
3836 - name : path-context
@@ -200,10 +198,6 @@ spec:
200198 results :
201199 - name : version
202200 description : Git version/tag
203- workspaces :
204- - name : basic-auth
205- description : Workspace for git authentication credentials
206- optional : true
207201 steps :
208202 - name : clone-and-get-version
209203 image : quay.io/konflux-ci/appstudio-utils:ab6b0b8e40e440158e7288c73aff1cf83a2cc8a9@sha256:24179f0efd06c65d16868c2d7eb82573cce8e43533de6cea14fec3b7446e0b14
@@ -224,21 +218,25 @@ spec:
224218 echo "Cloning repository..."
225219 # Use unshallow clone to get full history and tags for git describe
226220 git clone --no-single-branch "$GIT_URL" .
221+
222+ # Checkout the specific revision
223+ git checkout "$GIT_REVISION"
224+
225+ # Fetch all tags explicitly
226+ git fetch origin --tags
227227
228228 # Get version using git describe (same logic as Makefile)
229229 # Try to get the closest tag, or use commit SHA as fallback
230230 VERSION=$(git describe --tags --always 2>/dev/null || echo "v0.0.0-SNAPSHOT")
231231
232- echo "Computed version: $VERSION"
233232 printf "%s" "$VERSION" > $(results.version.path)
233+ echo "Version: $VERSION"
234+ echo "Commit ID: $GIT_REVISION"
234235 when :
235236 - input : $(tasks.init.results.build)
236237 operator : in
237238 values :
238239 - " true"
239- workspaces :
240- - name : basic-auth
241- workspace : git-auth
242240 - name : prefetch-dependencies
243241 params :
244242 - name : input
@@ -269,10 +267,6 @@ spec:
269267 params :
270268 - name : IMAGE
271269 value : $(params.output-image)
272- - name : revision
273- value : $(params.revision)
274- - name : version
275- value : $(tasks.get-version.results.version)
276270 - name : DOCKERFILE
277271 value : $(params.dockerfile)
278272 - name : CONTEXT
@@ -287,8 +281,8 @@ spec:
287281 value : $(tasks.clone-repository.results.commit)
288282 - name : BUILD_ARGS
289283 value :
290- - revision =$(params.revision)
291- - version =$(tasks.get-version.results.version)
284+ - COMMIT_ID =$(params.revision)
285+ - VERSION_ID =$(tasks.get-version.results.version)
292286 - $(params.build-args[*])
293287 - name : BUILD_ARGS_FILE
294288 value : $(params.build-args-file)
0 commit comments