Service: OSC Command - EyevinnOSC/community GitHub Wiki

OSC Command

OSC Command (serviceId eyevinn-osaas-client-ts) runs OSC CLI commands as an OSC job. It is a job, not a long-running service: a short-lived instance that executes one command against the platform and then exits. License: MIT. Source: Eyevinn/osaas-client-ts.

What it can do

  • Orchestrate other OSC services and jobs from inside OSC.
  • Automate one-off operations and maintenance scripts without a local development environment.

Creating an instance

You need an OSC Personal Access Token (PAT). Store it as a service secret with create-service-secret (serviceId: "eyevinn-osaas-client-ts", name for example osctoken, value your PAT). Then call create-service-instance with serviceId: "eyevinn-osaas-client-ts":

{
  "name": "myjob",
  "cmdLineArgs": "list instances",
  "oscAccessToken": "{{secrets.osctoken}}"
}

The job runs once and exits. Read the command output with get-logs-for-instance.

Options

Option Required Type Meaning
name Yes string Name of the job. Alphanumeric/underscore only (^\w+$), at most 20 characters.
cmdLineArgs Yes string The arguments passed to the OSC CLI, for example list instances.
oscAccessToken Yes string, sensitive OSC Personal Access Token used to authenticate the commands. The osc CLI reads it from the OSC_ACCESS_TOKEN environment variable. Never put it in plain text; use {{secrets.NAME}}.
awsAccessKeyId No string, sensitive AWS access key ID, for commands that need to read from or write to AWS S3.
awsSecretAccessKey No string, sensitive AWS secret access key that goes with awsAccessKeyId. Store it as a secret and use {{secrets.NAME}}.

{{secrets.NAME}} only works as the entire field value. Overwriting a secret does not restart a running instance.

Using the instance

Example values for cmdLineArgs (the OSC CLI arguments):

list instances
create encore myjob
delete encore myjob

See the OSC CLI documentation for all commands.

OSC CLI equivalent of creating the job:

osc create eyevinn-osaas-client-ts myjob \
  -o cmdLineArgs="list instances" \
  -o oscAccessToken="{{secrets.osctoken}}"

Resources