Skip to content

Commit

Permalink
Merge pull request #191 from SUNET/bugfix.docker_pr185_fixes
Browse files Browse the repository at this point in the history
Bugfix.docker pr185 fixes
  • Loading branch information
indy-independence authored Aug 26, 2021
2 parents 135b783 + 213f16e commit 1d9eef1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docker/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ RUN apt-get update \
python3-yaml \
supervisor \
uwsgi-plugin-python3 \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache-dir uwsgi

# Prepare for supervisord, ngninx
Expand Down Expand Up @@ -71,6 +70,8 @@ ARG GITREPO_BASE=https://github.com/SUNET/cnaas-nms.git
ADD "https://api.github.com/repos/SUNET/cnaas-nms/git/refs/heads/" latest_commit
# Cnaas setup script
RUN /opt/cnaas/cnaas-setup.sh ${GITREPO_BASE} ${BUILDBRANCH}
# Freeze source
RUN -R chown root:www-data /opt/cnaas/venv/cnaas-nms/ && chmod -R u=rwX,g=rX,o= /opt/cnaas/venv/cnaas-nms/

# Prepare for uwsgi
COPY --chown=root:www-data config/uwsgi.ini /opt/cnaas/venv/cnaas-nms/
Expand Down
3 changes: 2 additions & 1 deletion docker/api/cnaas-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ source bin/activate
git clone $1 cnaas-nms
cd cnaas-nms/
# switch to $BUILDBRANCH
git checkout $2
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
git fetch --all
git checkout $2
# install dependencies
python3 -m pip install --no-cache-dir -r requirements.txt
9 changes: 7 additions & 2 deletions test/integrationtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ docker volume create cnaas-cacert
docker-compose up -d

docker cp ./jwt-cert/public.pem docker_cnaas_api_1:/opt/cnaas/jwtcert/public.pem
docker-compose exec -T cnaas_api /bin/chown -R www-data:www-data /opt/cnaas/jwtcert/
docker-compose exec -u root -T cnaas_api /bin/chown -R www-data:www-data /opt/cnaas/jwtcert/
docker-compose exec -u root -T cnaas_api /opt/cnaas/createca.sh

if [ ! -z "$PRE_TEST_SCRIPT" ]
Expand Down Expand Up @@ -80,7 +80,9 @@ sleep 120
echo "Gathering coverage reports from integration tests:"
MULE_PID="`docker logs docker_cnaas_api_1 | awk '/spawned uWSGI mule/{print $6}' | egrep -o "[0-9]+" | tail -n1`"
echo "Found mule at pid $MULE_PID"
docker exec docker_cnaas_api_1 kill $MULE_PID
# Allow for code coverage files to be saved
docker-compose exec -u root -T cnaas_api chown -R www-data:www-data /opt/cnaas/venv/cnaas-nms/src/
docker-compose exec -u root -T cnaas_api kill $MULE_PID
curl -ks -H "Authorization: Bearer $JWT_AUTH_TOKEN" "https://localhost/api/v1.0/system/shutdown" -d "{}" -X POST -H "Content-Type: application/json"
sleep 3

Expand Down Expand Up @@ -115,4 +117,7 @@ else
cd ../
fi

# Change owner back after code coverage is finished
docker-compose exec -u root -T cnaas_api chown -R root:www-data /opt/cnaas/venv/cnaas-nms/src/

docker-compose down

0 comments on commit 1d9eef1

Please sign in to comment.