Skip to content

clowdhaus/argo-cd-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

argo-cd

argo-cd-action

integration test

GitHub action for installing and executing the Argo CD CLI.

Usage

See the ArgoCD CLI documentation for the full list of available commands and options.

Inputs

Name Description Required Default
command Command passed to the ArgoCD CLI No
options Options passed to the ArgoCD CLI command No
version Version of ArgoCD CLI to install No 3.3.2
download-url Custom URL to download the ArgoCD CLI binary from (e.g., from a self-hosted server) No

Outputs

Name Description
output Stdout from the ArgoCD CLI command execution

Basic

- uses: clowdhaus/argo-cd-action/@main
  with:
    command: version
    options: --client

With GitHub API authentication

If you run workflows frequently, you may hit GitHub's API rate limit when downloading the CLI from ArgoCD releases. Add GITHUB_TOKEN to authenticate and use a higher rate limit.

- uses: clowdhaus/argo-cd-action/@main
  env:
    # Only required for first step in job where the CLI is downloaded
    # Subsequent steps in the same job will use the cached binary
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    command: version
    options: --client

With a self-hosted ArgoCD server

Use the download-url input to download the CLI directly from your ArgoCD server instead of GitHub releases. This keeps your CLI version in sync with your server and avoids GitHub API rate limits.

- uses: clowdhaus/argo-cd-action/@main
  with:
    download-url: https://argocd.example.com/download/argocd-linux-amd64
    command: version
    options: --client

Authenticate and deploy

- name: Install ArgoCD CLI
  uses: clowdhaus/argo-cd-action/@main
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy application
  uses: clowdhaus/argo-cd-action/@main
  with:
    command: app sync my-app
    options: >-
      --auth-token ${{ secrets.ARGOCD_AUTH_TOKEN }}
      --server ${{ secrets.ARGOCD_SERVER }}
      --grpc-web

Capture command output

The action exposes the CLI stdout as a step output, which can be referenced in subsequent steps.

- name: List applications
  id: argocd
  uses: clowdhaus/argo-cd-action/@main
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    command: app list
    options: >-
      --auth-token ${{ secrets.ARGOCD_AUTH_TOKEN }}
      --server ${{ secrets.ARGOCD_SERVER }}
      --grpc-web
      -o name

- name: Use output
  run: echo "${{ steps.argocd.outputs.output }}"

Set a specific version

- uses: clowdhaus/argo-cd-action/@main
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    version: 3.1.5
    command: version
    options: --client

Install only (no command)

If you omit command, the action only installs the ArgoCD CLI and adds it to PATH for use in subsequent run steps.

- uses: clowdhaus/argo-cd-action/@main
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: argocd version --client

Security

  • Downloaded binaries from GitHub releases are verified against SHA256 checksums (available for ArgoCD v2.7.0+)
  • Sensitive environment variables (GITHUB_TOKEN, ACTIONS_RUNTIME_TOKEN, ACTIONS_ID_TOKEN_REQUEST_TOKEN, ACTIONS_ID_TOKEN_REQUEST_URL) are automatically filtered when executing ArgoCD CLI commands
  • When using download-url, checksum verification is skipped as the binary comes from your own infrastructure
  • GitHub Actions in CI workflows are pinned by full-length commit SHA for supply chain integrity

Getting Started

The following instructions will help you get setup for development and testing purposes.

Prerequisites

npm is used to handle dependencies and executing scripts on the codebase.

Install the project dependencies by running the following command from within the project root directory:

  $ npm install

Contributing

Please read CODE_OF_CONDUCT.md for details on our code of conduct and the process for submitting pull requests.

Changelog

Please see the CHANGELOG.md for details on individual releases.

About

GitHub action for executing Argo CD 🦑

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages