How to Build a CTO.ai Op

Whether you’re looking to gain agile and cultural advantages in the software development process or looking for better ways to increase accountability in software auditing, CTO.ai Ops in Slack and the CLI will improve your day-to-day.

This article will walk you through the process of building an Op (an automation) using The Ops Platform by CTO.ai.

We’ll start by showing you the software development process on The Ops Platform and how that process can be used in publishing Ops to Slack where your whole team can have access to them.

So without any further ado, here is the first step.


Step 1: Getting Started with CTO.ai

This is relatively a simple process and all you need to do is follow the steps in the documentation. If you haven’t already, sign-up on The Ops Platform.

Then, you essentially need to make sure you have:

  • A macOS or Linux operating environment (Windows is not supported)
  • Node.js
  • Docker for Mac or Linux installed

Got them? Awesome.

Next, you need the CTO.ai CLI. So open up your favorite desktop CLI and copy-paste the following npm command:

npm install -g '@cto.ai/ops'

Now, just sign-in to your account in the CLI by running the command:

ops account:signin

Next, install the CTO.ai Slack App for The Ops Platform.

Made it this far? You’re a Ruxstar.

You have one last step: Create a team in the CLI and then connect the CTO.ai Slack App in a Slack channel to add your team in the CLI.


Step 2: Build Your Op

So you’ve signed in and got your account all set-up.

Now, let’s create something awesome.

Run the command “ops init” which stands for initializing software development processes.

Right off the bat, the CTO.ai SDK is going to pop-up.

So you can see we support these languages, but fear not dear reader, The Ops Platform will support many more in the future. I’ve picked Javascript for this example.

So now, just give your Op a name. I’ve named mine “ed”.

Then add a description of what it does, version it, and now (this next step is really freaking cool) it's going to scaffold out the files you are using with Docker.

  1. 📁 dockerignore
  2. 📁 npmignore
  3. 📁 Dockerfile
  4. 📁 index.js
  5. 📁 ops.yml
  6. 📁 package.json

Now, let’s open up those files in your code editor.

I wanna show you the Index.js file because this is where you can code. This is where your DevOps scripts go. This is where the magic of The Ops Platform comes from. It looks like:

Go ahead and start coding!

So you have some code, you’re not sure if it works, but it's time to test if it does.

It's easy. Change directory (“cd ed” in this example)  & then just run the command — ops run . — to begin the process of containerizing the code.

After the containerization, the building process is done. Your code should play out as the natural next step.

So let’s say you're happy with your code. What now?


Step 3: Share and Run Your Op in Slack

Run the “ops publish . command.

The ops publish command is an awesome step.

That's because it’s sharing your Op to your entire team so they can run it.

via GIPHY

So if you go to Slack and run the command /ops list to list out all the ops available.

And… voila! There’s “ed” below:

From now on you are able to run this command in Slack and give your entire team in Slack access to it.

That’s a lot of power in such a small command. You not only have an Op automation and can move quickly, but you also have visibility from your team. That’s very important in our newly remote-first working world where collaboration and transparency are the keys to the kingdom.

Finally, the Ops world is your oyster. You can build any sort of Op that is helpful to your workflow or your team, but if you need inspiration, just visit CTO.ai/registry or join our Slack community for more ideas.