Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
django-docker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Django
django-docker
Commits
10c5a8e8
Commit
10c5a8e8
authored
4 years ago
by
Evili del Rio
Browse files
Options
Downloads
Patches
Plain Diff
Colorize output from test
Signed-off-by:
Evili del Rio
<
evili@iiia.csic.es
>
parent
3287e9f6
Branches
Branches containing commit
Tags
v1.4.0
Tags containing commit
No related merge requests found
Pipeline
#4106
passed
3 years ago
Stage: build
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ci_test.sh
+16
-9
16 additions, 9 deletions
ci_test.sh
with
16 additions
and
9 deletions
ci_test.sh
+
16
−
9
View file @
10c5a8e8
...
...
@@ -4,6 +4,13 @@
#
set
-e
#
# Highlight results with colors
#
RED
=
'\033[0;31m'
GREEN
=
'\033[0;32m'
YELLOW
=
'\033[1;33m'
NC
=
'\033[0m'
#
# Name of the Test Project
#
TEST_PROJECT
=
tinyp
...
...
@@ -11,7 +18,7 @@ virtualenv .env
source
.env/bin/activate
pip
install
--upgrade
pip
#
# Basically we fire up a test project and check that healt_urls are working.
# Basically we fire up a test project and check that healt
h
_urls are working.
#
Django_Versions
=
'3.2 2.2 1.11'
for
django_version
in
${
Django_Versions
}
...
...
@@ -23,9 +30,9 @@ do
rm
-fr
./
${
TEST_PROJECT
}
||
echo
"No project directory"
# Clean env
pip uninstall
--verbose
--yes
$(
pip freeze |
awk
-F
'='
'{print $1}'
)
||
echo
"
WARNING: Could not clean Python environment"
pip uninstall
--verbose
--yes
$(
pip freeze |
awk
-F
'='
'{print $1}'
)
||
echo
-e
"
${
YELLOW
}
WARNING: Could not clean Python environment
${
NC
}
"
pip
install
Django~
=
${
django_version
}
django-admin
.py
startproject
--verbosity
2
${
TEST_PROJECT
}
django-admin startproject
--verbosity
2
${
TEST_PROJECT
}
pip freeze
>
${
TEST_PROJECT
}
/requirements.txt
echo
"Checking urls.py"
md5sum
${
TEST_PROJECT
}
/
${
TEST_PROJECT
}
/urls.py
...
...
@@ -48,7 +55,7 @@ do
echo
-n
"Getting container IP: "
TEST_PROJECT_IP
=
$(
docker inspect
-f
'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
${
TEST_PROJECT
}
)
TEST_PROJECT_IP
=
${
TEST_PROJECT_IP
:-
localhost
}
echo
"
Container IP:
${
TEST_PROJECT_IP
}
"
echo
"
${
TEST_PROJECT_IP
}
"
echo
"Getting logs from container:"
wait_container
=
1
MAX_WAIT_CONTAINER
=
${
MAX_WAIT_CONTAINER
:-
59
}
...
...
@@ -68,14 +75,14 @@ do
set
-e
if
[[
"OK"
!=
"
${
wait_container
}
"
]]
then
echo
"
WARNING: Container is not ready. Continuing..."
echo
-e
"
${
YELLOW
}
WARNING: Container is not ready. Continuing...
${
NC
}
"
docker logs
--tail
10
${
TEST_PROJECT
}
fi
echo
"Getting test page.."
curl
--output
${
TEST_PROJECT
}
-
${
django_version
}
.html
-f
http://
${
TEST_PROJECT_IP
}
:5000/health_checks/
echo
"Stopping and removing container"
docker stop
${
TEST_PROJECT
}
||
echo
"
WARNING: Container
${
TEST_PROJECT
}
not stopped."
docker
rm
${
TEST_PROJECT
}
||
echo
"
WARNING: Container
${
TEST_PROJECT
}
not removed."
echo
"OK with
Django
${
django_version
}
.
"
docker stop
${
TEST_PROJECT
}
||
echo
-e
"
${
YELLOW
}
WARNING: Container
${
TEST_PROJECT
}
not stopped.
${
NC
}
"
docker
rm
${
TEST_PROJECT
}
||
echo
-e
"
${
YELLOW
}
WARNING: Container
${
TEST_PROJECT
}
not removed.
${
NC
}
"
echo
-e
"
${
GREEN
}
OK:
Django
${
django_version
}
successful.
${
NC
}
"
done
echo
"OK with all
Django versions
:
${
Django_Versions
}
"
echo
-e
"
${
GREEN
}
OK:
Django versions
${
Django_Versions
}
tested
${
NC
}
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment