Score:0

How to deploy to azure kubernetes using github actions when there is a new tag?

uz flag

I am trying to connect to cluster and create a namespace using github actions. And then doing the deployment using the yaml files saved in repository. Also, the acr container registry is being used here and creating a tag everytime using the short-ID of github commit. How to update the deployment to use the new tag once the push is completed.

The below run task is using static yaml files only.

name: Deploy to Cluster
uses: azure/k8s-deploy@v1
with:
manifests: |
manifests/deployment.yml
manifests/service.yml
images: |
${{ env.REGISTRY_NAME }}.azurecr.io/${{ env.APP_NAME }}:${{ github.sha }}
imagepullsecrets: |
${{ env.SECRET }}
namespace: ${{ env.NAMESPACE }}

the deployment.yaml file:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: testingservice
spec:
  replicas: 1
  selector:
    matchLabels:
      service: testingservice
      app: testingservice
  template:
    metadata:
      labels:
        service: testingservice
        app: testingservice
      annotations:
        consul.hashicorp.com/connect-inject: "true"
        consul.hashicorp.com/enable-metrics-merging: "false"
    spec:
      imagePullSecrets:
        - name: acr-cred
      containers:
        - name: testingservice
          image: testingserverlinux.azurecr.io/testingservice:1.8
          ports:
            - containerPort: 8080
              name: vault-port

The image I am using above is: testingserverlinux.azurecr.io/testingservice:1.8

How to change the id from static 1.8 value to github short id everytime I build.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.