Skip to content

Commit 07f85be

Browse files
added skip status check for ArgoCD Sync
ArgoCD sync loops for 2 minutes checking the sync status for Success. Setting skip_status_check = true skips this check.
1 parent 1850921 commit 07f85be

2 files changed

Lines changed: 51 additions & 16 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ on:
4848
required: false
4949
type: string
5050
default: "5.0.1"
51+
skip_status_check:
52+
description: 'If true, skip waiting for ArgoCD sync to complete'
53+
required: false
54+
default: 'false'
55+
5156

5257
jobs:
5358
deploy:
@@ -177,10 +182,25 @@ jobs:
177182
STATUS_URL="$ARGOCD_URL/api/v1/applications/$APP_NAME"
178183
179184
echo "Syncing ArgoCD app $APP_NAME using $ARGOCD_URL..."
180-
curl -X POST "$SYNC_URL" \
185+
186+
HTTP_RESPONSE=$(curl -s -w "%{http_code}" -o /tmp/curl_sync_response.txt \
187+
-X POST "$SYNC_URL" \
181188
-H "Content-Type: application/json" \
182189
-u "${{ secrets.ARGO_CD_ADMIN_USER }}:${{ secrets.ARGO_CD_ADMIN_PASSWORD }}" \
183-
-d '{}'
190+
-d '{}')
191+
192+
if [ "$HTTP_RESPONSE" -ne 200 ] && [ "$HTTP_RESPONSE" -ne 201 ]; then
193+
echo "Failed to trigger sync. HTTP response code: $HTTP_RESPONSE"
194+
cat /tmp/curl_sync_response.txt
195+
exit 1
196+
fi
197+
198+
echo "Sync successfully triggered. ArgoCD accepted the sync request."
199+
200+
if [[ "${{ inputs.skip_status_check }}" == "true" ]]; then
201+
echo "Skipping ArgoCD sync status check. Assuming sync was accepted."
202+
exit 0
203+
fi
184204
185205
echo "Waiting for sync to complete..."
186206
for i in {1..12}; do

README.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ This reusable GitHub Actions workflow deploys a Kubernetes application by render
88

99
## 🔧 Inputs
1010

11-
| Name | Required | Type | Description |
12-
|-------------------|----------|--------|-------------|
13-
| `environment` || string | Environment name (e.g. `dev`, `prod`) |
14-
| `application` || string | Application name |
15-
| `namespace` || string | Kubernetes namespace to deploy into |
16-
| `repo` || string | GitHub repo where source manifests live (e.g. `my-org/my-app`) |
17-
| `repo_path` || string | Subdirectory in the repo containing manifests (e.g. `manifests/`) |
18-
| `repo_commit_id` || string | Commit ID to checkout (takes precedence over branch if both set) |
19-
| `branch_name` || string | Branch to checkout (default: `main`) |
20-
| `overlay_dir` || string | Path to the kustomize overlay directory within the repo |
21-
| `image_tag` || string | Optional image tag to set on one or more container images |
22-
| `image_base_name` || string | Single image base name to patch (e.g. `my-app`) |
23-
| `image_base_names`|| array | Multiple image base names to patch |
24-
| `kustomize_version` || string | Kustomize version (default: `5.0.1`) |
11+
| Name | Required | Type | Description |
12+
|---------------------|----------|--------|-----------------------------------------------------------------------------|
13+
| `environment` || string | Environment name (e.g. `dev`, `prod`) |
14+
| `application` || string | Application name |
15+
| `namespace` || string | Kubernetes namespace to deploy into |
16+
| `repo` || string | GitHub repo where source manifests live (e.g. `my-org/my-app`) |
17+
| `repo_path` || string | Subdirectory in the repo containing manifests (e.g. `manifests/`) |
18+
| `repo_commit_id` || string | Commit ID to checkout (takes precedence over branch if both set) |
19+
| `branch_name` || string | Branch to checkout (default: `main`) |
20+
| `overlay_dir` || string | Path to the kustomize overlay directory within the repo |
21+
| `image_tag` || string | Optional image tag to set on one or more container images |
22+
| `image_base_name` || string | Single image base name to patch (e.g. `my-app`) |
23+
| `image_base_names` || array | Multiple image base names to patch |
24+
| `kustomize_version` || string | Kustomize version (default: `5.0.1`) |
25+
| `skip_status_check` || string | If `true`, skips waiting for ArgoCD sync to complete. Only confirms sync was accepted. |
2526

2627
---
2728

@@ -36,6 +37,20 @@ These secrets must be defined in the calling repository:
3637

3738
---
3839

40+
## 🔧 Actions Used
41+
42+
The `gitopsmanager` reusable workflow uses the following GitHub Actions:
43+
44+
| Action | Version | Description |
45+
|------------------------------------------------------------------------|---------|-----------------------------------------------------------------------------|
46+
| ![Checkout](https://img.shields.io/badge/actions--checkout-v4-blue?logo=github) [actions/checkout](https://github.com/actions/checkout) | `v4` | Checks out the repository so workflow jobs can access its contents. |
47+
| ![Envsubst](https://img.shields.io/badge/envsubst-v1-blue?logo=gnu) [nowactions/envsubst](https://github.com/nowactions/envsubst) | `v1` | Substitutes environment variables in files using the `envsubst` CLI. |
48+
| ![Kustomize](https://img.shields.io/badge/setup--kustomize-v2-blue?logo=kubernetes) [imranismail/setup-kustomize](https://github.com/imranismail/setup-kustomize) | `v2` | Sets up Kustomize CLI for building Kubernetes manifests. |
49+
| ![Artifact](https://img.shields.io/badge/upload--artifact-v4-blue?logo=github) [actions/upload-artifact](https://github.com/actions/upload-artifact) | `v4` | Uploads generated workflow artifacts (e.g., rendered YAML files). |
50+
| ![YQ](https://img.shields.io/badge/yq-v4-blue?logo=yaml) [mikefarah/yq](https://github.com/mikefarah/yq) | `v4` | Installs the `yq` YAML processor for working with manifests. |
51+
52+
---
53+
3954
## 🧱 Assumptions
4055

4156
1. Your **GitHub runners** (e.g., via GitHub ARC) have:

0 commit comments

Comments
 (0)