2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 The Linux Foundation and others
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 ##############################################################################
18 PATH=$PATH:/usr/local/bin/
20 #These are the only projects that generate artifacts
21 for x in armband ovsnfv fuel apex compass4nfv
24 echo "Looking at artifacts for project $x"
25 echo "In path gs://artifacts.opnfv.org/$x"
27 while IFS= read -r artifact; do
29 artifact_date="$(gsutil ls -L $artifact | grep "Creation time:" | awk '{print $4,$5,$6}')"
30 age=$(($(date +%s)-$(date -d"$artifact_date" +%s)))
31 daysold=$(($age/86400))
33 if [[ "$daysold" -gt "10" ]]; then
34 echo "$daysold Days old deleting: $(basename $artifact)"
37 echo "$daysold Days old retaining: $(basename $artifact)"
40 done < <(gsutil ls gs://artifacts.opnfv.org/"$x" |grep -v "/$")