From 3b2d012c29b15e08011d89af608198a251056da7 Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Wed, 31 May 2023 11:13:49 +0530 Subject: [PATCH 01/13] creating file: .github/workflows/github.yaml --- .github/workflows/github.yaml | 65 +++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/github.yaml diff --git a/.github/workflows/github.yaml b/.github/workflows/github.yaml new file mode 100644 index 0000000..e7fee86 --- /dev/null +++ b/.github/workflows/github.yaml @@ -0,0 +1,65 @@ +name: github +"on": + push: + branches: + - main + workflow_dispatch: {} +env: + ACR_RESOURCE_GROUP: exampleaks1registry_group + AZURE_CONTAINER_REGISTRY: exampleaks1registry + CLUSTER_NAME: example-aks1 + CLUSTER_RESOURCE_GROUP: example-resources + CONTAINER_NAME: image-workflow-1685511374382 + DEPLOYMENT_MANIFEST_PATH: | + ./manifests/deployment-1.yml + ./manifests/deployment.yml +jobs: + buildImage: + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1.4.3 + name: Azure login + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + - name: Build and push image to ACR + run: az acr build --image ${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.ACR_RESOURCE_GROUP }} -f ./Dockerfile ./ + deploy: + permissions: + actions: read + contents: read + id-token: write + runs-on: ubuntu-latest + needs: + - buildImage + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1.4.3 + name: Azure login + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + - uses: azure/use-kubelogin@v1 + name: Set up kubelogin for non-interactive login + with: + kubelogin-version: v0.0.25 + - uses: azure/aks-set-context@v3 + name: Get K8s context + with: + admin: "false" + cluster-name: ${{ env.CLUSTER_NAME }} + resource-group: ${{ env.CLUSTER_RESOURCE_GROUP }} + use-kubelogin: "true" + - uses: Azure/k8s-deploy@v4 + name: Deploys application + with: + action: deploy + images: ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} + manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }} + namespace: namespace-workflow-1685511374382 From f7ca005b6b94dfeeff0f49b4ab9ea4fadd7b1764 Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:43:30 +0530 Subject: [PATCH 02/13] creating file: .dockerignore --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..843dec4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +charts/ From 06b54277cded7b7b15ac8341af26c5e2e0bdf361 Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:43:31 +0530 Subject: [PATCH 03/13] creating file: Dockerfile --- Dockerfile | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index ae2dff7..b9132c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,11 @@ -FROM node:8 +FROM node:19 +ENV PORT 3000 +EXPOSE 3000 -# Create app directory +RUN mkdir -p /usr/src/app WORKDIR /usr/src/app - -# Install app dependencies -# A wildcard is used to ensure both package.json AND package-lock.json are copied -# where available (npm@5+) -COPY package*.json ./ - +COPY package.json . RUN npm install -# If you are building your code for production -# RUN npm install --only=production - -# Bundle app source COPY . . -EXPOSE 8080 -CMD [ "npm", "start" ] +CMD ["npm", "start"] From 727e1f0dcdb3adaad54ae3df88631a4e8867bdfd Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:43:31 +0530 Subject: [PATCH 04/13] creating file: manifests/deployment.yaml --- manifests/deployment.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 manifests/deployment.yaml diff --git a/manifests/deployment.yaml b/manifests/deployment.yaml new file mode 100644 index 0000000..a71d641 --- /dev/null +++ b/manifests/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: Demo + labels: + app: Demo + namespace: namespace-workflow-1685610716580 +spec: + replicas: 1 + selector: + matchLabels: + app: Demo + template: + metadata: + labels: + app: Demo + spec: + containers: + - name: Demo + image: acrworkflow1685610716580.azurecr.io/image-workflow-1685610716580:latest + ports: + - containerPort: 3000 \ No newline at end of file From 9a73ae03b6ad8415502f0e2c00826e7a5d66e5cd Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:43:31 +0530 Subject: [PATCH 05/13] creating file: manifests/service.yaml --- manifests/service.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 manifests/service.yaml diff --git a/manifests/service.yaml b/manifests/service.yaml new file mode 100644 index 0000000..e745ff2 --- /dev/null +++ b/manifests/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: Demo + namespace: namespace-workflow-1685610716580 +spec: + type: LoadBalancer + selector: + app: Demo + ports: + - protocol: TCP + port: 3000 + targetPort: 3000 \ No newline at end of file From 3fd6d781fe2b94d2068f03038f9476c43d642a22 Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:43:32 +0530 Subject: [PATCH 06/13] creating file: .github/workflows/Demo.yaml --- .github/workflows/Demo.yaml | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/Demo.yaml diff --git a/.github/workflows/Demo.yaml b/.github/workflows/Demo.yaml new file mode 100644 index 0000000..7898941 --- /dev/null +++ b/.github/workflows/Demo.yaml @@ -0,0 +1,65 @@ +name: Demo +"on": + push: + branches: + - main + workflow_dispatch: {} +env: + ACR_RESOURCE_GROUP: my-resource-group + AZURE_CONTAINER_REGISTRY: acrworkflow1685610716580 + CLUSTER_NAME: my-aks-cluster + CLUSTER_RESOURCE_GROUP: my-resource-group + CONTAINER_NAME: image-workflow-1685610716580 + DEPLOYMENT_MANIFEST_PATH: | + manifests/deployment.yaml + manifests/service.yaml +jobs: + buildImage: + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1.4.3 + name: Azure login + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + - name: Build and push image to ACR + run: az acr build --image ${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.ACR_RESOURCE_GROUP }} -f Dockerfile ./ + deploy: + permissions: + actions: read + contents: read + id-token: write + runs-on: ubuntu-latest + needs: + - buildImage + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1.4.3 + name: Azure login + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + - uses: azure/use-kubelogin@v1 + name: Set up kubelogin for non-interactive login + with: + kubelogin-version: v0.0.25 + - uses: azure/aks-set-context@v3 + name: Get K8s context + with: + admin: "false" + cluster-name: ${{ env.CLUSTER_NAME }} + resource-group: ${{ env.CLUSTER_RESOURCE_GROUP }} + use-kubelogin: "true" + - uses: Azure/k8s-deploy@v4 + name: Deploys application + with: + action: deploy + images: ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} + manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }} + namespace: namespace-workflow-1685610716580 From a3a43cac4550d398c0de541843d235654f69ee89 Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:00:29 +0530 Subject: [PATCH 07/13] creating file: .dockerignore From 13ef4a2f20e766b32b1c9a22084298015db9069e Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:00:29 +0530 Subject: [PATCH 08/13] creating file: Dockerfile From aed7d9db72004ece374e118c41443d9c0abdb973 Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:00:29 +0530 Subject: [PATCH 09/13] creating file: manifests/deployment.yaml --- manifests/deployment.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/deployment.yaml b/manifests/deployment.yaml index a71d641..4a8e154 100644 --- a/manifests/deployment.yaml +++ b/manifests/deployment.yaml @@ -1,22 +1,22 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: Demo + name: demo-app labels: - app: Demo - namespace: namespace-workflow-1685610716580 + app: demo-app + namespace: namespace-workflow-1685611537556 spec: replicas: 1 selector: matchLabels: - app: Demo + app: demo-app template: metadata: labels: - app: Demo + app: demo-app spec: containers: - - name: Demo - image: acrworkflow1685610716580.azurecr.io/image-workflow-1685610716580:latest + - name: demo-app + image: acrworkflow1685611537556.azurecr.io/image-workflow-1685611537556:latest ports: - containerPort: 3000 \ No newline at end of file From bda71c3019c6cf6a5554ca5b97a18b1b5bb10fea Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:00:30 +0530 Subject: [PATCH 10/13] creating file: manifests/service.yaml --- manifests/service.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/service.yaml b/manifests/service.yaml index e745ff2..662325e 100644 --- a/manifests/service.yaml +++ b/manifests/service.yaml @@ -1,12 +1,12 @@ apiVersion: v1 kind: Service metadata: - name: Demo - namespace: namespace-workflow-1685610716580 + name: demo-app + namespace: namespace-workflow-1685611537556 spec: type: LoadBalancer selector: - app: Demo + app: demo-app ports: - protocol: TCP port: 3000 From e86ff7a688fb50239fd560513e452fce96ef9dd5 Mon Sep 17 00:00:00 2001 From: edwinkullu <48440733+edwinkullu@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:00:30 +0530 Subject: [PATCH 11/13] creating file: .github/workflows/demo-app.yaml --- .github/workflows/demo-app.yaml | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/demo-app.yaml diff --git a/.github/workflows/demo-app.yaml b/.github/workflows/demo-app.yaml new file mode 100644 index 0000000..0932ef7 --- /dev/null +++ b/.github/workflows/demo-app.yaml @@ -0,0 +1,65 @@ +name: demo-app +"on": + push: + branches: + - main + workflow_dispatch: {} +env: + ACR_RESOURCE_GROUP: my-resource-group + AZURE_CONTAINER_REGISTRY: acrworkflow1685611537556 + CLUSTER_NAME: my-aks-cluster + CLUSTER_RESOURCE_GROUP: my-resource-group + CONTAINER_NAME: image-workflow-1685611537556 + DEPLOYMENT_MANIFEST_PATH: | + manifests/deployment.yaml + manifests/service.yaml +jobs: + buildImage: + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1.4.3 + name: Azure login + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + - name: Build and push image to ACR + run: az acr build --image ${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.ACR_RESOURCE_GROUP }} -f Dockerfile ./src + deploy: + permissions: + actions: read + contents: read + id-token: write + runs-on: ubuntu-latest + needs: + - buildImage + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1.4.3 + name: Azure login + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + - uses: azure/use-kubelogin@v1 + name: Set up kubelogin for non-interactive login + with: + kubelogin-version: v0.0.25 + - uses: azure/aks-set-context@v3 + name: Get K8s context + with: + admin: "false" + cluster-name: ${{ env.CLUSTER_NAME }} + resource-group: ${{ env.CLUSTER_RESOURCE_GROUP }} + use-kubelogin: "true" + - uses: Azure/k8s-deploy@v4 + name: Deploys application + with: + action: deploy + images: ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} + manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }} + namespace: namespace-workflow-1685611537556 From 1ea1a4fe137f4cab08b3bfaff3fbbd54f8ddf654 Mon Sep 17 00:00:00 2001 From: Edwin kullu <48440733+edwinkullu@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:47:41 +0530 Subject: [PATCH 12/13] Create sync_codeowners_to_devops.yml --- .../workflows/sync_codeowners_to_devops.yml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/sync_codeowners_to_devops.yml diff --git a/.github/workflows/sync_codeowners_to_devops.yml b/.github/workflows/sync_codeowners_to_devops.yml new file mode 100644 index 0000000..763fbac --- /dev/null +++ b/.github/workflows/sync_codeowners_to_devops.yml @@ -0,0 +1,31 @@ +name: Sync CODEOWNERS to DevOps Repo + +on: + push: + paths: + - CODEOWNERS + +jobs: + sync-codeowners: + runs-on: ubuntu-latest + + steps: + - name: Checkout Source Repository + uses: actions/checkout@v2 + + - name: Sync CODEOWNERS to DevOps Repo + env: + GITHUB_TOKEN: ${{ secrets.TARGET_REPOS_PAT }} + run: | + # Clone the devops repo + git clone https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/edwinkullu/Terraform.git + + # Copy CODEOWNERS to the devops repo + cp CODEOWNERS Terraform/.github/CODEOWNERS + + cd devops-repo + git add .github/CODEOWNERS + git commit -m "Update CODEOWNERS from repo2" + git push + cd .. + rm -rf devops-repo From bab4cb87dbbb29e4d2f6265ed72122cc0bb77895 Mon Sep 17 00:00:00 2001 From: Edwin kullu <48440733+edwinkullu@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:53:44 +0530 Subject: [PATCH 13/13] Create CODEOWNERS --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +