This is gitops helper CLI
go build -o bin/gitops cmd/gitops/main.go
This GitOps utility supports 8 commands:
run
- run update and copy logicupdate
- updates specified imagescopy
- copy from source (default: master) into destination and install changes frominstall.txt
notify
- notifies Jira about new deployment. Read more how to use in docs/jira-notificationargocd-get
- gets an ArgoCD application as json outputargocd-sync
- syncs an ArgoCD applicationargocd-update
- updates an ArgoCD application, combines argocd-get, git update and argocd-syncargocd-delete
- deletes an ArgoCD application
copy
--git-repo=<git-repo-ssh-url>
--git-branch=<git-repo-branch-name>
--git-key-file=<ssh-private-key-location>
--app-prefix=<path-prefix-to-apply>
--app-prefix-argo=<path-to-argoapp-configuration>
--app-prefix-yaml=<path-to-yaml-configuration>
--app-namespace=<application-namespace-name>
--app-name=<application-nam>
--app-dest-branch=<new-branch-name>
./gitops update \
--git-repo=<repository-ssh-url> \
--git-branch=<repository-branch> \
--git-key-file=<key-file-location> \
--images=<image:tag,image2:tag> \
--app-path=<app-path>
Tokenized path flags:
--app-prefix=<app-prefix>
--app-namespace=<app-namespace>
--app-name=<app-name>
./gitops update \
--git-repo=<repository-ssh-url> \
--git-branch=<repository-branch> \
--git-key-file=<key-file-location> \
--images=<image:tag,image2:tag> \
--app-prefix=<app-prefix> \
--app-namespace=<app-namespace> \
--app-name=<app-name>
Valuated --app-path
with other than default value will override tokenized path flags
./gitops update
--git-repo=<repository-ssh-url> \
--git-branch=<repository-branch> \
--git-key-file=<key-file-location> \
--images=<image:tag,image2:tag> \
--app-path=<app-path>
--notify-api-url=<api-endpoint>
--notify-env=<deployment-env-name>
--notify-registry-uri=<img-registry-uri>
--notify-auth-token=<api-auth-token>
./gitops notify
--url=<api-endpoint>
--deployment-env=<environment-name>
--old-img=<image:tag>
--new-img=<image:tag>
--registry-uri=<rigistry-uri>
--auth-token=<key=value>
Gets an ArgoCD application as json in standard output.
OPTIONS:
- app-name - Required, name of the ArgoCD application [$APP_NAME]
- server - Required, server tcp address with port [$ARGO_CD_SERVER]
- auth-token - Required, authentication token [$ARGO_CD_TOKEN]
- insecure - insecure connection (default: false) [$ARGO_CD_INSECURE]
- timeout - timeout for single ArgoCD operation (default: 300) [$ARGO_CD_TIMEOUT]
- grpc-web - Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2 (default: false) [$ARGO_CD_GRPC_WEB]
- refresh - Refresh application data when retrieving (default: true) [$ARGO_CD_REFRESH]
Minimal example
./gitops argocd-get --app-name='application-name' --server='localhost:443' --auth-token='auth-token'
Full example
./gitops argocd-get --app-name='application-name' --server='localhost:443' --auth-token='auth-token' --timeout=300 --insecure=false --grpc-web=false --refresh=true
Syncs an ArgoCD application and waits for it to reach synced and healthy status.
OPTIONS:
- app-name - Required, name of the ArgoCD application [$APP_NAME]
- server - Required, server tcp address with port [$ARGO_CD_SERVER]
- auth-token - Required, authentication token [$ARGO_CD_TOKEN]
- insecure - insecure connection (default: false) [$ARGO_CD_INSECURE]
- timeout - timeout for single ArgoCD operation (default: 300) [$ARGO_CD_TIMEOUT]
- grpc-web - Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2 (default: false) [$ARGO_CD_GRPC_WEB]
- async - don't wait for sync to complete (default: false) [$ARGO_CD_ASYNC]
- wait-failure - Fail the command when waiting for the sync to complete exceeds the timeout (default: true) [$ARGO_CD_WAIT_FAILURE]
Minimal example
./gitops argocd-sync --app-name='application-name' --server='localhost:443' --auth-token='auth-token'
Full example
./gitops argocd-sync --app-name='application-name' --server='localhost:443' --auth-token='auth-token' --timeout=300 --insecure=false --grpc-web=false --refresh=true --async=false --wait-failure=true
Updates an ArgoCD application. Combines argocd-get, git update and argocd-sync commands.
OPTIONS:
- app-name - Required, name of the ArgoCD application [$APP_NAME]
- server - Required, server tcp address with port [$ARGO_CD_SERVER]
- auth-token - Required, authentication token [$ARGO_CD_TOKEN]
- git-key-file - Required,SSH private key location [$GIT_KEY_FILE]
- images [-i] - Required, images with tags, comma separated list [$IMAGES]
- insecure - insecure connection (default: false) [$ARGO_CD_INSECURE]
- timeout - timeout for single ArgoCD operation (default: 300) [$ARGO_CD_TIMEOUT]
- grpc-web - Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2 (default: false) [$ARGO_CD_GRPC_WEB]
- git-strict-host-key-checking - strict host key checking (default: false) [$GIT_STRICT_HOST_KEY_CHECKING]
- git-push - push changes (default: true) [$GIT_PUSH]
- git-author-name value - Git author name (default: jenkins) [$GIT_AUTHOR_NAME]
- git-author-email value - Git author email (default: jenkins@localhost) [$GIT_AUTHOR_EMAIL]
- keep-registry [-k] - keeps registry part of the changeable image (default: false) [$KEEP_REGISTRY]
- deployment-strategy [-s] - change deployment strategy (RollingUpdate | Recreate) (default: if not defined then strategy will remain unchanged) [$DEPLOYMENT-STRATEGY]
- recursive - updates directories and their contents recursively (default: false) [$RECURSIVE]
- refresh - Refresh application data when retrieving (default: true) [$ARGO_CD_REFRESH]
- async - don't wait for argoCD sync to complete (default: false) [$ARGO_CD_ASYNC]
- wait-failure - Fail the command when waiting for the sync to complete exceeds the timeout (default: true) [$ARGO_CD_WAIT_FAILURE]
Minimal example
./gitops argocd-update --app-name='application-name' --server='localhost:443' --auth-token='auth-token' --git-token-file='file' --images='image:1'
Deletes an ArgoCD application.
OPTIONS:
- app-name - Required, name of the ArgoCD application [$APP_NAME]
- server - Required, server tcp address with port [$ARGO_CD_SERVER]
- auth-token - Required, authentication token [$ARGO_CD_TOKEN]
- insecure - insecure connection (default: false) [$ARGO_CD_INSECURE]
- timeout - timeout for single ArgoCD operation (default: 300) [$ARGO_CD_TIMEOUT]
- grpc-web - Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2 (default: false) [$ARGO_CD_GRPC_WEB]
- cascade - perform a cascaded deletion of all application resources (default: true) [$ARGO_CD_CASCADE]
Minimal example
./gitops argocd-delete --app-name='application-name' --server='localhost:443' --auth-token='auth-token'
Full example
./gitops argocd-delete --app-name='application-name' --server='localhost:443' --auth-token='auth-token' --timeout=300 --insecure=false --grpc-web=false --cascade=true