ci: correct cache-fetch step reference in pipelines#2537
ci: correct cache-fetch step reference in pipelines#2537chmouel merged 1 commit intotektoncd:mainfrom
Conversation
🔍 PR Lint Feedback
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue in the CI pipelines by rectifying a misnamed step reference. The correction ensures that the caching mechanism functions as intended, leading to more efficient pipeline execution by avoiding redundant cache uploads and improving overall build performance. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request corrects a typo in two Tekton pipeline definitions, .tekton/generate-coverage-release.yaml and .tekton/go.yaml. The reference to the cache-fetch task was misspelled as cached-fetch, which prevented the cache from being used correctly. The fix aligns the task reference, ensuring that the CI pipelines can properly utilize the cache and avoid unnecessary work. The changes are correct and effectively address the issue.
Fix cache-upload step to use $(steps.cache-fetch.results.fetched) instead of $(tasks.cache-fetch.results.fetched). Since both steps are in the same task, the result must be referenced using steps syntax. This prevented the variable from being substituted, causing cache uploads to run even when cache was successfully fetched. Fixes: tektoncd#2533 Signed-off-by: Akshay Pant <akshay.akshaypant@gmail.com>
f035123 to
7d430a4
Compare
|
STEP_CACHE_UPLOAD before: Patterns: **go.mod **go.sum
+ [[ false == \f\a\l\s\e ]]
+ [[ $(tasks.cache-fetch.results.fetched) == \t\r\u\e ]]
+ PATTERN_FLAGS=
+ echo 'Patterns: **go.mod **go.sum'
+ for p in $*
+ PATTERN_FLAGS=' --pattern **go.mod'
+ for p in $*
+ PATTERN_FLAGS=' --pattern **go.mod --pattern **go.sum'
+ for i in {1..3}
+ /ko-app/cache upload --pattern '**go.mod' --pattern '**go.sum' --target 'oci://image-registry.openshift-image-registry.svc:5000/pipelines-as-code-ci/cache-go:{{hash}}' --folder /workspace/source/go-build-cache --insecure false --workingdir
/workspace/source
Matched the following files: [/workspace/source/docs/go.mod /workspace/source/docs/go.sum /workspace/source/go.mod /workspace/source/go.sum]
Upload /workspace/source/go-build-cache content to oci image image-registry.openshift-image-registry.svc:5000/pipelines-as-code-ci/cache-go:22bda2cf0c02b775cfde6d85dc2c7159757db12852e9b04e1c4777911213a1b6 Notice the bool variable being expanded properly and |

📝 Description of the Change
Fix Go module cache mechanism in Tekton CI pipelines by correcting the step result reference in cache-upload steps.
Problem
The Go module cache configured in
.tekton/go.yamland.tekton/generate-coverage-release.yamlwas not working effectively - modules were being re-downloaded on every pipeline run despite successful cache fetches.Root cause: The cache-upload step was using incorrect syntax to reference the fetched result from the cache-fetch step, causing the variable to remain unexpanded as a literal string.
Changes
Fixed in both pipeline files:
Before:
After:
Two bugs corrected:
cache-fetchandcache-uploadare steps within the same taskcached-fetch→cache-fetchHow It Works
Result Flow:
Before This Fix
Pipeline logs showed the variable was not being substituted:
Tekton couldn't resolve tasks.cached-fetch (doesn't exist), so it left the literal string unexpanded. This never equals "true", causing cache upload to run unnecessarily on every pipeline execution.
After This Fix
The variable gets properly substituted:
Now when cache is hit, the upload step correctly skips with "no need to upload cache", avoiding redundant uploads and enabling proper cache reuse.
👨🏻 Linked Jira
N/A
🔗 Linked GitHub Issue
Fixes #2533
🧪 Testing Strategy
🤖 AI Assistance
If you have used AI assistance, please provide the following details:
Which LLM was used?
Extent of AI Assistance:
Important
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com
**💡You can use the script
./hack/add-llm-coauthor.shto automatically addthese co-author trailers to your commits.
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.