apiVersion: batch/v1
kind: Job
metadata:
  name: placeholder-agent
  labels:
    app: placeholder-agent
spec:
  activeDeadlineSeconds: 180
  template:
    metadata:
      labels:
        aadpodidbinding: ${podmi}
        app: placeholder-agent
    spec:
      containers:
      - name: azdevops-agent-job
        image: ${image}
        imagePullPolicy: Always
        env:
          - name: VSTS_AGENT_INPUT_URL
            value: ${VSTS_AGENT_INPUT_URL}
          - name: VSTS_AGENT_INPUT_TOKEN
            valueFrom:
                secretKeyRef:
                  name: pat-secret-sync
                  key: personalAccessToken
          - name: VSTS_AGENT_INPUT_POOL
            value: ${VSTS_AGENT_INPUT_POOL}
          - name: VSTS_AGENT_INPUT_AUTH
            value: "pat"
          - name: VSTS_AGENT_INPUT_RUN_ARGS
            value: "--once"
        # lifecycle:
        #   preStop:
        #     exec:
        #       # SIGTERM triggers a quick exit; gracefully terminate instead
        #       command: ["/home/vscode/agent/config.sh","remove","--unattended"]
      restartPolicy: Never