diff options
author | eitsupi <50911393+eitsupi@users.noreply.github.com> | 2022-10-11 01:33:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 01:33:01 +0300 |
commit | a8cb375d460840bbf8c91599d16fc87d9ee8b996 (patch) | |
tree | 73dd647775325582c17a452816457f5cec82004d /src/terraform | |
parent | 065b5ec9e19d4f289a070c3d5337696fd2394dc0 (diff) |
Ensure remove apt-update cache at the beginning and end of the scripts (#210)
* remove apt lists
* bump versions
Diffstat (limited to 'src/terraform')
-rw-r--r-- | src/terraform/devcontainer-feature.json | 2 | ||||
-rwxr-xr-x | src/terraform/install.sh | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/terraform/devcontainer-feature.json b/src/terraform/devcontainer-feature.json index 4ace245..cafa3db 100644 --- a/src/terraform/devcontainer-feature.json +++ b/src/terraform/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "terraform", - "version": "1.0.5", + "version": "1.0.6", "name": "Terraform, tflint, and TFGrunt", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/terraform", "description": "Installs the Terraform CLI and optionally TFLint and Terragrunt. Auto-detects latest version and installs needed dependencies.", diff --git a/src/terraform/install.sh b/src/terraform/install.sh index 358b8b2..fc523b8 100755 --- a/src/terraform/install.sh +++ b/src/terraform/install.sh @@ -9,6 +9,9 @@ set -e +# Clean up +rm -rf /var/lib/apt/lists/* + TERRAFORM_VERSION="${VERSION:-"latest"}" TFLINT_VERSION="${TFLINT:-"latest"}" TERRAGRUNT_VERSION="${TERRAGRUNT:-"latest"}" @@ -124,8 +127,10 @@ find_version_from_git_tags() { apt_get_update() { - echo "Running apt-get update..." - apt-get update -y + if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then + echo "Running apt-get update..." + apt-get update -y + fi } # Checks if packages are installed and installs them if not @@ -142,8 +147,7 @@ export DEBIAN_FRONTEND=noninteractive # Install dependencies if missing check_packages curl ca-certificates gnupg2 dirmngr coreutils unzip if ! type git > /dev/null 2>&1; then - apt_get_update - apt-get -y install --no-install-recommends git + check_packages git fi # Verify requested version is available, convert latest @@ -209,4 +213,8 @@ if [ "${TERRAGRUNT_VERSION}" != "none" ]; then fi rm -rf /tmp/tf-downloads ${GNUPGHOME} + +# Clean up +rm -rf /var/lib/apt/lists/* + echo "Done!" |