Refactor CI/CD workflows to remove input parameters and use secrets for image tag and Kubernetes configurations
This commit is contained in:
31
.github/workflows/cd.yml
vendored
31
.github/workflows/cd.yml
vendored
@@ -13,35 +13,14 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
image_tag:
|
|
||||||
description: 'Docker image tag to deploy (e.g., latest, v1.0.0)'
|
|
||||||
required: false
|
|
||||||
default: 'latest'
|
|
||||||
type: string
|
|
||||||
namespace:
|
|
||||||
description: 'Kubernetes namespace (e.g., production, staging)'
|
|
||||||
required: false
|
|
||||||
default: 'default'
|
|
||||||
type: string
|
|
||||||
ingress_host:
|
|
||||||
description: 'Ingress host domain (e.g., www.example.com)'
|
|
||||||
required: false
|
|
||||||
default: 'www.cialloo.com'
|
|
||||||
type: string
|
|
||||||
force_restart:
|
|
||||||
description: 'Force rollout restart (restarts pods even if no changes)'
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
# Environment variables available to all jobs
|
# Environment variables available to all jobs
|
||||||
env:
|
env:
|
||||||
# Kubernetes configuration
|
# Kubernetes configuration
|
||||||
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG_DATA }}
|
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG_DATA }}
|
||||||
KUBERNETES_URL: ${{ secrets.KUBERNETES_URL }}
|
KUBERNETES_URL: ${{ secrets.KUBERNETES_URL }}
|
||||||
KUBERNETES_NAMESPACE: ${{ inputs.namespace || secrets.KUBERNETES_NAMESPACE }}
|
KUBERNETES_NAMESPACE: ${{ secrets.KUBERNETES_NAMESPACE }}
|
||||||
KUBERNETES_INGRESS_HOST: ${{ inputs.ingress_host || secrets.KUBERNETES_INGRESS_HOST }}
|
KUBERNETES_INGRESS_HOST: ${{ secrets.KUBERNETES_INGRESS_HOST }}
|
||||||
|
|
||||||
# Container registry configuration
|
# Container registry configuration
|
||||||
CONTAINER_REGISTRY_URL: ${{ secrets.CONTAINER_REGISTRY_URL }}
|
CONTAINER_REGISTRY_URL: ${{ secrets.CONTAINER_REGISTRY_URL }}
|
||||||
@@ -49,14 +28,14 @@ env:
|
|||||||
CONTAINER_REGISTRY_NAMESPACE: ${{ secrets.CONTAINER_REGISTRY_NAMESPACE }}
|
CONTAINER_REGISTRY_NAMESPACE: ${{ secrets.CONTAINER_REGISTRY_NAMESPACE }}
|
||||||
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
CONTAINER_IMAGE_NAME: ${{ secrets.CONTAINER_IMAGE_NAME }}
|
CONTAINER_IMAGE_NAME: ${{ secrets.CONTAINER_IMAGE_NAME }}
|
||||||
CONTAINER_IMAGE_TAG: ${{ inputs.image_tag || 'latest' }}
|
CONTAINER_IMAGE_TAG: ${{ secrets.CONTAINER_IMAGE_TAG }}
|
||||||
FORCE_RESTART: ${{ inputs.force_restart }}
|
FORCE_RESTART: ${{ secrets.KUBERNETES_FORCE_RESTART }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy to Kubernetes
|
name: Deploy to Kubernetes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Only run if CI workflow succeeded (for workflow_run trigger)
|
# Only run if CI workflow succeeded or manually dispatched
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -10,12 +10,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
image_tag:
|
|
||||||
description: 'Docker image tag (e.g., latest, v1.0.0)'
|
|
||||||
required: false
|
|
||||||
default: 'latest'
|
|
||||||
type: string
|
|
||||||
|
|
||||||
# Environment variables available to all jobs
|
# Environment variables available to all jobs
|
||||||
env:
|
env:
|
||||||
@@ -24,7 +18,7 @@ env:
|
|||||||
CONTAINER_REGISTRY_NAMESPACE: ${{ secrets.CONTAINER_REGISTRY_NAMESPACE }}
|
CONTAINER_REGISTRY_NAMESPACE: ${{ secrets.CONTAINER_REGISTRY_NAMESPACE }}
|
||||||
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
CONTAINER_IMAGE_NAME: ${{ secrets.CONTAINER_IMAGE_NAME }}
|
CONTAINER_IMAGE_NAME: ${{ secrets.CONTAINER_IMAGE_NAME }}
|
||||||
CONTAINER_IMAGE_TAG: ${{ inputs.image_tag || 'latest' }}
|
CONTAINER_IMAGE_TAG: ${{ secrets.CONTAINER_IMAGE_TAG }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
|
|||||||
Reference in New Issue
Block a user