diff --git a/aio/aio-builds-setup/dockerbuild/Dockerfile b/aio/aio-builds-setup/dockerbuild/Dockerfile index 5351b5f95f..4ce6f36484 100644 --- a/aio/aio-builds-setup/dockerbuild/Dockerfile +++ b/aio/aio-builds-setup/dockerbuild/Dockerfile @@ -83,6 +83,7 @@ RUN yarn global add pm2@2 COPY cronjobs/aio-builds-cleanup /etc/cron.d/ RUN chmod 0744 /etc/cron.d/aio-builds-cleanup RUN crontab /etc/cron.d/aio-builds-cleanup +RUN printenv | grep AIO_ >> /etc/environment # Set up dnsmasq diff --git a/aio/aio-builds-setup/dockerbuild/cronjobs/aio-builds-cleanup b/aio/aio-builds-setup/dockerbuild/cronjobs/aio-builds-cleanup index 1b5d9c8000..3e6e5117ea 100644 --- a/aio/aio-builds-setup/dockerbuild/cronjobs/aio-builds-cleanup +++ b/aio/aio-builds-setup/dockerbuild/cronjobs/aio-builds-cleanup @@ -1,2 +1,2 @@ # Periodically clean up builds that do not correspond to currently open PRs -0 4 * * * root /usr/local/bin/aio-clean-up >> /var/log/cron.log 2>&1 +0 12 * * * root /usr/local/bin/aio-clean-up >> /var/log/cron.log 2>&1 diff --git a/aio/aio-builds-setup/dockerbuild/scripts-js/lib/clean-up/index.ts b/aio/aio-builds-setup/dockerbuild/scripts-js/lib/clean-up/index.ts index ed43490ec3..c9819dd998 100644 --- a/aio/aio-builds-setup/dockerbuild/scripts-js/lib/clean-up/index.ts +++ b/aio/aio-builds-setup/dockerbuild/scripts-js/lib/clean-up/index.ts @@ -12,6 +12,8 @@ _main(); // Functions function _main() { + console.log(`[${new Date()}] - Cleaning up builds...`); + const buildCleaner = new BuildCleaner(AIO_BUILDS_DIR, AIO_REPO_SLUG, AIO_GITHUB_TOKEN); buildCleaner.cleanUp().catch(err => { diff --git a/aio/aio-builds-setup/dockerbuild/scripts-sh/clean-up.sh b/aio/aio-builds-setup/dockerbuild/scripts-sh/clean-up.sh index 0abd445d9a..18189629c3 100755 --- a/aio/aio-builds-setup/dockerbuild/scripts-sh/clean-up.sh +++ b/aio/aio-builds-setup/dockerbuild/scripts-sh/clean-up.sh @@ -1,4 +1,8 @@ #!/bin/bash set -e -o pipefail +# Set up env variables +export AIO_GITHUB_TOKEN=$(head -c -1 /aio-secrets/GITHUB_TOKEN 2>/dev/null) + +# Run the clean-up node $AIO_SCRIPTS_JS_DIR/dist/lib/clean-up >> /var/log/aio/clean-up.log 2>&1