Deploy using Rancher Fleet
Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com>
This commit is contained in:
parent
79699b5a07
commit
74f7e1ccec
54
.github/workflows/deploy-base.yaml
vendored
54
.github/workflows/deploy-base.yaml
vendored
@ -1,54 +0,0 @@
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
image:
|
||||
type: string
|
||||
required: true
|
||||
env_url:
|
||||
type: string
|
||||
required: true
|
||||
env_name:
|
||||
type: string
|
||||
required: true
|
||||
|
||||
secrets:
|
||||
KUBECONFIG: { required: true }
|
||||
|
||||
env:
|
||||
NAMESPACE: dit-docs
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
timeout-minutes: 10
|
||||
runs-on: [self-hosted, ubuntu-focal]
|
||||
environment:
|
||||
url: ${{ inputs.env_url }}
|
||||
name: ${{ inputs.env_name }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Kubectl tool installer
|
||||
uses: Azure/setup-kubectl@v3
|
||||
|
||||
- uses: azure/k8s-set-context@v3
|
||||
with:
|
||||
method: kubeconfig
|
||||
kubeconfig: ${{ secrets.KUBECONFIG }}
|
||||
|
||||
- name: Setup Kustomize
|
||||
uses: imranismail/setup-kustomize@v2
|
||||
|
||||
- name: Edit kustomization file
|
||||
working-directory: kubernetes/base
|
||||
run: kustomize edit set image IMAGE="${{ inputs.image }}"
|
||||
|
||||
- name: Deploy
|
||||
working-directory: kubernetes/${{ inputs.env_name }}
|
||||
run: |-
|
||||
|
||||
kustomize build | kubectl apply -f -
|
||||
kubectl rollout -n "$NAMESPACE" status deployment/dsm-client-deployment -w --timeout=3m
|
||||
45
.github/workflows/deploy-dev.yaml
vendored
45
.github/workflows/deploy-dev.yaml
vendored
@ -1,45 +0,0 @@
|
||||
---
|
||||
name: Deploy To Development
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- ".vscode/**"
|
||||
|
||||
- ".github/**"
|
||||
- "!.github/workflows/tests-base.yaml"
|
||||
- "!.github/workflows/deploy-base.yaml"
|
||||
- "!.github/workflows/deploy-dev.yaml"
|
||||
|
||||
concurrency:
|
||||
group: deploy-dev
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/tests-base.yaml
|
||||
|
||||
build:
|
||||
uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1
|
||||
needs: test
|
||||
with:
|
||||
image: dit-docs/dsm-client
|
||||
runs-on: "['ubuntu-latest']"
|
||||
secrets:
|
||||
username: ${{ secrets.HARBOR_PUBLIC_USER }}
|
||||
password: ${{ secrets.HARBOR_PUBLIC_TOKEN }}
|
||||
|
||||
deploy:
|
||||
uses: ./.github/workflows/deploy-base.yaml
|
||||
needs: build
|
||||
with:
|
||||
image: ${{ needs.build.outputs.tag }}
|
||||
env_url: https://service-manual.docs.dev.krd
|
||||
env_name: development
|
||||
|
||||
secrets:
|
||||
KUBECONFIG: ${{ secrets.KUBECONFIG }}
|
||||
45
.github/workflows/deploy-production.yaml
vendored
45
.github/workflows/deploy-production.yaml
vendored
@ -1,45 +0,0 @@
|
||||
---
|
||||
name: Deploy To Production
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- ".vscode/**"
|
||||
|
||||
- ".github/**"
|
||||
- "!.github/workflows/tests-base.yaml"
|
||||
- "!.github/workflows/deploy-base.yaml"
|
||||
- "!.github/workflows/deploy-production.yaml"
|
||||
|
||||
concurrency:
|
||||
group: deploy-production
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@main
|
||||
|
||||
build:
|
||||
uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1
|
||||
needs: test
|
||||
with:
|
||||
image: dit-docs/dsm-client
|
||||
runs-on: "['ubuntu-latest']"
|
||||
secrets:
|
||||
username: ${{ secrets.HARBOR_PUBLIC_USER }}
|
||||
password: ${{ secrets.HARBOR_PUBLIC_TOKEN }}
|
||||
|
||||
deploy:
|
||||
uses: ./.github/workflows/deploy-base.yaml
|
||||
needs: build
|
||||
with:
|
||||
image: ${{ needs.build.outputs.tag }}
|
||||
env_url: https://docs.digital.gov.krd
|
||||
env_name: production
|
||||
|
||||
secrets:
|
||||
KUBECONFIG: ${{ secrets.KUBECONFIG }}
|
||||
9
kubernetes/fleet.yaml
Normal file
9
kubernetes/fleet.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
namespace: dit-docs
|
||||
|
||||
targetCustomizations:
|
||||
- name: development
|
||||
clusterSelector:
|
||||
matchLabels:
|
||||
env: dev
|
||||
kustomize:
|
||||
dir: development
|
||||
Loading…
Reference in New Issue
Block a user