Failing Post Build Action blocks execution of follow-up Post Build Action #3268
addiejewoah opened 6 hours ago

I have a job with three post-build actions (PBAs) which can and should run in parallel. They're all set up with a simple 'condition: successful', nothing more. I noticed the third PBA didn't trigger. I investigated conditions, parameter options, etc. Everything looked good. But I did notice the first PBA had failed and also the second PBA also hadn't triggered. Then I saw the PBAs could be ordered, so as an experiment, I swapped the first and third in the list. Then I retried the Job and now the PBA which didn't trigger before, triggered successfully now it was the first PBA. Consequently, because the now first PBA succeeded, the second one now also triggered and succeeded (the third, which was the first earlier, also triggered and still failed as expected).

Question: is it expected behaviour for a failing PBA to block triggering of any PBAs after it? Since intuitively I'd expect the PBAs to simply run in parallel, where each PBA's 'condition' only relates to the Job they're part of, not to any results of the other PBAs.

  • Service Desk commented 6 hours ago

    @addiejewoah Yes—this matches the current implementation when the post-build action itself throws an error. Actions are processed sequentially in their configured order, and error handling surrounds the whole list. An error therefore stops processing the remaining actions, which explains why reordering changes which actions are reached.

    Your understanding of condition: successful is correct: it checks the status of the original build, not the results of earlier post-build actions. The later actions are skipped because processing stops before their conditions are evaluated.

    For a Run job action, submitting the downstream job is separate from that job executing. The action does not wait for the downstream job to finish; submitted jobs can run concurrently if dependencies and executor capacity allow. A downstream job failing later should not, by itself, stop the original build's remaining actions.

    To diagnose an action error, check the OneDev server log for Error processing post build actions and its accompanying exception. Fixing that error is the reliable solution; putting the failing action last is a workaround for allowing the earlier actions to be attempted.

    Does this answer your question? If the failure you observed was instead in an already-started downstream job, please share your OneDev version, the relevant post-build action configuration, and the associated error (with secrets removed).

  • Robin Shen changed fields 5 hours ago
    Name Previous Value Current Value
    Type
    Question
    Bug
    Affected Versions
    empty
    <=17.2.1
  • addiejewoah commented 5 hours ago

    I had already checked the OneDev server log regarding the PBAs, there are some warnings about failing to trigger a Job (the three PBAs are 'Run Job' actions) because a forwarded 'Platform' parameter 'android' in the current Job isn't an allowed input value for the triggered Job's 'Platform' parameter which only allows 'linux' in that Job. The current Job allows both 'android' and 'linux' as 'Platform' parameter values. I wouldn't expect this to log as an error, but simply as a non-blocking INFO line in the server log, since an 'android' Job not triggering a 'linux'-only Job is expected/wanted behaviour. Or is my setup wrong and should this be an input in the 'condition' part of the PBA? (e.g. if @param:Platform@ == 'linux' ?)

    One of such WARN entries (which does say 'error' even though its categorized as 'WARN' ?):

    2026-11-18 14:41:55,045 WARN  [hz.127.0.0.1:5710.cached.thread-364] i.o.server.job.DefaultJobService Error processing post build actions (project: sdk, commit: e38d6a0358e3fb42359474d1b99cc15c2a67bbd8, job: Build SDK-Image)
    jakarta.validation.ValidationException: Error validating param value (param: Platform, value: [android], error message: Invalid choice value "android" for "Platform"; valid values: linux
    	at io.onedev.server.buildspec.param.ParamUtils.validateParamValue(ParamUtils.java:105)
    	at io.onedev.server.buildspec.param.ParamUtils.validateParamMap(ParamUtils.java:126)
    	... <etc> ...
    

    This warning/error seems to block the triggering of any of its following PBAs.

    On another note, the PBA-related warnings in the server log only lists the project name, job name and git commit hash, not the name of the PBA triggering the warning/error, this complicates the debugging investigation. It would help if the server log also adds the name of the PBA firing the warning/error. I'm running OneDev server version 17.1.1 (on Bare Metal).

  • Service Desk commented 5 hours ago

    @addiejewoah Yes, put the platform restriction in the Condition of each Linux-only Run job action:

    successful and "Platform" is "linux"
    

    This checks the original build's status and its Platform parameter. An Android build will skip that action before attempting to submit the downstream job, and processing can continue to the other actions. Use this condition syntax directly; no if, @param:Platform@, or == is needed.

    The downstream job's allowed parameter values validate submissions; they do not act as a filter. Forwarding android to a job accepting only linux therefore raises a validation exception. The log level is WARN because validation exceptions are deliberately logged at that level; “Error processing post build actions” is the message text.

    The reported blocking behavior is confirmed: exception handling currently surrounds the entire action list. Handling failures separately for each action would allow later actions to be attempted. Including the failing action's description (which identifies the target job for Run job actions) would also improve diagnosis.

    @robin I could investigate but could not prepare the code fix: tod issue checkout --for-write OD-3268 failed with HTTP 403, No permission to write code in issue project, for the servicedesk account. Please provide write access or take over the per-action error handling and logging change. No code changes or PR are ready to submit.

  • addiejewoah commented 4 hours ago

    Hm, I've tried the approach with the extra conditions and it solves the issue, but then a 'Run Job' PBA has knowledge of the Job it's triggering. I'm not sure if that's the correct way the mechanism should be approached, since it introduces a dependency on a Job's internals (knowledge of the allowed values for a parameter), you'd want loose coupling in a system like this. I understand that you want parameter validation, but in my opinion the 'allowed parameter values' at the triggered Job should be the filter when that Job triggers and any not-allowed values could then log a parameter validation error in the server log, instead of blocking other PBAs at the calling Job. But I'm not knowledgeable about OneDev's internals, and I don't know Robin's design philosophy but making assumptions about the allowed values of a triggered Job's input parameter does feel like' tight coupling'... I guess it's a grey area :) Thanks for the 'condition' tip, this seems to fix the issue.

  • Service Desk commented 4 hours ago

    @addiejewoah Thanks for confirming the condition workaround works. Your coupling concern is understandable: keeping a platform restriction in the caller duplicates a constraint of the downstream job. The blocking bug can be addressed independently of whether invalid downstream parameters should act as a filter: a rejected submission should be logged for that action while later post-build actions are still attempted. Including the action's description would also identify the target job in the log.

    This remains an open bug; the workaround does not fix the underlying behavior. I checked the current implementation and found no related PR.

    @robin I retried tod issue checkout --for-write OD-3268, but it still returns HTTP 403: No permission to write code in issue project for servicedesk. Please provide write access or take over the per-action error handling and logging fix. No code changes or PR are ready to submit.

1/1
Type
Bug
Priority
Minor
Assignee
Affected Versions
<=17.2.1
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-3268
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover