• Stars
    star
    135
  • Rank 267,784 (Top 6 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bot to automate Kubernetes deployment via Github PRs

Argocd Bot

A bot to help automate argo-cd changes via Github PRs.
Currently supports running diffs on open Pull Requests, check the Workflow section for more, or comment argo help on an open PR.

Benefits

Easier Deployments/Fewer Mistakes

  • Comment argo diff on an open PR, to view diff between local branch and Kubernetes cluster.
  • PR diffs can be easily reviewed by everyone.
  • Catch errors in the output of argo diff before applying changes.
  • Comment argo sync [app name] to deploy changes, and merge PR.

Lock-down Deployments

  • Users can submit changes via Github (after PR approval), without needing cluster credentials.
  • Audit changes made to clusters via Github PRs/server logs.

Workflow

This section describes the workflow supported by the bot.

Workflow basics

  • User opens a PR in a Kubernetes repo with changes to deployment files.
  • User comments with argo diff on the PR.
  • Bot checks out current state of PR and runs argocd diff --local. Diff output is posted on the PR as a comment.
  • Team can review code changes in the PR, and double check the posted diff.
  • Author can iterate, making changes on the PR and re-comment with argo diff once they are ready.
  • Deploying Changes:
    • If Auto Sync is enabled: once the PR is merged, ArgoCD server syncs it with production.
    • Otherwise, user can comment argo sync [app name] to sync changes from branch, before merging PR.

PR Example

pr-example

Locking

When any command is run on by a user, the PR holds a lock, until the it is merged, or unlock is run. The PR lock prevents other users from attempting to run commands on their PRs. This is to synchronize changes on master.
i.e to prevent a scenario like this:

  • Alice creates a PR, comments diff, and she's happy with the output posted.
  • Bob creates a second PR, and comments diff.
  • Bob merges his PR to master.
  • Alice's diff output on her PR is now invalid and she might have no idea. Her merge to master, might produce a different state than what her diff had shown.

With locking in place, Bob will not be able to merge his PR until he coordinates with Alice, by either running unlock, or waiting for her PR to get merged first.

Workflow Commands

These are commands that are supported by the bot.

  • argo diff: this checks out the current state of the PR, queries the argoCD server at /api/v1/applications and diffs all applications with their current state from the PR.
  • argo unlock: this unlocks the current PR, so other users can run diff; see locking section above.
  • argo sync [app name]: this syncs changes on current branch
  • argo rollback: this rolls back latest change

More commands might be added, run argo help on a PR, to view all supported commands.

Deployment

Create a Github App

Create a new GitHub App here.

  • Webhook URL, is the host where the bot will run.
  • Webhook Secret, is an optional secret, make sure it matches the config (see below section)
  • Private key, generate a new key and place it in the root directory, and update config below.
  • Check the generated APP_ID by Github. For more on creating Github apps see

Required Permissions for Github App

Please give the argo-cd app the following permissions:

Read access to administration and metadata
Read and write access to commit statuses, issues, and pull requests 

Update Config

There is an .env_example file that should be renamed to .env. NodeJS will read that file and expose the variables to the bot, when running locally.
When running in Kubernetes, there is a helper script to create k8s secrets from that file (more on this in the kubernetes deployment section).
Here is a description of each parameter:

  • PORT is the port that bot will listen on via HTTP.
  • LOG_LEVEL can be set to trace, debug, info, warn, error, or fatal.
  • KUBECTL_EXTERNAL_DIFF this is used by argocd diff, we pass a helper script to pretti-fy diffs posted on the PR.
  • APP_ID is the app id corresponding to the Github app (this is generated on app creation).
  • GHE_HOST for Github enterprise installations, specify the hostname. Otherwise leave blank, bot will use Github.com
  • GITHUB_REPO this is the repo that the bot will operate on.
  • GITHUB_TOKEN generate a Github token for the bot, and give it no scopes. This is just used to clone the repo.
  • WEBHOOK_SECRET is the secret configured when creating the Github app (can be left empty if no secret is specified).
  • PRIVATE_KEY_PATH is the path to the private key generated for the Github app, this is usually a .pem file.
  • ARGOCD_SERVER, this is the ip address/hostname of the argocd server.
  • ARGOCD_AUTH_TOKEN it is recommended to generate an automation token using the /api/v1/projects/{project}/roles/{role}/token API. For more information see

Kubernetes Deployment

Docker images of argocd-bot are built here, they are provided as part of releases here

Check the config section above, once you have a .env file that's populated with the correct values run ./helper_scripts/create_kubectl_secrets.sh.
This will generated a k8s secret argocd-bot-secret used by the deployment.

Build manifests using kustomize: npm run manifests

Create deployment from manifests: kubectl create -f deployment/install.yaml

Manual Deployment

See docs here

Development/Contributing

See docs here

More Repositories

1

argocd-image-updater

Automatic container image update for Argo CD
Go
1,220
star
2

argocd-autopilot

Argo-CD Autopilot
Go
889
star
3

argocd-vault-plugin

An Argo CD plugin to retrieve secrets from Secret Management tools and inject them into Kubernetes secrets
Go
805
star
4

argocd-operator

A Kubernetes operator for managing Argo CD clusters.
Go
625
star
5

hera

Hera is an Argo Python SDK. Hera aims to make construction and submission of various Argo Project resources easy and accessible to everyone! Hera abstracts away low-level setup details while still maintaining a consistent vocabulary with Argo. ⭐️ Remember to star!
Python
559
star
6

argocd-notifications

Notifications for Argo CD
Go
492
star
7

terraform-provider-argocd

Terraform provider for ArgoCD
Go
397
star
8

old-argo-dataflow

Dataflow is a Kubernetes-native platform for executing large parallel data-processing pipelines.
Go
268
star
9

rollout-extension

Argo Rollout visualization in Argo CD Web UI
TypeScript
186
star
10

argocd-extension-metrics

An Argo CD extension to enable visualization of metrics in Argo CD UI.
TypeScript
115
star
11

argocd-extensions

Support for extending Argo CD
Go
108
star
12

argo-python-dsl

Python DSL for Argo Workflows
Python
99
star
13

argo-kube-notifier

Argo Kube Notifier controller monitors Kubernetes resources
Go
95
star
14

rollouts-plugin-trafficrouter-gatewayapi

The Argo Rollouts plugin implementing the Kubernetes Gateway API specification for using different traffic providers in progressive delivery scenarios
Go
92
star
15

argo-rollouts-manager

Kubernetes Operator for Argo Rollouts controller.
Go
90
star
16

argo-workflows-catalog

Argo Workflows Catalog
Go
86
star
17

gordian

Gordian applies transformations to files across multiple github repositories and creates pull requests for the owners of the repositories to review and merge them.
Python
78
star
18

argocd-interlace

Enabling Software Supply Chain Security Capabilities in ArgoCD
Go
78
star
19

argo-client-python

⚠️⚠️⚠️This repository is no longer maintained, please find your Java SDKs https://github.com/argoproj/argo-workflows/blob/master/docs/client-libraries.md ⚠️⚠️⚠️
Python
78
star
20

argocd-agent

Redefining the multi cluster story of Argo CD
Go
48
star
21

argo-client-java

⚠️This repository is no longer maintained, please find your Java SDKs https://github.com/argoproj/argo-workflows/blob/master/docs/client-libraries.md
Java
35
star
22

appsource

Automatically self-serviced applications for ArgoCD.
Go
24
star
23

argocd-extension-installer

Install Argo CD extensions using init-containers
Shell
17
star
24

rollouts-plugin-trafficrouter-contour

The Argo Rollouts plugin implementing the Contour HTTPProxy traffic control in progressive delivery scenarios.
Go
15
star
25

argocd-rbac-operator

Kubernetes Operator for Argo CD RBAC Management.
Go
14
star
26

applicationset-hello-plugin

Python
13
star
27

community

Community documents for argoproj-labs
12
star
28

argo-java-client

Created java data model from argo project by it's swagger files. Argo proj does use Kubernetes api so this client only contains Model and no APIs
Java
12
star
29

argoverse

ShaderLab
11
star
30

training-material

Shell
8
star
31

argo-client-gen

⚠️⚠️⚠️This repository is no longer maintained, please find your Java SDKs https://github.com/argoproj/argo-workflows/blob/master/docs/client-libraries.md ⚠️⚠️⚠️
8
star
32

gitops-promoter

A GitOps Environment Promotion Tool
Go
7
star
33

multi-cluster-kubernetes

Proof of concept of amalgamating multiple Kubernetes APIs into a single view
Go
6
star
34

argo-cd-benchmarking

JavaScript
6
star
35

argo-cd-tokens

Go
6
star
36

argo-workflows-slack-executor-plugin

Python
5
star
37

argocd-example-extension

JavaScript
5
star
38

argo-workflows-python-executor-plugin

Python
5
star
39

argo-graph

TypeScript
4
star
40

rollouts-plugin-trafficrouter-consul

Argo Rollouts Plugin for Consul Service Mesh
Go
4
star
41

friends

Projects which would love to associate themselves with the Argo ecosystem of projects!
4
star
42

argo-workflows-events-workshop

3
star
43

couler

This project has been moved to https://github.com/couler-proj/couler
3
star
44

argo-eventbus

Go
3
star
45

argocd-ephemeral-access

A kubernetes controller to manage Argo CD temporary access
Go
3
star
46

argocd-cmp-plugin-examples

2
star
47

terraform-provider-argocd-old

2
star
48

argo-workflows-hello-executor-plugin

Python
1
star
49

rollouts-opsmx-metric-plugin

Argo Rollouts plugin implementation for logs and metrics analysis
1
star
50

rollouts-plugin-trafficrouter-openshift

Go
1
star