Merge pull request #7 from bigeyedata/andy/schedule-workflow #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy named schedules | |
on: | |
push: | |
branches: [ main ] | |
env: | |
BIGEYE_CREDENTIALS: ${{ secrets.BIGEYE_API_CREDENTIALS }} | |
BIGEYE_CONFIG: ${{ secrets.BIGEYE_API_CONFIGS }} | |
jobs: | |
deploy_virtual_tables: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.9" ] | |
os: [ ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Verify Changed files | |
uses: tj-actions/changed-files@v44 | |
id: verify-changed-files | |
with: | |
files: | | |
schedules/*.{yaml,yml} | |
- name: Deploy named schedules | |
if: steps.verify-changed-files.outputs.any_changed == 'true' | |
env: | |
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.all_changed_files }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install bigeye-cli | |
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq | |
echo "$BIGEYE_CONFIG" >> config.ini | |
echo "$BIGEYE_CREDENTIALS" >> credentials.ini | |
for file in ${CHANGED_FILES}; do | |
echo "Creating schedule from ${file}" | |
schedule_info=$(<"${file}") | |
sname=$(echo "${schedule_info}" | yq '.schedule_name') | |
schedule_cron=$(echo "${schedule_info}" | yq '.cron') | |
bigeye workspace create-named-schedule -b credentials.ini -c config.ini --name "${sname}" --cron "${schedule_cron}" | |
done | |