action Block
Placement | job -> group -> task -> action |
The action
block allows job authors to define custom commands. These commands
can be executed by operators with the necessary permissions on a running
allocation, offering a controlled way to interact with tasks.
action
Parameters
command
(string: <required>)
- Specifies the command to be executed.args
(array<string>: [])
- Provides a list of arguments to pass to the command.
action
Examples
Basic Action
This example demonstrates a simple action that prints the current date and time:
Action with Arguments
Here, an action uses arguments to perform a specific task:
Action with Template
This advanced example demonstrates an action that fetches and formats the latest changelog from the Nomad GitHub repository using a shell script. It showcases the use of templating with embedded environment variables and a multi-line script.