codefresh-io / argo-hub

Codefresh Hub for Argo
https://codefresh.io/argo/hub/
48 stars 22 forks source link
argo ci-cd open-source

Codefresh

Codefresh Hub for Argo

Share and Reuse Your Argo Workflows with the Codefresh Argo Hub.

Motivation

Anyone who builds many Argo workflows knows that after a while you end up reusing the same basic steps over and over again. While Argo Workflows has a great mechanism to prevent repetitive work using templates, these templates remain in private user repositories that have not been shared with the broader community.

Goals

Table of Contents

Main Features

Extensive UI for visualization and navigation

Get a full-featured visualized experience here https://codefresh.io/argo/hub/

WorkflowTemplate manifest conventions

To build an extensive UI while still using use of the original Kubernetes manifest, we are leverging annotations.

WorkflowTemplate annotations

Inner template annotations

Hub file system Structure

The main folder of the Argo Hub repository is workflows
Each folder represents a workflowTemplate (group of templates), and appears as a unique item in the main list of the argo hub site

Every workflowTemplate folder has the following structure and files:

Every version folder has the following structure and files:

Versioning

Each workflow template is versioned and can be referenced by specific versions. The Codefresh Hub provides a clear structure for both owners and consumers to pick and use the versions that make sense for their use cases. Users can also use multiple versions to test changes, without fully upgrading. Check out the file system structure, and the workflow template conventions.

Full release life cycle

A full release life cycle has been built to do the following:

Automatic image building and security scanning

Workflow tasks often involve complex scripts with dependencies that have to be installed manually, wasting valuable execution time and complexing the workflow.
Many developers overcome this complexity by building a Docker image that contains all required dependencies (i.e npm install), plus the scripts themselves.
The usual problem that developers will notice is that the work on the workflowTemplate itself is detached from the release life cycle and development of the Docker image.
Argo Hub solves this issue by taking a modern approach, and maintaining all required dependencies and scripts alongside the workflowTemplate, and Argo Hub doing all the heavy lifting for you with its release life cycle.

Pods security

Templates in the hub must specify their required permissions, which are then enforced within Kubernetes. Using default permissions is considered an anti-pattern for workflow templates and they are not supported out of the box. Defining clear permissions creates a clear contract between consumers and their templates.

Installation and Usage

Eventually Argo Hub is simple, being a set of reusable Kubernetes manifests (workflowTemplates and RBAC related resources).
There are different ways to be able to consume the workflowTemplates:

Using Argo CD application set with following config file

{
  "appName": "marketplace-git-source",
  "userGivenName": "marketplace-git-source",
  "destNamespace": "codefresh-v2-production",
  "destServer": "https://kubernetes.default.svc",
  "srcPath": ".",
  "srcRepoURL": "https://github.com/codefresh-io/argo-hub.git",
  "srcTargetRevision": "",
  "labels": { "codefresh_io_entity": "git-source" },
  "exclude": "**/images/**/*",
  "include": "workflows/**/*.yaml"
}

How to Contribute

The easiest way to contribute is by writing a new workflow or enhancing an existing workflowTemplate by adding additional tasks (templates).
First thing to do is to fork the repository.

Writing a new Workflow

  1. Copy the utils/starting-template folder into the main workflows folder.
  2. Globally replace the words starting-template and starting template with your workflowTemplate name.
  3. Open a pull request and wait for a review.
  4. Once approved you'll immediately see your changes in the Argo Hub site

Enhancing existing workflows

  1. Pick an existing workflowTemplate, and follow the conventions and the file system structure.
  2. Open a pull request and wait for a review.
  3. Once approved you'll immediately see your changes in the Argo Hub site.

Ask for a new Workflow

Please fill a github issue or thumb up an existing one