Skip to content

Add #{job_id} as a substitutable parameter in the Execute Service#427

Draft
Copilot wants to merge 3 commits intor/19.xfrom
copilot/add-job-id-parameter-execute-service
Draft

Add #{job_id} as a substitutable parameter in the Execute Service#427
Copilot wants to merge 3 commits intor/19.xfrom
copilot/add-job-id-parameter-execute-service

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 26, 2026

The Execute Service's parameter substitution had no way to reference the current job ID in command arguments. This adds #{job_id} as a built-in placeholder available in both Execute Once and Execute Many operations.

Changes

  • ExecuteService API — adds JOB_ID_PATTERN = "#{job_id}" constant alongside the existing pattern constants
  • ExecuteServiceImpl.doProcess(MediaPackage) — adds #{job_id} as a case in the regex-based matcher loop, alongside the existing id, org_id, out, flavor, and tags cases. Job is passed as a new parameter.
  • ExecuteServiceImpl.doProcess(MediaPackageElement) — adds #{job_id} as a pattern-replacement check in the per-argument loop, alongside the existing #{in}, #{out}, #{id}, and #{org_id} replacements. Job is passed as a new parameter.
  • execute.md — documents #{job_id} in the parameter substitution table as available in both Execute Once and Execute Many
  • ExecuteServiceImplTest — adds testWithJobIdParam exercising the substitution through doProcess() directly with a mocked Job

Usage

operation: execute-once
exec: my-script
params: --job-id #{job_id} --mediapackage #{id}
Original prompt

This section details on the original issue you should resolve

<issue_title>Add job id as a parameter for execute service</issue_title>
<issue_description>Add the job id as a parameter for the execute service.

The execute service workflow operation handler is defined in https://github.com/cilt-uct/opencast/tree/6ddbe89ba0128819e18d71e90edca9e5ba97619d/modules/execute-impl

Parameters that can be substituted on the command line are described at https://docs.opencast.org/r/19.x/admin/#configuration/execute/#parameter-substitution

Add the workflow job id as a substitutable parameter with the ID #{job_id}

Create a pull request to modify the execute WOH code to add this, and update the documentation https://github.com/cilt-uct/opencast/blob/6ddbe89ba0128819e18d71e90edca9e5ba97619d/docs/guides/admin/docs/configuration/execute.md#parameter-substitution
</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@github-actions
Copy link
Copy Markdown

Hi @Copilot
Thank you for contributing to Opencast.
We noticed that you have not yet filed an Individual Contributor License Agreement. Doing that (once) helps us to ensure that Opencast stays free for all. If you make your contribution on behalf of an institution, you might also want to file a Corporate Contributor License Agreement (giving you as individual contributor a bit more security as well). It can take a while for this bot to find out about new filings, so if you just filed one or both of the above do not worry about this message!
Please let us know if you have any questions regarding the CLA.

Copilot AI changed the title [WIP] Add job id as a parameter for execute service Add #{job_id} as a substitutable parameter in the Execute Service Mar 26, 2026
Copilot AI requested a review from smarquard March 26, 2026 14:24
// Substitute the job ID placeholder in the params argument (index 1).
// At this point arguments contains: [exec, params, serialized_mp_or_element], so index 1 is always the params.
arguments.set(1, arguments.get(1).replace(JOB_ID_PATTERN, String.valueOf(job.getId())));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot For consistency with how the other parameters are handled, move this code to inside doProcess() and pass the job as a parameter to doProcess() so that the job id is available there.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 007088b. Moved the #{job_id} substitution into both doProcess() methods with Job as a new parameter:

  • In doProcess(MediaPackage): added as a regex matcher case alongside id, org_id, etc.
  • In doProcess(MediaPackageElement): added as a pattern-replacement check alongside #{in}, #{out}, #{id}, #{org_id}

@smarquard
Copy link
Copy Markdown

@npmali Please checkout and test this branch on devubuopc003 / mediadev with a test workflow to confirm that the #{job_id} parameter substitution works in the execute service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add job id as a parameter for execute service

3 participants