Skip to content

Scheduled Jobs

Scheduled Jobs #2687

name: Scheduled Jobs
on:
schedule:
- cron: "0 */8 * * *"
push:
branches:
- main
paths-ignore:
- schema/**
- definitions/**
- docs/COMPARISON.md
- registry.yaml
workflow_dispatch:
inputs:
reset:
description: Space-separated paths to remove from schema before running an update
default: ""
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-schemas:
name: Update schemas
runs-on: ubuntu-latest
if: github.repository == 'CustomResourceDefinition/catalog' || github.event_name == 'workflow_dispatch'
permissions:
contents: write
outputs:
updated: ${{ steps.committer.outputs.pushed }}
steps:
- uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.DEPLOY_KEY_SCHEDULED_JOBS }}
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Optionally remove paths
if: github.event_name == 'workflow_dispatch' && github.event.inputs.reset != ''
run: |
cd schema
rm -rf ${{ github.event.inputs.reset }} || true
cd -
cd definitions
rm -rf ${{ github.event.inputs.reset }} || true
cd -
- name: Create token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: catalog
- run: make update
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- uses: actions/checkout@v6
with:
repository: datreeio/CRDs-catalog
path: build/remote/datreeio
- run: make comparison
- uses: EndBug/add-and-commit@v9
name: Publish changes
if: github.repository == 'CustomResourceDefinition/catalog' && github.ref == 'refs/heads/main'
id: committer
with:
add: |
- schema
- definitions
- docs/COMPARISON.md
- registry.yaml
default_author: github_actions
report-failures:
name: Report failures
runs-on: ubuntu-latest
needs:
- update-schemas
- sync-tags
if: failure() && github.repository == 'CustomResourceDefinition/catalog' && github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch'
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v6
- name: Report build failure
uses: CodeReaper/create-issue-action@v1
with:
title: ${{ github.workflow }} failed
assignees: CodeReaper
body: See the [log](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
comment: Latest failed runs [log](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
sync-tags:
name: Synchronize tags with kubernetes
runs-on: ubuntu-latest
needs: update-schemas
if: github.repository == 'CustomResourceDefinition/catalog' && github.ref == 'refs/heads/main' && needs.update-schemas.outputs.updated == 'true'
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.DEPLOY_KEY_SCHEDULED_JOBS }}
fetch-depth: 0
- uses: actions/checkout@v6
with:
repository: kubernetes/kubernetes
path: build/remote/kubernetes
fetch-depth: 0
- run: make tags
- run: git push --tags