• Beta
Publishing Ops
  • 18 Nov 2020
  • 3 Minutes To Read
  • Share
  • Dark
    Light

Publishing Ops

  • Share
  • Dark
    Light

After you are done creating, running and building your Op, you will need to publish it if you want to run it in Slack.

Publishing is the act of versioning an Op and enabling it to be run remotely. Each time you publish an Op, it will be on a new semantic version of it.
You can also provide a new Readme and changelogs to each version.

How to publish an Op

By default, your Op will be published to your current team's registry. You can be signed into only one team at a time. To verify your current team you are on, run this command:

ops whoami

Quick Comment on Publishing to a Team

When building you will probably be working in your personal Team. If you’re not sharing your Op, you can skip this step. However, if you are developing an Op to share with one or many groups, you can quickly create a new team with the ops team:create command. A common practice is that a user will build and Op in their own private Team and then share it with their team by publishing it their. If you already have the team use the ops team:switch command, more info can be found on the CLI Commands page.

Build and Run

Build your Op for Running or testing with the ops build command.

Build
ops build [PATH]
Or
ops build .

Run
ops run path/opname

ops run .

You can optionally supply the -b (or --build) argument to build the Op before running it to do BOTH at the same time.

ops run . --build

Publish Your Op

The moment you have been waiting for, you can publish an Op to the team you are currently on with the ops publish command. When you publish, you’ll be able to access your Op from anywhere you have the CLI installed. You can publish multiple versions of your Op to different teams.

ops publish path/opName

As part of the publishing process, you’ll be asked for a short change log description of what is in the new version.

For a public Op, you’ll need to edit the YAML file. In ops.yml, you’ll find a field called public. This field is false by default, but you can publish an Op publicly by setting this field to true.

Note: Before publishing a new version of your Op, you will need to update the name field in ops.yml to include the new version.

Your Op will be published to your team registry once your image uploads successfully; you'll now find it belongs to your remote team ops:

ops search

Note

By default, published Ops are only shared with your team—not with the whole world—but if you do want to share your Op with the whole world, set the public option in the ops.yml config file to true . See the Configuring Ops page for details on configuration.

Follow an Example

Determine which team is currently active using ops whoami:

$ ops whoami

  Email: [email protected]
  Username: exauser
  Team Name: exauser

To publish your Op to this active team, use the ops publish command:

ops publish .

The . indicates that you want to publish the Op that exists in the current working directory.

A successful publish will produce output like this:

🚀 Publishing...

> Tag: 0.1.0
> Size: 2833
> Digest: sha256:7b643ff13180d60c95bd4fbd8ce6c000c668745f0f0c7bbcc0304fd759684886

🙌 registry.cto.ai/exauser/98838cb1-7b41-4612-853e-1ee18d58dcf9:0.1.0 has been published!
🖥  Visit your Op page here: <https://registry.cto.ai/registry/exauser/example1>

Now that your Op is published, anyone on your team can run the Op from the CLI or from Slack.

Add an Op to Another Team

When you run ops add, you are adding an Op from another Team (e.g., your default personal team) as a favourite under your current team. When you use ops add with a public Op, you will also see it in the list of your team's ops.

ops add opname

OPNAME should be in the format: @teamname/opName:versionName

You can check the Ops that have been added to your Team by running ops list. To remove an Op from your team, refer to the ops remove documentation.

🚀 What's next?

Was This Article Helpful?