Shellcheck Buildkite pipeline

pull/540/head
Amir Zarrinkafsh 2020-01-06 01:31:33 +11:00
parent 4ca603883a
commit 8b8d0c0037
4 changed files with 14 additions and 11 deletions

View File

@ -5,9 +5,9 @@ set +u
if [[ $BUILDKITE_LABEL =~ ":selenium:" ]] || [[ $BUILDKITE_LABEL =~ ":docker: Build Image" ]];
then
CONTAINERS=$(docker ps -a -q)
if [[ $CONTAINERS != "" ]];
if [[ ${CONTAINERS} != "" ]];
then
echo "--- :docker: Clean environment"
docker rm -f $CONTAINERS
docker rm -f "${CONTAINERS}"
fi
fi

View File

@ -15,11 +15,11 @@ then
echo "--- :docker: Saving artifacts for :buildkite: :docker: :github: releases"
# Save binary for buildkite and github artifacts
docker create --name authelia-binary $DOCKER_IMAGE:latest
docker cp authelia-binary:/usr/app/authelia ./authelia-linux-$ARCH
docker cp authelia-binary:/usr/app/authelia ./authelia-linux-"${ARCH}"
docker cp authelia-binary:/usr/app/public_html ./
docker rm -f authelia-binary
tar -czf authelia-linux-$ARCH.tar.gz authelia-linux-$ARCH public_html
sha256sum authelia-linux-$ARCH.tar.gz > authelia-linux-$ARCH.tar.gz.sha256
tar -czf authelia-linux-"${ARCH}".tar.gz authelia-linux-"${ARCH}" public_html
sha256sum authelia-linux-"${ARCH}".tar.gz > authelia-linux-"${ARCH}".tar.gz.sha256
# Saving image for push to DockerHub
docker save $DOCKER_IMAGE | gzip > authelia-image-$ARCH.tar.gz
docker save $DOCKER_IMAGE | gzip > authelia-image-"${ARCH}".tar.gz
fi

View File

@ -11,8 +11,8 @@ fi
if [[ $BUILDKITE_LABEL =~ ":docker: Deploy Image" ]];
then
buildkite-agent artifact download "authelia-image-$ARCH*" .
zcat authelia-image-$ARCH.tar.gz | docker load
buildkite-agent artifact download "authelia-image-${ARCH}*" .
zcat authelia-image-"${ARCH}".tar.gz | docker load
fi
if [[ $BUILDKITE_LABEL == ":github: Deploy Artifacts" ]];

View File

@ -3,9 +3,12 @@ set -eu
artifacts=()
for FILES in authelia-linux-amd64.tar.gz authelia-linux-arm32v7.tar.gz authelia-linux-arm64v8.tar.gz authelia-linux-amd64.tar.gz.sha256 authelia-linux-arm32v7.tar.gz.sha256 authelia-linux-arm64v8.tar.gz.sha256;
for FILES in \
authelia-linux-amd64.tar.gz authelia-linux-amd64.tar.gz.sha256 \
authelia-linux-arm32v7.tar.gz authelia-linux-arm32v7.tar.gz.sha256 \
authelia-linux-arm64v8.tar.gz authelia-linux-arm64v8.tar.gz.sha256;
do
artifacts+=(-a ${FILES})
artifacts+=(-a "${FILES}")
done
hub release create ${artifacts[@]} -m $BUILDKITE_TAG $BUILDKITE_TAG
hub release create "${artifacts[@]}" -m "${BUILDKITE_TAG}" "${BUILDKITE_TAG}"