diff --git a/concourse/scripts/remove_non_production_files.bats b/concourse/scripts/remove_non_production_files.bats deleted file mode 100755 index 439919ee187f86383fc4c94892ccf8698cf5fd9d..0000000000000000000000000000000000000000 --- a/concourse/scripts/remove_non_production_files.bats +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env bats - -setup() { - mkdir test_dir - cd test_dir - - export OUTPUT_TARBALL="out.tar.gz" - - touch a b c - - tar --create --gzip --file a.tar.gz ./a - tar czf ab.tar.gz ./{a,b} - tar czf abc.tar.gz ./{a,b,c} - - echo -e "" > empty-NON_PRODUCTION_FILES.txt - echo -e "a" > a-NON_PRODUCTION_FILES.txt - echo -e "a\nb" > ab-NON_PRODUCTION_FILES.txt - echo -e "a\nb\nc" > abc-NON_PRODUCTION_FILES.txt -} - -teardown() { - cd .. - rm -rf test_dir -} - -comm_tarballs() { - comm -3 <(tar -tf "$1") <(tar -tf "$2") | tr -d '[:space:]' -} - -@test "test comm_tarballs with same file" { - run comm_tarballs a.tar.gz a.tar.gz - [ "$output" = "" ] -} - -@test "test comm_tarballs with different file" { - run comm_tarballs a.tar.gz ab.tar.gz - [ "$output" = "./b" ] -} - -main() { - ../scripts/remove_non_production_files.sh -} - -@test "it fails if any variables are unbound" { - run main - [ "$status" -ne 0 ] -} - -@test "it prints out the removed files" { - export INPUT_TARBALL="abc.tar.gz" - export NON_PRODUCTION_FILES="ab-NON_PRODUCTION_FILES.txt" - - run main - [ "$status" -eq 0 ] - [[ "$output" =~ "rm".*$'\n'.*"a".*$'\n'.*b ]] -} - -@test "it does nothing when there are no files to remove" { - export INPUT_TARBALL="a.tar.gz" - export NON_PRODUCTION_FILES="empty-NON_PRODUCTION_FILES.txt" - - run main - [ "$status" -eq 0 ] - - run comm_tarballs "${INPUT_TARBALL}" "${OUTPUT_TARBALL}" - [ -z "$output" ] -} - -@test "it works when we remove a from ab" { - export INPUT_TARBALL="ab.tar.gz" - export NON_PRODUCTION_FILES="a-NON_PRODUCTION_FILES.txt" - - run main - [ "$status" -eq 0 ] - - run comm_tarballs "${INPUT_TARBALL}" "${OUTPUT_TARBALL}" - [ "$output" = "./a" ] -} - -@test "it works when we remove ab from abc" { - export INPUT_TARBALL="abc.tar.gz" - export NON_PRODUCTION_FILES="ab-NON_PRODUCTION_FILES.txt" - - run main - [ "$status" -eq 0 ] - - run comm_tarballs "${INPUT_TARBALL}" "${OUTPUT_TARBALL}" - [ "$output" = "./a./b" ] -} - -@test "it works when we remove abc from abc" { - export INPUT_TARBALL="abc.tar.gz" - export NON_PRODUCTION_FILES="abc-NON_PRODUCTION_FILES.txt" - - run main - [ "$status" -ne 0 ] - - grep "All files were removed so ${OUTPUT_TARBALL} cannot be created" <(echo "$output") - [ "$?" -eq 0 ] -} - -@test "it fails when we remove ab from a" { - export INPUT_TARBALL="a.tar.gz" - export NON_PRODUCTION_FILES="ab-NON_PRODUCTION_FILES.txt" - - run main - [ "$status" -ne 0 ] - # rm: cannot remove `b': No such file or directory - [[ "$output" =~ "rm".*"b".*"No such file or directory" ]] -} diff --git a/concourse/scripts/remove_non_production_files.sh b/concourse/scripts/remove_non_production_files.sh deleted file mode 100755 index 0257e24071f749a847e5dbb5f1beed8686ba6ba7..0000000000000000000000000000000000000000 --- a/concourse/scripts/remove_non_production_files.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -euxo pipefail - -main() { - local tmp_dir="$(mktemp -d)" - local wd=$(pwd) - - tar zxf "${INPUT_TARBALL}" -C "${tmp_dir}" - - cd "${tmp_dir}" - xargs rm -v < "${wd}/${NON_PRODUCTION_FILES}" || true - if ! tar czf "${wd}/${OUTPUT_TARBALL}" ./* ; then - echo "All files were removed so ${OUTPUT_TARBALL} cannot be created" - exit 1 - fi -} - -main "$@" diff --git a/concourse/tasks/remove_non_production_files.yml b/concourse/tasks/remove_non_production_files.yml deleted file mode 100644 index 59ef46303ea631d59c02d6aae89fa97637561804..0000000000000000000000000000000000000000 --- a/concourse/tasks/remove_non_production_files.yml +++ /dev/null @@ -1,14 +0,0 @@ -platform: linux -image_resource: - type: docker-image -inputs: - - name: gpdb_src - - name: bin_gpdb -outputs: - - name: rc_bin_gpdb -run: - path: gpdb_src/concourse/scripts/remove_non_production_files.sh -params: - NON_PRODUCTION_FILES: gpdb_src/gpAux/releng/NON_PRODUCTION_FILES.txt - INPUT_TARBALL: bin_gpdb/bin_gpdb.tar.gz - OUTPUT_TARBALL: rc_bin_gpdb/bin_gpdb.tar.gz diff --git a/gpAux/releng/NON_PRODUCTION_FILES.txt b/gpAux/releng/NON_PRODUCTION_FILES.txt deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000