name: Build & push datadog agent images

on:
  schedule:
    - cron: "0 0 * * *"
  pull_request:
  push:
    paths:
      - 'oci/datadog/agent/Dockerfile'
      - 'oci/datadog/cluster-agent/Dockerfile'
      - '.github/workflows/datadog-agent.yaml'
  workflow_dispatch:
    branches: [ 'main' ]

jobs:
  datadog-cluster-agent:
    runs-on: ubuntu-latest
    name: build chart builder datadog-cluster-agent image
    steps:
      - uses: actions/checkout@master

      - name: 'Artifact: build && push datadog-cluster-agent image'
        uses: aevea/action-kaniko@master
        with:
          registry: artifact.onwalk.net
          username: admin 
          password: ${{ secrets.HELM_REPO_PASSWORD }}
          path: 'oci/datadog/cluster-agent/'
          build_file: 'Dockerfile'
          image: public/datadog/cluster-agent
          tag: 7.44.1
          cache: false
          cache_registry: cache
  datadog-agent:
    runs-on: ubuntu-latest
    name: build chart builder datadog-agent image
    steps:
      - uses: actions/checkout@master

      - name: 'Artifact: build && push datadog-agent image'
        uses: aevea/action-kaniko@master
        with:
          registry: artifact.onwalk.net
          username: admin 
          password: ${{ secrets.HELM_REPO_PASSWORD }}
          path: 'oci/datadog/agent/'
          build_file: 'Dockerfile'
          image: public/datadog/agent
          tag: 7.44.1
          cache: false
          cache_registry: cache
