Skip to main content

Plain Old Build

Host executors run commands directly on the host operating system. A Server Host Executor uses the OneDev server host; a Remote Host Executor uses a connected agent. This example runs sw_vers on a macOS agent.

Connect an Agent​

  1. Open Administration > Agents, click +, and select Run on Bare Metal/Virtual Machine.
  2. Install Java 17 or higher and Git 2.11.1 or higher on the agent machine. Install Git LFS if your checkout needs it. Docker is needed for container jobs, not for this host-only example.
  3. Download and extract the agent package. On macOS, use a directory outside system-managed Desktop, Documents, and Downloads folders.
  4. Check serverUrl in conf/agent.properties: it must be reachable from the agent machine. Optionally set agentName=tutorial-local-agent to use the name in this example. The package includes an agent token; keep it private.
  5. Run bin/agent.sh console from the extracted directory. Verify that the agent appears Online.

Online macOS agent

Configure the Executor​

Under Administration > Job Executors, add a Remote Host Executor:

  • Name: tutorial-local-shell
  • Agent Selector: "Name" is "tutorial-local-agent"
  • Applicable Jobs: "Project" is "tutorial-issues" and "Job" is "Host Check"

Replace the project and agent names with yours. The applicable-jobs restriction is required: host jobs execute directly with the agent process's OS permissions, so select only trusted jobs. Use Test to check the executor, then save.

Remote Host Executor configured for the example agent and trusted job

Run a Host Job​

Create .onedev-buildspec.yml with the following job. In the visual editor, the step is Execute Commands with Run in Container disabled. A host executor does not ignore an image configured for a container step; it cannot run that step.

version: 53
jobs:
- name: Host Check
jobExecutor: tutorial-local-shell
steps:
- !CommandStep
name: Print host OS
runInContainer: false
interpreter: !PosixInterpreter
shell: sh
commands: |
sw_vers
test "$(uname -s)" = Darwin
useTTY: false
condition: SUCCESSFUL
retryCondition: never
timeout: 300

Run Host Check and inspect its log. It should name your agent, print the macOS version, and finish successfully.

Successful host build on the named agent

For a different operating system, replace sw_vers and the Darwin assertion with suitable commands. To run on the server itself, use a Server Host Executor with an equally restrictive Applicable Jobs expression.