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