0

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.

uday kiran
  • 46
  • 4

0 Answers0