LogoLogo
Login to CortexBook a DemoCortex Academycortex.io
  • Cortex Docs
  • Cortex Quick Start
  • Ingesting data into Cortex
    • Managing Entities
      • Adding entities
        • Add services
        • Add domains
        • Add teams
        • Add custom entity types
        • Defining dependencies
      • Entity details page
      • Defining ownership
      • Defining relationship types
      • Grouping entities
      • Adding external documentation
      • Adding Deploy data
      • Adding custom data
      • Viewing discovered entities
      • Archiving entities
      • Relationship graph
      • Using On-call Assistant for incidents
      • Managing Terraform infra in Cortex
    • Managing Catalogs
    • Integrations
      • Internally hosted integrations
      • ArgoCD
      • AWS
      • Azure DevOps
      • Azure Resources
      • BambooHR
      • Bitbucket
      • BugSnag
      • Buildkite
      • Checkmarx
      • CircleCI
      • ClickUp
      • Codecov
      • Coralogix
      • Datadog
      • Dynatrace
      • Entra ID (Azure AD)
      • FireHydrant
      • GitHub
      • GitLab
      • Google
      • Grafana
      • incident.io
      • Instana
      • Jenkins
      • Jira
      • Kubernetes
      • LaunchDarkly
      • Lightstep
      • Mend
      • Microsoft Teams
      • New Relic
      • Okta
      • Opsgenie
      • PagerDuty
      • Prometheus
      • Rollbar
      • Rootly
      • Sentry
      • ServiceNow
      • Slack
      • Snyk
      • SonarQube
      • Splunk Observability Cloud (SignalFx)
      • Splunk On-Call (VictorOps)
      • Sumo Logic
      • Veracode
      • Wiz
      • Workday
      • xMatters
  • Scorecards
    • Initiatives and Action items
      • Creating issues based on Initiatives
    • Scorecard rule exemptions
    • Scorecard rule filters
    • Scorecard examples
    • Scorecards as code
  • Reports
    • Executive report
    • All Scorecards report
    • Bird's eye report
    • Progress report
    • Report card
  • Eng Intelligence
    • Custom Metrics
    • Jira Metrics
    • Metrics Explorer (Beta)
  • Cortex Query Language (CQL)
    • Using CQL reports
    • Using JQ in Cortex
  • Workflows
    • Creating a Workflow
      • Workflows as code
    • Blocks
    • Running a Workflow
    • Registering a Scaffolder template
      • Scaffolder advanced usage
    • Using a Workflow to sync in ArgoCD
    • Kicking off a Jenkins pipeline in a Workflow
  • Plugins
    • Creating a plugin
      • Creating a plugin proxy
    • Migrating Backstage plugins to Cortex
  • Developer homepage
  • Workspace Settings
    • Using GitOps for Cortex
      • GitOps logs
    • Managing users
      • Roles and permissions
        • Custom roles
        • Team ownership entity editing
      • Configuring SSO
        • Microsoft Entra ID
        • Google
        • Other OIDC providers
        • Okta
          • Okta SCIM
      • Configuring identity mappings
      • Onboarding management
    • API keys, secrets, and tokens
      • Secrets
      • Personal tokens
    • Audit logs
    • Entity settings
      • Data verification
      • Auto archiving entities
    • IP allowlist
    • Notifications
      • Notification logs
    • Customizing your workspace
    • Using search in Cortex
  • Cortex API
    • REST API operations
      • API Keys
      • Audit Logs
      • Catalog Entities
      • Custom Data
        • Custom Data (Advanced)
      • Custom Events
      • Custom Metrics
      • Dependencies
      • Deploys
      • Discovery Audit
      • Docs
      • Eng Intel: User Labels
      • Entity Relationship Types (Beta)
      • Entity Relationships (Beta)
      • Entity Types
      • GitOps Logs
      • Groups
      • Initiatives
      • Integrations APIs
        • Azure Active Directory (Entra ID) API
        • Azure Resources API
        • AWS API
        • Azure DevOps API
        • CircleCI API
        • Coralogix API
        • Datadog API
        • GitHub API
        • GitLab API
        • incident.io API
        • LaunchDarkly API
        • New Relic API
        • PagerDuty API
        • Prometheus API
        • SonarQube API
      • IP Allowlist
      • Notification Logs
      • On call
      • Packages
      • Plugins
      • Queries
      • SCIM
      • Scorecards
      • Secrets
      • Team Hierarchies
      • Teams
      • Workflows
Powered by GitBook
On this page
  • Managing Workflows in both GitOps and the Cortex UI
  • View GitOps-managed Workflows in Cortex
  • Edit GitOps-managed Workflows in Cortex
  • Create a Workflow via GitOps
  • Step 1: Configure GitOps editing for Workflows
  • Step 2: Create a YAML file for the Workflow

Was this helpful?

Export as PDF
  1. Workflows
  2. Creating a Workflow

Workflows as code

Last updated 1 day ago

Was this helpful?

With Workflows as code, you can treat your Workflows like other production assets; this feature allows you to manage Workflows through . Each Workflow has its own YAML file.

When GitOps is enabled, changes made to Workflows will appear in .

Managing Workflows in both GitOps and the Cortex UI

When you , it only affects Workflows that are created via GitOps. You will still be able to edit Workflows via the Cortex UI if they were not created or edited through GitOps.

View GitOps-managed Workflows in Cortex

In the Cortex UI, you will see a Git badge appear next to any Workflows that are GitOps-managed:

You can view the Workflow in the Cortex UI, but you cannot edit in the UI. The Cortex UI will display a link to Workflow's YAML file in your repository:

Edit GitOps-managed Workflows in Cortex

You cannot edit a GitOps-managed Workflow in the Cortex UI, but you can duplicate the Workflow and make edits to the duplicate copy.

To duplicate a Workflow:

  1. In the Workflows list, click the 3 dots icon in the row containing the Workflow.

  2. Click Duplicate workflow.

Create a Workflow via GitOps

Step 1: Configure GitOps editing for Workflows

  1. Toggle off the setting Enable Workflow UI editor.

  2. Optionally, under "Workflow GitOps repository allowlist," you can specify which repositories to import Workflows from.

Step 2: Create a YAML file for the Workflow

Workflow YAML files must be in their own repository, separate from catalog entities, at the repository's root directly within .cortex/workflows.

You can create a Workflow configuration from scratch, or you can start in the Cortex UI and export the Workflow to a YAML file:

  1. At the top of the Workflow, click the 3 dots menu, then click Export Workflow YAML.

  2. Add the YAML file to your Git repository within .cortex/workflows.

See an example YAML file below.

Example Workflow YAML

name: New Workflow
tag: new-workflow
description: null
isDraft: true
filter:
  type: GLOBAL
runResponseTemplate: null
actions:
- name: List branches
  slug: list-branches
  schema:
    inputs:
      repo: myorg/backend-app
      per_page: 30
      protected: false
    integrationAlias: cortex
    actionIdentifier: github.listBranches
    type: ADVANCED_HTTP_REQUEST
  outgoingActions:
  - javascript
  isRootAction: true
- name: JavaScript
  slug: javascript
  schema:
    script: |-
      return fetch('https://api.ipify.org?format=json')
        .then(response => {
          return response.json();
        })
        .then(data => {
          return(data);
        });
    type: JAVASCRIPT
  outgoingActions:
  - http-request
  isRootAction: false
- name: HTTP request
  slug: http-request
  schema:
    headers:
      Content-Type: application/json
    httpMethod: POST
    payload: "{\"content\": {{{actions.javascript.outputs.return}}}}"
    url: https://echo.free.beeceptor.com
    type: HTTP_REQUEST
  outgoingActions: []
  isRootAction: false
runRestrictionPolicies: []
iconTag: null

Navigate to Settings > GitOps then click .

The Workflow YAML uses the same data structure as .

.

the Workflows tab
Create a Workflow in Cortex
GitOps
GitOps logs
disable the Workflow UI editor
Cortex's Workflow API
A Git badge appears next to GitOps-managed Workflows.
Click Repo in the upper right corner of a Workflow to view its repository.
Next to a Workflow, click the 3 dots icon, then click "Duplicate workflow".
In Settings, go to GitOps, then click the Workflows tab.