From 4f54e15993ab30c2c44c820231f37a104bab7389 Mon Sep 17 00:00:00 2001 From: Riken Shah Date: Sat, 12 Jun 2021 06:24:59 +0000 Subject: [PATCH] refactor: Convert `clean-unused-caches` to`clean_unused_caches.py`. We convert the `clean-unused-caches` script to a python file so we can run it in provision by importing it instead of running the script, hence saving some time. --- .github/workflows/zulip-ci.yml | 2 +- scripts/lib/{clean-unused-caches => clean_unused_caches.py} | 0 scripts/purge-old-deployments | 4 ++-- .../fixtures/github_bionic_backend_frontend_failure.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename scripts/lib/{clean-unused-caches => clean_unused_caches.py} (100%) diff --git a/.github/workflows/zulip-ci.yml b/.github/workflows/zulip-ci.yml index d729414f79..2633b30634 100644 --- a/.github/workflows/zulip-ci.yml +++ b/.github/workflows/zulip-ci.yml @@ -115,7 +115,7 @@ jobs: # Cleaning caches is mostly unnecessary in GitHub Actions, because # most builds don't get to write to the cache. - # scripts/lib/clean-unused-caches --verbose --threshold 0 + # scripts/lib/clean_unused_caches.py --verbose --threshold 0 - name: Run tools test run: | diff --git a/scripts/lib/clean-unused-caches b/scripts/lib/clean_unused_caches.py similarity index 100% rename from scripts/lib/clean-unused-caches rename to scripts/lib/clean_unused_caches.py diff --git a/scripts/purge-old-deployments b/scripts/purge-old-deployments index 811c52b9cf..c6c2477225 100755 --- a/scripts/purge-old-deployments +++ b/scripts/purge-old-deployments @@ -85,9 +85,9 @@ def main() -> None: print("Deployments cleaned successfully...") print("Cleaning orphaned/unused caches...") - # Call 'clean-unused-caches' script to clean any orphaned/unused caches. + # Call 'clean_unused_caches.py' script to clean any orphaned/unused caches. subprocess.check_call( - [os.path.join(ZULIP_PATH, "scripts/lib/clean-unused-caches"), *sys.argv[1:]] + [os.path.join(ZULIP_PATH, "scripts/lib/clean_unused_caches.py"), *sys.argv[1:]] ) print("Done!") diff --git a/zerver/webhooks/circleci/fixtures/github_bionic_backend_frontend_failure.json b/zerver/webhooks/circleci/fixtures/github_bionic_backend_frontend_failure.json index 705eeef699..62ad944324 100755 --- a/zerver/webhooks/circleci/fixtures/github_bionic_backend_frontend_failure.json +++ b/zerver/webhooks/circleci/fixtures/github_bionic_backend_frontend_failure.json @@ -253,7 +253,7 @@ "failed": null, "infrastructure_fail": null, "name": "install dependencies", - "bash_command": "#!/bin/bash -eo pipefail\nsudo apt-get update\n# Install moreutils so we can use `ts` and `mispipe` in the following.\nsudo apt-get install -y moreutils\n\n# CircleCI sets the following in Git config at clone time:\n# url.ssh://git@github.com.insteadOf https://github.com\n# This breaks the Git clones in the NVM `install.sh` we run\n# in `install-node`.\n# TODO: figure out why that breaks, and whether we want it.\n# (Is it an optimization?)\nrm -f /home/circleci/.gitconfig\n\n# This is the main setup job for the test suite\nmispipe \"tools/ci/setup-backend\" ts\n\n# Cleaning caches is mostly unnecessary in Circle, because\n# most builds don't get to write to the cache.\n# mispipe \"scripts/lib/clean-unused-caches --verbose --threshold 0\" ts\n", + "bash_command": "#!/bin/bash -eo pipefail\nsudo apt-get update\n# Install moreutils so we can use `ts` and `mispipe` in the following.\nsudo apt-get install -y moreutils\n\n# CircleCI sets the following in Git config at clone time:\n# url.ssh://git@github.com.insteadOf https://github.com\n# This breaks the Git clones in the NVM `install.sh` we run\n# in `install-node`.\n# TODO: figure out why that breaks, and whether we want it.\n# (Is it an optimization?)\nrm -f /home/circleci/.gitconfig\n\n# This is the main setup job for the test suite\nmispipe \"tools/ci/setup-backend\" ts\n\n# Cleaning caches is mostly unnecessary in Circle, because\n# most builds don't get to write to the cache.\n# mispipe \"scripts/lib/clean_unused_caches.py --verbose --threshold 0\" ts\n", "status": "success", "timedout": null, "continue": null,