Skip to main content

Promote argo application between environments

Project description

argops

A command-line interface for promoting Argocd applications between environments.

Features:

  • Automate all the steps required to do a deployment
  • Smart promote of value files between environments
  • Dry-run option to see the changes.

Installing

pipx install argops

It's recommended that you add to your ArgoCD .gitignore the *-decrypted.yaml string. This pattern will exclude these temporary files from being committed to your git repository. These files are created by argops during the decryption and encryption of sops secrets. Although argops cleans up these files after use, there's a possibility that they might be left behind if an error occurs during processing.

Install the argocd commandline

Install the gitea command line

Tweak your kubectl configuration

The apply command assumes that in your kubectl configuration you have context with the same name as the environments of argocd. It means that if you have a staging and production environments you should also have those in your contexts. If you use EKS it probably won't be the case and you'll need to edit them manually. To do so open the file ~/.kube/config and under the contexts key: change the name:

contexts:
  - context:
      cluster: arn:aws:eks:us-east-1:472857274883:cluster/production-cluster
      user: arn:aws:eks:us-east-1:472857274883:cluster/production-cluster
    name: production
  - context:
      cluster: arn:aws:eks:us-east-1:472857274883:cluster/staging-cluster
      user: arn:aws:eks:us-east-1:472857274883:cluster/staging-cluster
    name: staging

If you need to differentiate many production and staging clusters you can use the environment variable ARGOPS_ENVIRONMENT_PREFIX. If for example ARGOPS_ENVIRONMENT_PREFIX=collectiveA then your kubectl configuration may look like:

contexts:
  - context:
      cluster: arn:aws:eks:us-east-1:472857274883:cluster/production-cluster
      user: arn:aws:eks:us-east-1:472857274883:cluster/production-cluster
    name: collectiveA-production

Usage

There are currently two commands you can use:

apply

apply will deploy the current local changes into the kubernetes cluster. It's meant to be run from the directory of the application you want to deploy.

If the changes are in the staging environment you can run:

argops apply

The tool will guide you through the required steps:

  • Stage the changes you want to deploy
  • Make the commit
  • Push the changes to the git server
  • Refresh the ArgoCD state
  • Show the diff of the application
  • Sync the changes
  • Ask if you want to promote the changes in production

If you're on production, you'll need to use the environment flag argops apply -e production, this is a double check to make sure you are sure what you're doing.

The production workflow is almost the same as staging, but it will also open a pull request adding the application diff in the description of the pull and optionally merge it.

promote

To use the tool, simply run it from your terminal on the directory where your environment directories are.

argops promote

By default the source directory is staging and the destination directory production. If you want to change them you can use the --src-dir=<source directory> and --dest-dir=<destination directory> flags. The --dry-run flag will show you what changes will it do without making them.

Known issues

Comments of promoted secrets are over the changed line

When you promote an environment specific values file, there are inline comments on the keys that have changed. However, sops doesn't support this format and adds the comment above the changed line. It's an upstream issue that is difficult to be addressed by us.

Development

If you want to run the tool from source, make sure you have Python and all required packages installed. You can do this using:

git clone https://codeberg.org/lyz/argops
cd argops
make init

Help

If you need help or want to report an issue, please see our issue tracker.

License

GPLv3

Authors

Lyz

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

argops-1.0.3.tar.gz (54.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

argops-1.0.3-py3-none-any.whl (42.6 kB view details)

Uploaded Python 3

File details

Details for the file argops-1.0.3.tar.gz.

File metadata

  • Download URL: argops-1.0.3.tar.gz
  • Upload date:
  • Size: 54.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for argops-1.0.3.tar.gz
Algorithm Hash digest
SHA256 9c37c9427d715137c5a78f11b81c13fa1de135d2f116cb750e0b595abfef2569
MD5 06cd06097178c0b139655e4a6fb29b17
BLAKE2b-256 af240ec98ccb959ea3998b03ae6883985e4f7af0d2ecd55214a53803521d0eb2

See more details on using hashes here.

File details

Details for the file argops-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: argops-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 42.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for argops-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5532b4546ae3b656002ccbe8a4d8116d1e77406c063e786e2f48914b382bbcd8
MD5 0506ccd71339e95e6b254e83b216f715
BLAKE2b-256 7835c417bf9ff7935d6ea3788a4fb198e24e21d1ad63444f47e764a563edee50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page