chore: refactor internal exprparser wrappers to reduce complexity, add new test cases #1566
No reviewers
Labels
No labels
FreeBSD
Kind/Breaking
Kind/Bug
Kind/Chore
Kind/DependencyUpdate
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
Windows
linux-powerpc64le
linux-riscv64
linux-s390x
run-end-to-end-tests
run-forgejo-tests
run-multi-platform-tests
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
forgejo/runner!1566
Loading…
Reference in a new issue
No description provided.
Delete branch "mfenniak/forgejo-runner:refactor-wrappers"
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?
#1563 introduced some new internal types in the
exprparserlibrary to allow detecting access toenv.*andsecrets.*. I realized that the fixes in that PR to allowtoJSON(env)to work were a bit hacky, and so this PR replaces those internal wrapper types with amap[string]XwhereXis specific to each wrapped context, allowingtoJSON(...)to work without specific detection of the wrappers. This was applied to the older matrix wrapper as well.An additional minor issue where
env.*andsecrets.*(not likely to be used in anifblock) weren't detected as accesses to those contexts is also fixed, and unit tests are added to cover that case.404e9bb844288f3eac49All three integration tests agree that
TestRunner_RunEvent/job-container-imagehas problems. That means it could be a real test failure.Yikes, that was a mess to debug. This refactor won't work for a subtle reason that tests barely caught -- when running a job, the runner creates an evaluation context that references the
envmap in-memory, then evaluates the contents of the env map, and then uses that context forruns-on. The problem with this change is that data is copied into the evaluation context to change its type, so the middle evaluation isn't reflected.I'm going to close this PR, rescue the other tests and bugfixes, and leave the refactoring idea dead.
Pull request closed