Skip to content
Snippets Groups Projects
Commit 7e165bce authored by Erick Hitter's avatar Erick Hitter
Browse files

Better reporting from script

parent fb015f7e
Branches
No related tags found
1 merge request!1MVP
Pipeline #1831 failed
......@@ -17,9 +17,7 @@ lint:dockerfile:
- mkdir ~/.config
- cp ./.hadolint.yaml ~/.config/hadolint.yaml
script:
- |
set -eo pipefail
find . -name "Dockerfile" -execdir hadolint {} \;
- hadolint ./context/Dockerfile
lint:shell-script:
stage: test
......@@ -27,9 +25,7 @@ lint:shell-script:
before_script:
- shellcheck -V
script:
- |
set -eo pipefail
find . -name "*.sh" -exec shellcheck {} \;
- shellcheck ./context/s3-purge.sh
#
# IMAGE BUILDS/PUSHES
......
......@@ -17,7 +17,9 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN touch /var/log/s3-purge
COPY s3-purge.sh /usr/local/bin/s3-purge
COPY crontab /etc/cron.d/s3-purge
CMD ["tail", "-f", "/dev/null"]
CMD ["tail", "-f", "/var/log/s3-purge"]
......@@ -6,11 +6,14 @@ export BUCKET_NAME
EXPIRE_AGE_DAYS=$(cat /s3_expire_days)
export EXPIRE_AGE_DAYS
echo '==='
date
s3cmd --config=/s3_config ls s3://"${BUCKET_NAME}" | while read -r line;
do
createDate=$(echo "$line"|awk '{print $1" "$2}')
createDate=$(date -d"$createDate" +%s)
olderThan=$(date -d"-$EXPIRE_AGE_DAYS" +%s)
olderThan=$(date -d"-$EXPIRE_AGE_DAYS days" +%s)
if [[ $createDate -lt $olderThan ]]
then
fileName=$(echo "$line"|awk '{print $4}')
......@@ -21,3 +24,5 @@ s3cmd --config=/s3_config ls s3://"${BUCKET_NAME}" | while read -r line;
fi
fi
done;
echo '---'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment