From cd449cb89b58430bef9c170426e5ab2a4aa259c3 Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Wed, 2 Sep 2020 18:46:17 +0200 Subject: [PATCH] update(.circleci): cleanup/packages-dev job Signed-off-by: Leonardo Di Donato --- .circleci/cleanup | 5 ++++- .circleci/config.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.circleci/cleanup b/.circleci/cleanup index 665508b1..92ba4f1e 100755 --- a/.circleci/cleanup +++ b/.circleci/cleanup @@ -16,6 +16,9 @@ get_versions() { IFS=$'\n' read -r -d '' -a all < <(curl -s --header "Content-Type: application/json" "https://api.bintray.com/packages/falcosecurity/$1/falco" | jq -r '.versions | .[]' | tail -n "+$2") } +# Remove all the versions (${all[@]} array). +# +# $1: repository containing the versions. rem_versions() { for i in "${!all[@]}"; do @@ -54,5 +57,5 @@ if [[ "${repo}" == "bin-dev" ]]; then fi get_versions "${repo}" ${skip} -echo "# versions: ${#all[@]}" +echo "number of versions to delete: ${#all[@]}" rem_versions "${repo}" \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index edf7cad1..d6ebe5b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -271,6 +271,28 @@ jobs: command: | FALCO_VERSION=$(cat /build/release/userspace/falco/config_falco.h | grep 'FALCO_VERSION ' | cut -d' ' -f3 | sed -e 's/^"//' -e 's/"$//') jfrog bt u /build/release/falco-${FALCO_VERSION}-x86_64.tar.gz falcosecurity/bin-dev/falco/${FALCO_VERSION} x86_64/ --user poiana --key ${BINTRAY_SECRET} --publish --override + # Clenup the Falco development release packages + "cleanup/packages-dev": + docker: + - image: docker.bintray.io/jfrog/jfrog-cli-go:latest + steps: + - run: + name: Prepare env + command: | + apk add --no-cache --update + apk add curl jq + - run: + name: Only keep the 10 most recet Falco development release tarballs + command: | + .circleci/cleanup -p ${BINTRAY_SECRET} -r bin-dev + - run: + name: Only keep the 50 most recent Falco development release RPMs + command: | + .circleci/cleanup -p ${BINTRAY_SECRET} -r rpm-dev + - run: + name: Only keep the 50 most recent Falco development release DEBs + command: | + .circleci/cleanup -p ${BINTRAY_SECRET} -r deb-dev # Publish docker packages "publish/docker-dev": docker: @@ -402,6 +424,15 @@ workflows: only: master requires: - "rpm/sign" + - "cleanup/packages-dev": + context: falco + filters: + tags: + ignore: /.*/ + branches: + only: master + requires: + - "publish/packages-dev" - "publish/docker-dev": context: falco filters: