WIP: Use hashed uses string as cache dir name #100
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind
Chore
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
4 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
forgejo/act!100
Loading…
Reference in a new issue
No description provided.
Delete branch "Kwonunn/act:fs-credential-leak"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Apply fix from https://gitea.com/gitea/act/pulls/117
Added at the request of pj in Forgejo Matrix chat.
cascading-pr updated at forgejo/runner#462
@ -717,0 +719,4 @@// UsesHash returns a hash of the uses string.// For Gitea.func (s *Step) UsesHash() string {return fmt.Sprintf("%x", sha256.Sum256([]byte(s.Uses)))i would suggest to use an additional subdir, so we don't get too many folders on one level
in this case if the hash were
deadbeefyour code would produce the pathde/deadbeefwhereas other implementations of this pattern (like git itself) would dode/adbeef. i'm just going to go with the second one, unless that's causing some problem i'm missing?sure, please do
@ -533,3 +533,3 @@if _, ok := step.(*stepActionRemote); ok {actionPath = newRemoteAction(stepModel.Uses).PathactionDir = fmt.Sprintf("%s/%s", rc.ActionCacheDir(), safeFilename(stepModel.Uses))actionDir = fmt.Sprintf("%s/%s", rc.ActionCacheDir(), stepModel.UsesHash())this should probably use
filepath.Join()cascading-pr updated at forgejo/runner#462
cascading-pr updated at forgejo/runner#462
cascading-pr updated at forgejo/runner#462
@ -717,0 +720,4 @@// For Gitea.func (s *Step) UsesHash() string {hash := sha256.Sum256([]byte(s.Uses))return fmt.Sprintf("%x/%x", hash[:1], hash[1:])will pad
%xthe byte always to two chars?🤔 technically we should use
filepath.Joinhere too for proper dir delimitter. not sure if we really need it as only windows uses a backslash but also works with forward slashes since a long time.@viceice wrote in #100 (comment):
it looks like it might not always. https://go.dev/play/p/3x9KLphPi8r
@Kwonunn wrote in #100 (comment):
we should find a ways to force two char padding for consistency
it does: https://go.dev/play/p/nSDdFYVrmKM
i think i've used hex.EncodeToString() for this before, so i'll use that here as well
cascading-pr updated at forgejo/runner#462
otherwise lgtm
@ -12,2 +14,4 @@log "github.com/sirupsen/logrus""gopkg.in/yaml.v3""github.com/nektos/act/pkg/common"wonder why this import moved 🤔
@ -717,0 +722,4 @@// For Gitea.func (s *Step) UsesHash() string {hashBytes := sha256.Sum256([]byte(s.Uses))hashString := hex.EncodeToString(hashBytes[:])isn't
hex.EncodeToString(hashBytes)the same? 🤔 do we really need the extrahashBytesvariable?i tried that first but Sum256 returns a
[32]bytevalue, and EncodeToString takes a[]bytevalue. For some reason those aren't compatible (Go is weird) and the easiest way i found to make them work is to take a full slice of the[32]byte.cascading-pr updated at forgejo/runner#462
221c9c89a72f189952f8cascading-pr updated at forgejo/runner#462
@earl-warren I don't see why this fails, can we make failures more obvious in logs?
https://code.forgejo.org/forgejo/end-to-end/actions/runs/2456/jobs/2#jobstep-4-1
i agree the logs are really hard to find/read..
i think the logs are telling me that the
example-contextaction failed. however, if i run that same action on my end-to-end setup it works just fine so i'm not really sure what's breaking here...I would go as far as to say the logs are impossible to read. Here is the failed line:
https://code.forgejo.org/forgejo/end-to-end/actions/runs/2456/jobs/2#jobstep-5-1911
It is much easier to debug when running the failed test locally.
I think you could propose a pull request to end-to-end that verifies the action path is either what it was before this PR or what it is now. So that it is successful in both cases because both cases are ok. This is a sanity check more than anything so matching
@mainor*/*would be fine by me.@Kwonunn gentle ping?
Use hashedto WIP: Use hashedusesstring as cache dir nameusesstring as cache dir name2f189952f8b518760a8cNew commits pushed, approval review dismissed automatically according to repository settings
cascading-pr updated at forgejo/runner#579
I unfortunately don't have time to debug the cascade failure right now, I'm very busy with school.
I had hoped the failure was transient/had been fixed by now, but it seems that isn't the case.
I'll work on polishing this today (as well as other cache related PRs maybe).
earl-warren referenced this pull request from forgejo/runner2025-07-16 09:36:07 +00:00