Skip to content

Add workflow_call trigger to monitoring deployment workflow #83

Add workflow_call trigger to monitoring deployment workflow

Add workflow_call trigger to monitoring deployment workflow #83

Workflow file for this run

name: Solar System - Main Pipeline
on:
push: # Auto-trigger on push
branches: [main]
workflow_dispatch:
inputs:
skip-tests:
description: 'Skip CI tests'
required: false
default: false
type: boolean
skip-docker:
description: 'Skip Docker build'
required: false
default: false
type: boolean
skip-terraform:
description: 'Skip Terraform deployment'
required: false
default: false
type: boolean
skip-argocd:
description: 'Skip ArgoCD deployment'
required: false
default: false
type: boolean
skip-monitoring:
description: 'Skip Monitoring deployment'
required: false
default: false
type: boolean
skip-deployment:
description: 'Skip Application deployment'
required: false
default: false
type: boolean
force-all: # Force all workflows
description: 'Force run all workflows (ignore path detection)'
required: false
default: false
type: boolean
permissions:
contents: write
packages: write
id-token: write
actions: read
jobs:
# Detect what changed
detect-changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
app-changed: ${{ steps.changes.outputs.app }}
terraform-changed: ${{ steps.changes.outputs.terraform }}
argocd-changed: ${{ steps.changes.outputs.argocd }}
deployment-changed: ${{ steps.changes.outputs.deployment }}
monitoring-changed: ${{ steps.changes.outputs.monitoring }}
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' }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 2
- name: Detect file changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
app:
- 'app-controllers/**'
- 'app-test.js'
- 'app.js'
- 'index.html'
- 'Dockerfile'
- 'package*.json'
- 'images/**'
- '.github/workflows/ci.yml'
- '.github/workflows/docker.yml'
terraform:
- 'Terraform/**'
- 'terraform.tfvars'
- '.github/workflows/terraform.yml'
argocd:
- 'argocd/**'
- '.github/workflows/argocd.yml'
deployment:
- 'argocd/application.yml'
- '.github/workflows/deploy.yml'
monitoring:
- 'argocd/monitoring.yml'
- '.github/workflows/monitoring.yml'
# App changes: CI + Docker only
ci:
name: Run CI Tests
needs: [detect-changes]
if: ${{ !inputs.skip-tests && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true') }}
uses: ./.github/workflows/ci.yml
secrets: inherit
permissions:
contents: write
packages: write
id-token: write
actions: read
docker:
name: Build Docker Image
if: ${{ !inputs.skip-docker && (success() || inputs.skip-tests) && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true') }}
needs: [ci, detect-changes]
permissions:
contents: write
packages: write
id-token: write
actions: read
uses: ./.github/workflows/docker.yml
secrets: inherit
with:
push-image: true
# Terraform changes: Terraform + ArgoCD + Deploy + Monitoring
terraform:
name: Deploy Infrastructure
if: ${{ !inputs.skip-terraform && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true') }}
needs: [detect-changes]
uses: ./.github/workflows/terraform.yml
secrets: inherit
permissions:
contents: write
packages: write
id-token: write
actions: read
with:
terraform-action: 'apply'
# ArgoCD changes OR when terraform changes
argocd:
name: Deploy ArgoCD Applications
if: ${{ !inputs.skip-argocd && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true' || needs.detect-changes.outputs.argocd-changed == 'true') }}
needs: [detect-changes, terraform]
uses: ./.github/workflows/argocd.yml
secrets: inherit
permissions:
contents: write
packages: write
id-token: write
actions: read
# Deploy when: terraform changes OR application.yml changes
deployment:
name: Deploy Application
if: ${{ !inputs.skip-deployment && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true' || needs.detect-changes.outputs.deployment-changed == 'true') }}
needs: [detect-changes, argocd]
uses: ./.github/workflows/deploy.yml
secrets: inherit
permissions:
contents: write
packages: write
id-token: write
actions: read
# Monitoring when: terraform changes OR monitoring.yml changes
monitoring:
name: Deploy Monitoring Stack
if: ${{ !inputs.skip-monitoring && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true' || needs.detect-changes.outputs.monitoring-changed == 'true') }}
needs: [detect-changes, argocd]
uses: ./.github/workflows/monitoring.yml
secrets: inherit
permissions:
contents: write
packages: write
id-token: write
actions: read
# Print service endpoints when any deployment happens
show-endpoints:
name: Show Service Endpoints
if: always() && needs.detect-changes.outputs.any-changed == 'true' && (needs.argocd.result == 'success' || needs.deployment.result == 'success' || needs.monitoring.result == 'success')
needs: [detect-changes, argocd, deployment, monitoring]
uses: ./.github/workflows/endpoints.yml

Check failure on line 182 in .github/workflows/main-pipeline.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main-pipeline.yml

Invalid workflow file

error parsing called workflow ".github/workflows/main-pipeline.yml" -> "./.github/workflows/endpoints.yml" : failed to fetch workflow: workflow was not found.
secrets: inherit
permissions:
contents: read
id-token: write