From 10ee8e98cebede89188aa39c3465479983f6bfe8 Mon Sep 17 00:00:00 2001 From: joybb <32850159+joybb@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:47:55 -0700 Subject: [PATCH] Create files --- .github/workflows/test11.yaml | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/test11.yaml diff --git a/.github/workflows/test11.yaml b/.github/workflows/test11.yaml new file mode 100644 index 0000000..0b69a92 --- /dev/null +++ b/.github/workflows/test11.yaml @@ -0,0 +1,72 @@ +name: test11 +"on": + push: + branches: + - main + workflow_dispatch: {} +env: + ACR_RESOURCE_GROUP: sumin-rg + AZURE_CONTAINER_REGISTRY: acrworkflow1713908791840 + CLUSTER_NAME: sk-backup-uninstalled + CLUSTER_RESOURCE_GROUP: sumin-rg + CONTAINER_NAME: image-workflow-1713908791840 + DEPLOYMENT_MANIFEST_PATH: | + ./k8s-specifications/db-deployment.yaml + ./k8s-specifications/db-service.yaml + ./k8s-specifications/redis-deployment.yaml + ./k8s-specifications/redis-service.yaml + ./k8s-specifications/result-deployment.yaml + ./k8s-specifications/result-service.yaml + ./k8s-specifications/vote-deployment.yaml + ./k8s-specifications/vote-service.yaml + ./k8s-specifications/worker-deployment.yaml +jobs: + buildImage: + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 + 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 ./docker-compose.yml ./ + deploy: + permissions: + actions: read + contents: read + id-token: write + runs-on: ubuntu-latest + needs: + - buildImage + steps: + - uses: actions/checkout@v3 + - uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 + 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-1713908791840