dragon-bot/test-dragon-bot.sh
Luke Robles b75a1402d8 Blocking pushes to master
Adding pipeline.yml file

Adding pipeline.yml file

Adding pipeline.yml file

only lint for python errors

Add all necessary python modules for linting

trying with docker in docker image

trying pipelines again

Updating docker password variable

updating build step tags

Try with build and deploy as one step

Fix paramenter

Fix runner tag

Delete bitbucket-pipelines.yml
2017-08-18 09:18:49 -07:00

33 lines
1.1 KiB
Bash
Executable File

# Add the git hooks to the local repo. This prevents pushes on master
SCRIPTDIR="$(dirname "$0")"
HOOKDIR="$SCRIPTDIR/.git/hooks"
SCRIPT="$HOOKDIR/pre-push"
cat << EOF > $SCRIPT
#!/bin/bash
protected_branch='master'
# check each branch being pushed
while read local_ref local_sha remote_ref remote_sha
do
remote_branch=$(echo $remote_ref | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $remote_branch ]
then
echo "ABORT PUSH: Not allowed to push directly to $protected_branch. Use --no-verify to force."
exit 1 # push will not execute
fi
done
exit 0
EOF
chmod +x $SCRIPT
# Remove the running container so we cna re-use the container name 'dragon-bot'
printf "\n[-] Deleting old dragon-bot container from system\n"
docker rm -f dragon-bot-test
printf "[+] Done\n"
printf "\n[-] Running dragon bot in test mode\n"
docker build -f ./Dockerfile-test-env -t dragon-bot-test . || exit
# Run that shit and mount the docker socket so it can talk to the sky-factory container
docker run -ti --name dragon-bot-test -e DRAGON_ENV=test -v /var/run/docker.sock:/var/run/docker.sock dragon-bot-test sh