Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/explore workflow #4

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
69b4c9b
Reusable Workflows
shashi2504 Jan 8, 2025
80d37d8
Reusable Workflows
shashi2504 Jan 8, 2025
43c7c7b
Debugging
shashi2504 Jan 8, 2025
a4a067b
Debugging
shashi2504 Jan 8, 2025
40e9e5c
Reusable Workflows
shashi2504 Jan 8, 2025
88ec6be
added reusable workflows
shashi2504 Jan 8, 2025
13ea077
Debugging
shashi2504 Jan 8, 2025
d013597
using reusable workflows
shashi2504 Jan 8, 2025
79fe6bb
used reusable workflows
shashi2504 Jan 8, 2025
a93b695
using reusable workflows
shashi2504 Jan 8, 2025
00ff0e9
using reusable workflows
shashi2504 Jan 8, 2025
5f85d68
reusable workflows
shashi2504 Jan 8, 2025
af13ecd
reusable workflows
shashi2504 Jan 8, 2025
27e57df
reusable workflows
shashi2504 Jan 8, 2025
7222f9c
reusable workflows - Error 06
shashi2504 Jan 8, 2025
f50d701
resolved few errors
shashi2504 Jan 8, 2025
f9e5719
re-running the reusable workflows
shashi2504 Jan 8, 2025
45785b3
Debugging - 01
shashi2504 Jan 8, 2025
1f2789b
resolved error by updating kubeconfig
shashi2504 Jan 8, 2025
ad8ffc9
updated the called workflow with secrets
shashi2504 Jan 8, 2025
db780fc
passing secrets to the called workflows
shashi2504 Jan 8, 2025
ed6519e
used inputs for adding flexibility to called workflows
shashi2504 Jan 8, 2025
e513a23
used inputs for adding flexibility to called workflows
shashi2504 Jan 8, 2025
6c06533
used inputs for adding flexibility to called workflows
shashi2504 Jan 8, 2025
6d4504b
used outputs in called workflows
shashi2504 Jan 8, 2025
9b85b54
added jobs for storing reports
shashi2504 Jan 9, 2025
e3f8c73
Resolved Error - reports job
shashi2504 Jan 9, 2025
797f490
uploading artifacts to s3 bucket
shashi2504 Jan 9, 2025
9d72a5c
Added Slack Integration or Workflow
shashi2504 Jan 9, 2025
44bf0fc
Added Slack Integration to workflow
shashi2504 Jan 9, 2025
255bcfe
Created composite action for workflow
shashi2504 Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/custom-actions/npm-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Npm Actions'
description: 'Used for installing and caching the dependencies'
inputs:
path:
description: 'Enter the path to cache'
required: true
runs:
using: 'composite'
steps:
- name: Caching Dependencies
uses: actions/cache@v3
with:
path: ${{ inputs.path }}
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}

- name: Installing Dependencies
run: npm install
shell: bash
102 changes: 102 additions & 0 deletions .github/workflows/reuse-deployments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Reusable Workflows

on:
workflow_call:
secrets:
k8s-kubeconfig:
required: true
mongodb-password:
required: true
inputs:
mongo-uri:
required: true
type: string
kubectl-version:
description: Provide the required kubectl version
default: v1.26.0
required: false
type: string
k8s-manifest-direc:
description: Direc containing the k8s manifest files
default: kubernetes
required: true
type: string
environment:
description: Provide which environment to deploy
default: dev
required: true
type: string

outputs:
application-url:
value: ${{ jobs.reuse-deploy.outputs.APP_INGRESS_URL }}

jobs:
reuse-deploy:
environment:
name: ${{ inputs.environment }}
url: https://${{ steps.set-ingress-host-address.outputs.APP_INGRESS_HOST }}
outputs:
APP_INGRESS_URL: ${{ steps.set-ingress-host-address.outputs.APP_INGRESS_HOST }}
runs-on: ubuntu-latest
steps:
- name: Checkout the Repository
uses: actions/checkout@v4

- name: Setting up the kubectl env
uses: azure/setup-kubectl@v4
with:
version: '${{ inputs.kubectl-version }}'

- name: Setup kubeconfig
uses: azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: ${{ secrets.k8s-kubeconfig }}

- name: Fetch K8s Cluster Details
run: |
kubectl version --short
echo ----------------------------
kubectl get nodes

- name: Storing Nginx Ingress Controller Hostname as a GitHub Env Variable
run: |
echo "INGRESS_IP=$(kubectl -n ingress-nginx get svc ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')" >> $GITHUB_ENV

- name: Replace Tokens in Manifest Files
uses: cschleiden/replace-tokens@v1
with:
tokenPrefix: '_{_'
tokenSuffix: '_}_'
files: '["${{ inputs.k8s-manifest-direc }}*.yaml"]'
env:
NAMESPACE: ${{ vars.NAMESPACE }}
REPLICAS: ${{ vars.REPLICAS }}
IMAGE: ${{ vars.DOCKER_USERNAME }}/solar-system:${{ github.sha }}
INGRESS_IP: ${{ env.INGRESS_IP }}

- name: Check files
run: |
cat ${{ inputs.k8s-manifest-direc }}*.yaml

- name: Create MongoDB Secret
run: |
kubectl -n ${{ vars.NAMESPACE }} create secret generic mongo-db-creds \
--from-literal=MONGO_URI=${{ inputs.mongo-uri }} \
--from-literal=MONGO_USERNAME=${{ vars.MONGO_USERNAME }} \
--from-literal=MONGO_PASSWORD=${{ secrets.mongodb-password }} \
--save-config \
--dry-run=client \
-o yaml | kubectl apply -f -

- name: Deploying the application to Dev Env
run: |
kubectl apply -f ${{ inputs.k8s-manifest-direc }}

- name: Application ingress host
id: set-ingress-host-address
run: |
echo "APP_INGRESS_HOST=$(kubectl get ingress -n ${{ vars.NAMESPACE }} -o jsonpath="{.items[0].spec.tls[0].hosts[0]}")" >> "$GITHUB_OUTPUT"


Loading
Loading