Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Fixed the permissions issue for CI build #19

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build-rails.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -e

# Basic parameters
CI_SETUP=$1 # Set to "Y" for continuous integration setups
BASE_APP_URL='' # Will be updated later if necessary
HOST_ENV=`cat tmp/host_env.txt`
ANNOTATE=`cat tmp/annotate.txt`
Expand All @@ -27,6 +28,13 @@ else
bash credentials.sh
fi

if [ "$CI_SETUP" = 'Y' ] && [ "$HOST_ENV" = 'Y' ]
then
# Ownership of everything in /home/winner directory
# The Docker environment is different in the CI setup
sudo chown -R winner:winner /home/winner
fi

# Display parameters
DIR_MAIN=$PWD
APP_NAME=`cat $DIR_MAIN/tmp/app_name.txt`
Expand Down
34 changes: 27 additions & 7 deletions start-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,32 @@ echo 'END: docker-compose build'
echo '+++++++++++++++++++++++++'

APP_NAME=`cat tmp/app_name.txt`
echo '#################################################'
echo 'BEGIN: docker-compose run web bash build-rails.sh'
echo '#################################################'
docker-compose run web bash build-rails.sh
echo '###############################################'
echo 'END: docker-compose run web bash build-rails.sh'
echo '###############################################'
if [ "$CI" = 'true' ]
then
echo '#####################################################'
echo "BEGIN: docker-compose run web bash build-rails.sh 'Y'"
echo '#####################################################'
docker-compose run web bash build-rails.sh 'Y'
echo '###################################################'
echo "END: docker-compose run web bash build-rails.sh 'Y'"
echo '###################################################'
else
echo '#################################################'
echo 'BEGIN: docker-compose run web bash build-rails.sh'
echo '#################################################'
docker-compose run web bash build-rails.sh
echo '###############################################'
echo 'END: docker-compose run web bash build-rails.sh'
echo '###############################################'
fi

if [ "$CIRCLECI" = 'true' ]
then
# Change ownership of everything in $APP_NAME directory to circleci
# Necessary to prevent permission errors
sudo chown -R circleci:circleci $APP_NAME
fi

echo '#######'
echo 'NEW APP'
echo 'BEGIN: docker/build'
Expand All @@ -42,6 +61,7 @@ echo 'NEW APP'
echo 'END: docker/build'
echo '#################'


echo '**********************************'
echo 'Your new Rails app has been built!'
echo 'Path:'
Expand Down