
This assumes:
- You have an ArgoCD server up and running. If not, check out my article Install Red Hat OpenShift GitOps Operator using the console (Argo CD)
- You have installed the ArgoCD CLI.
- You are able to log into ArgoCD using the CLI. If not, check out my article Log into ArgoCD using the CLI on OpenShift
You can
- Sync an app (Push the YAML manifests in ArgoCD to Kubernetes or OpenShift)
- Refresh a repo (The YAML manifest in ArgoCD will be compared to the YAML in the version control system (such as GitHub) and if any differences are detected the YAML manifest in ArgoCD will be updated to match the YAML in the version control system (such as GitHub))
- Hard Refresh a repo (YAML manifests in ArgoCD are cached - A hard refresh invalidates the cache which forces the YAML manifests in ArgoCD to match the YAML in the version control system (such as GitHub))

The argocd repo list command can be used to list the repo's you have added to ArgoCD.
~]$ argocd repo list
TYPE NAME REPO INSECURE OCI LFS CREDS STATUS MESSAGE PROJECT
git argocd-example-apps https://github.com/argoproj/argocd-example-apps false false false false Successful default
Likewise the argocd repo get <repo url> command can be used to return a specific repo.
~]$ argocd repo get https://github.com/argoproj/argocd-example-apps
TYPE NAME REPO INSECURE OCI LFS CREDS STATUS MESSAGE PROJECT
git argocd-example-apps https://github.com/argoproj/argocd-example-apps false false false false Successful default
The --refresh hard option can be used to hard refresh the repo.
argocd repo get --refresh hard https://github.com/argoproj/argocd-example-apps
After the hard refresh, you will almost always then sync the app. As a default safety feature, automated sync in ArgoCD doesn't delete resources that have been removed from the Git repository. These resources then need to be pruned.
The argocd app list command can then be used to list the app you have created.
~]$ argocd app list
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
openshift-gitops/demo https://kubernetes.default.svc default default OutOfSync Missing Manual <none> https://github.com/my_project/my_repo.git python
Notice in this example that the app is OutOfSync. The argocd app sync command with flag can be used to attempt to sync the app.
~]$ argocd app sync openshift-gitops/demo
TIMESTAMP GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
2024-12-19T20:42:14-06:00 apps Deployment default python OutOfSync Missing
2024-12-19T20:42:14-06:00 apps Deployment default python OutOfSync Missing deployments.apps is forbidden: User "system:serviceaccount:openshift-gitops:openshift-gitops-argocd-application-controller" cannot create resource "deployments" in API group "apps" in the namespace "default"
Name: openshift-gitops/demo
Project: default
Server: https://kubernetes.default.svc
Namespace: default
URL: https://openshift-gitops-server-openshift-gitops.apps.openshift.example.com/applications/openshift-gitops/demo
Source:
- Repo: https://github.com/my_project/my_repo.git
Target:
Path: python
SyncWindow: Sync Allowed
Sync Policy: Manual
Sync Status: OutOfSync from (dbc57d6)
Health Status: Missing
Operation: Sync
Sync Revision: dbc57d62045ddae6c68f925b7cb3f6a1f621bd81
Phase: Failed
Start: 2024-12-19 20:42:14 -0600 CST
Finished: 2024-12-19 20:42:14 -0600 CST
Duration: 0s
Message: one or more objects failed to apply, reason: deployments.apps is forbidden: User "system:serviceaccount:openshift-gitops:openshift-gitops-argocd-application-controller" cannot create resource "deployments" in API group "apps" in the namespace "default"
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
apps Deployment default python OutOfSync Missing deployments.apps is forbidden: User "system:serviceaccount:openshift-gitops:openshift-gitops-argocd-application-controller" cannot create resource "deployments" in API group "apps" in the namespace "default"
FATA[0000] Operation has completed with phase: Failed
The --prune flag can be used if you want to also prune which will remove resources that no longer exist in the git repo.
argocd app sync openshift-gitops/demo --prune
Did you find this article helpful?
If so, consider buying me a coffee over at