github.com/argoproj/argo-cd@v1.8.7/docs/user-guide/ci_automation.md (about)

     1  # Automation from CI Pipelines
     2  
     3  Argo CD follows the GitOps model of deployment, where desired configuration changes are first
     4  pushed to Git, and the cluster state then syncs to the desired state in git. This is a departure
     5  from imperative pipelines which do not traditionally use Git repositories to hold application
     6  config.
     7  
     8  To push new container images into to a cluster managed by Argo CD, the following workflow (or 
     9  variations), might be used:
    10  
    11  ## Build And Publish A New Container Image
    12  
    13  ```bash
    14  docker build -t mycompany/guestbook:v2.0 .
    15  docker push mycompany/guestbook:v2.0
    16  ```
    17  
    18  ## Update The Local Manifests Using Your Preferred Templating Tool, And Push The Changes To Git
    19  
    20  !!! tip
    21      The use of a different Git repository to hold your kubernetes manifests (separate from
    22      your application source code), is highly recommended. See [best practices](best_practices.md)
    23      for further rationale.
    24  
    25  ```bash
    26  git clone https://github.com/mycompany/guestbook-config.git
    27  cd guestbook-config
    28  
    29  # kustomize
    30  kustomize edit set image mycompany/guestbook:v2.0
    31  
    32  # ksonnet
    33  ks param set guestbook image mycompany/guestbook:v2.0
    34  
    35  # plain yaml
    36  kubectl patch --local -f config-deployment.yaml -p '{"spec":{"template":{"spec":{"containers":[{"name":"guestbook","image":"mycompany/guestbook:v2.0"}]}}}}' -o yaml
    37  
    38  git add . -m "Update guestbook to v2.0"
    39  git push
    40  ```
    41  
    42  ## Synchronize The App (Optional)
    43  
    44  For convenience, the argocd CLI can be downloaded directly from the API server. This is
    45  useful so that the CLI used in the CI pipeline is always kept in-sync and uses argocd binary
    46  that is always compatible with the Argo CD API server.
    47  
    48  ```bash
    49  export ARGOCD_SERVER=argocd.mycompany.com
    50  export ARGOCD_AUTH_TOKEN=<JWT token generated from project>
    51  curl -sSL -o /usr/local/bin/argocd https://${ARGOCD_SERVER}/download/argocd-linux-amd64
    52  argocd app sync guestbook
    53  argocd app wait guestbook
    54  ```
    55  
    56  If [automated synchronization](auto_sync.md) is configured for the application, this step is
    57  unnecessary. The controller will automatically detect the new config (fast tracked using a
    58  [webhook](../operator-manual/webhook.md), or polled every 3 minutes), and automatically sync the new manifests.