opctl on Visual Studio Team Services

Visual Studio Team Services (VSTS) - also known as Visual Studio Online - allows defining "build"'s and "tasks" from their UI

The VSTS "Hosted Linux" agent queue runs dockerized linux agents. The docker socket from the host gets mounted at /var/run/docker.sock inside each agent container, so running opctl is a matter of:

  • choosing "Hosted Linux Preview" for Agent queue
  • adding a task which creates an opctl node w/ a custom data dir (see create opctl node task)
  • adding tasks with your calls to opctl (see opctl run task)

Example

Create opctl node task

Task: "Shell Script"

Type: "Inline"

Script:

# beta build required for custom data dir support
curl -L https://bin.equinox.io/c/4fmGop7rntx/opctl-beta-linux-amd64.tgz | sudo tar -xzv -C /usr/local/bin

# manually create an opctl node.
# custom node data dir required because VSTS only makes build dir available to docker daemon
#
# the node will remain running throughout the build and get used by all tasks calling `opctl run ...`
nohup opctl node create --data-dir=.opctl &>/dev/null &

opctl run task

Task: "Shell Script"

Type: "Inline"

disables color (because vsts doesn't interpret ansi escape codes), & passes an arg someArg to the op from a VSTS "Variable" someArg

Script: "opctl --nc run -a someArg=$(someArg) test"

results matching ""

    No results matching ""