Skip to content

workflow-tdb-schedule #47709

workflow-tdb-schedule

workflow-tdb-schedule #47709

name: workflow-tdb-schedule
on:
schedule:
# run every 60 minutes
- cron: "*/60 * * * *"
jobs:
run-tdb:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download and unpack GitHub CLI
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 3
attempt_delay: 600000
command: |
cd /tmp
github_cli_download_url=$(curl -sL https://api.github.com/repos/cli/cli/releases/latest | \
jq -r '.assets[] | select(.name? | match("gh.*linux_amd64.tar.gz")) | .browser_download_url')
curl -o './github-cli.tar.gz' -L "${github_cli_download_url}"
tar -xvf './github-cli.tar.gz'
sudo cp ./gh*linux_amd64/bin/gh '/usr/local/bin/'
- name: Authenticate with GitHub for private Gist
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 3
attempt_delay: 600000
command: |
echo "${{ secrets.TDB_PAT }}" | gh auth login --with-token
- name: Get Gist ID
shell: bash
run: |
config_file_desc='trigger-docker-build-config'
gist_id=$(gh gist list --secret | grep -P -m 1 "${config_file_desc}" | awk -F ' ' '{ print $1 }')
echo "::add-mask::$gist_id"
echo "gist_id=$gist_id" >> $GITHUB_OUTPUT
id: get_gist_id
- name: Change directory to workspace
shell: bash
run: |
cd "${GITHUB_WORKSPACE}"
- name: Download config from secret Gist
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 3
attempt_delay: 600000
command: |
echo "[debug] Gist ID is '${{ steps.get_gist_id.outputs.gist_id }}'"
gh gist clone "${{ steps.get_gist_id.outputs.gist_id }}" '/tmp/gist'
cp '/tmp/gist/config.ini' './configs'
- name: Run Trigger Docker Builds (TDB)
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 3
attempt_delay: 600000
command: |
pip install -r ./requirements.txt
python3 ./TriggerDockerBuild.py \
--config ./configs \
--logs ./logs \
--email-notification \
--email-to "${{ secrets.EMAIL_ADDRESS }}" \
--email-username "${{ secrets.EMAIL_ADDRESS }}" \
--email-password "${{ secrets.EMAIL_PASSWORD }}" \
--target-access-token "${{ secrets.TDB_PAT }}"
- name: Create Gist
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 3
attempt_delay: 600000
command: |
gh gist create './configs/config.ini' --desc 'trigger-docker-build-config' >/dev/null 2>&1
- name: Delete previous Gist
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 3
attempt_delay: 600000
command: |
gh gist delete ${{ steps.get_gist_id.outputs.gist_id }} --yes
- name: Debug
shell: bash
run: |
echo "[debug] file contents of config file 'config.ini' is..." && cat './configs/config.ini'
echo "[debug] file contents of log file 'app.log' is..." && cat './logs/app.log'