Skip to content

Commit 53bd965

Browse files
committed
Refactor change detection outputs in main pipeline to simplify infrastructure checks
1 parent 97a848d commit 53bd965

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

.github/workflows/main-pipeline.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ jobs:
5353
runs-on: ubuntu-latest
5454
outputs:
5555
app-changed: ${{ steps.changes.outputs.app }}
56-
terraform-changed: ${{ steps.changes.outputs.terraform }}
57-
argocd-changed: ${{ steps.changes.outputs.argocd }}
58-
deployment-changed: ${{ steps.changes.outputs.deployment }}
59-
monitoring-changed: ${{ steps.changes.outputs.monitoring }}
60-
any-changed: ${{ steps.changes.outputs.app == 'true' || steps.changes.outputs.terraform == 'true' || steps.changes.outputs.argocd == 'true' || steps.changes.outputs.deployment == 'true' || steps.changes.outputs.monitoring == 'true' }}
56+
infra-changed: ${{ steps.changes.outputs.infra }}
6157
steps:
6258
- name: Checkout
6359
uses: actions/checkout@v5
@@ -79,21 +75,14 @@ jobs:
7975
- 'images/**'
8076
- '.github/workflows/ci.yml'
8177
- '.github/workflows/docker.yml'
82-
terraform:
78+
infra:
8379
- 'Terraform/**'
84-
- 'terraform.tfvars'
8580
- '.github/workflows/terraform.yml'
86-
argocd:
87-
- 'argocd/**'
8881
- '.github/workflows/argocd.yml'
89-
deployment:
9082
- 'argocd/application.yml'
9183
- '.github/workflows/deploy.yml'
92-
monitoring:
9384
- 'argocd/monitoring.yml'
9485
- '.github/workflows/monitoring.yml'
95-
96-
# App changes: CI + Docker only
9786
ci:
9887
name: Run CI Tests
9988
needs: [detect-changes]
@@ -121,7 +110,7 @@ jobs:
121110
# Terraform changes: Terraform + ArgoCD + Deploy + Monitoring
122111
terraform:
123112
name: Deploy Infrastructure
124-
if: ${{ !inputs.skip-terraform && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true') }}
113+
if: ${{ !inputs.skip-terraform && (inputs.force-all || needs.detect-changes.outputs.infra-changed == 'true') }}
125114
needs: [detect-changes]
126115
uses: ./.github/workflows/terraform.yml
127116
secrets: inherit
@@ -134,7 +123,7 @@ jobs:
134123
# ArgoCD changes OR when terraform changes
135124
argocd:
136125
name: Deploy ArgoCD Applications
137-
if: ${{ !inputs.skip-argocd && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true' || needs.detect-changes.outputs.argocd-changed == 'true') }}
126+
if: ${{ !inputs.skip-argocd && (inputs.force-all || needs.detect-changes.outputs.infra-changed == 'true') }}
138127
needs: [detect-changes, terraform]
139128
uses: ./.github/workflows/argocd.yml
140129
secrets: inherit
@@ -147,7 +136,7 @@ jobs:
147136
# Deploy when: terraform changes OR application.yml changes
148137
deployment:
149138
name: Deploy Application
150-
if: ${{ !inputs.skip-deployment && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true' || needs.detect-changes.outputs.deployment-changed == 'true') }}
139+
if: ${{ !inputs.skip-deployment && (inputs.force-all || needs.detect-changes.outputs.infra-changed == 'true') }}
151140
needs: [detect-changes, argocd]
152141
uses: ./.github/workflows/deploy.yml
153142
secrets: inherit
@@ -160,7 +149,7 @@ jobs:
160149
# Monitoring when: terraform changes OR monitoring.yml changes
161150
monitoring:
162151
name: Deploy Monitoring Stack
163-
if: ${{ !inputs.skip-monitoring && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true' || needs.detect-changes.outputs.monitoring-changed == 'true') }}
152+
if: ${{ !inputs.skip-monitoring && (inputs.force-all || needs.detect-changes.outputs.infra-changed == 'true') }}
164153
needs: [detect-changes, argocd]
165154
uses: ./.github/workflows/monitoring.yml
166155
secrets: inherit
@@ -173,7 +162,7 @@ jobs:
173162
# Print service endpoints when any deployment happens
174163
show-endpoints:
175164
name: Show Service Endpoints
176-
if: always() && needs.detect-changes.outputs.any-changed == 'true' && (needs.argocd.result == 'success' || needs.deployment.result == 'success' || needs.monitoring.result == 'success')
165+
if: always() && needs.detect-changes.outputs.infra-changed == 'true' && (needs.argocd.result == 'success' || needs.deployment.result == 'success' || needs.monitoring.result == 'success')
177166
needs: [detect-changes, argocd, deployment, monitoring]
178167
uses: ./.github/workflows/endpoints.yml
179168
secrets: inherit

0 commit comments

Comments
 (0)