Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csentry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ICS Control System Infrastructure
csentry
Commits
eb66aa91
Commit
eb66aa91
authored
7 years ago
by
Benjamin Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Add Jenkinsfile and Makefile to build the image
parent
dc12809b
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Jenkinsfile
+54
-0
54 additions, 0 deletions
Jenkinsfile
Makefile
+42
-6
42 additions, 6 deletions
Makefile
README.rst
+5
-1
5 additions, 1 deletion
README.rst
docker-compose-test.yml
+1
-3
1 addition, 3 deletions
docker-compose-test.yml
docker-compose.yml
+1
-1
1 addition, 1 deletion
docker-compose.yml
with
103 additions
and
11 deletions
Jenkinsfile
0 → 100644
+
54
−
0
View file @
eb66aa91
pipeline
{
agent
{
label
'docker'
}
stages
{
stage
(
'Refresh'
)
{
steps
{
slackSend
(
color:
'good'
,
message:
"STARTED: <${env.BUILD_URL}|${env.JOB_NAME} [${env.BUILD_NUMBER}]>"
)
sh
'git fetch --tags'
sh
'make clean'
sh
'make refresh'
}
}
stage
(
'Build'
)
{
steps
{
ansiColor
(
'xterm'
)
{
sh
'make build'
}
}
}
stage
(
'Test'
)
{
steps
{
sh
'make db_test'
/* let the time to postgres to start */
sh
'sleep 5'
sh
'make test'
}
}
stage
(
'Push'
)
{
steps
{
sh
'make tag'
sh
'make push'
}
}
stage
(
'Clean'
)
{
steps
{
sh
'make clean'
}
}
}
post
{
always
{
/* clean up the workspace */
deleteDir
()
}
failure
{
slackSend
(
color:
'danger'
,
message:
"FAILED: <${env.BUILD_URL}|${env.JOB_NAME} [${env.BUILD_NUMBER}]>"
)
}
success
{
slackSend
(
color:
'good'
,
message:
"SUCCESSFUL: <${env.BUILD_URL}|${env.JOB_NAME} [${env.BUILD_NUMBER}]>"
)
}
}
}
This diff is collapsed.
Click to expand it.
Makefile
+
42
−
6
View file @
eb66aa91
.PHONY
:
help db_test test
.PHONY
:
help build tag push refresh release db_dev initdb db_test test
OWNER
:=
europeanspallationsource
GIT_TAG
:=
$(
shell git describe
--always
)
IMAGE
:=
ics-inventory
help
:
@
echo
"Please use
\`
make <target>' where <target> is one of"
@
echo
" db_test to start the postgres database for test"
@
echo
" test to run the tests"
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
@echo
"ics-inventory"
@echo
"============="
@echo
@grep -E '^[a-zA-Z0-9_%/-]+
:
.*?
##
.*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?
##
"}; {printf "
\0
33[36m%-30s
\0
33[0m %s
\n
"
,
$$1
,
$$2}'
build
:
##
build the latest image
docker build
-t
$(
OWNER
)
/
$(
IMAGE
)
:latest .
tag
:
##
tag the latest image with the git tag
docker tag
$(
OWNER
)
/
$(
IMAGE
)
:latest
$(
OWNER
)
/
$(
IMAGE
)
:
$(
GIT_TAG
)
push
:
##
push the latest and git tag image
docker push
$(
OWNER
)
/
$(
IMAGE
)
:
$(
GIT_TAG
)
docker push
$(
OWNER
)
/
$(
IMAGE
)
:latest
clean
:
##
remove the image with git tag and the test database
-
docker rmi
$(
OWNER
)
/
$(
IMAGE
)
:
$(
GIT_TAG
)
-
docker
rm
-f
inventory_postgres_test
refresh
:
##
pull the latest image from Docker Hub
# skip if error: image might not be on dockerhub yet
-docker pull $(OWNER)/$(IMAGE)
:
latest
release
:
refresh
\
build
\
tag
\
push
release
:
##
build
,
tag
,
and push all stacks
db_dev
:
##
start postgres for development
docker-compose up
-d
postgres
initdb
:
##
initialize the dev database
docker-compose run
--rm
web flask initdb
db_test
:
db_test
:
##
start postgres for test
docker-compose
-f
docker-compose-test.yml up
-d
postgres_test
test
:
test
:
##
run the tests
docker-compose
-f
docker-compose-test.yml run
--rm
web_test
This diff is collapsed.
Click to expand it.
README.rst
+
5
−
1
View file @
eb66aa91
...
...
@@ -16,8 +16,12 @@ You can use docker for development:
# Start only postgres so it has time to initialize
$ docker-compose up -d postgres
or
$ make db_dev
# Create the database
$ docker-compose run web flask initdb
$ docker-compose run --rm web flask initdb
or
$ make initdb
3. Start the application::
...
...
This diff is collapsed.
Click to expand it.
docker-compose-test.yml
+
1
−
3
View file @
eb66aa91
version
:
'
2'
services
:
web_test
:
image
:
inventory
image
:
europeanspallationsource/ics-
inventory
:latest
container_name
:
inventory_web_test
build
:
.
command
:
pytest --cov=app -v
...
...
@@ -14,8 +14,6 @@ services:
container_name
:
inventory_postgres_test
expose
:
-
"
5432"
volumes
:
-
./data/test:/var/lib/postgresql/data/pgdata
environment
:
POSTGRES_USER
:
ics
POSTGRES_PASSWORD
:
icstest
...
...
This diff is collapsed.
Click to expand it.
docker-compose.yml
+
1
−
1
View file @
eb66aa91
version
:
'
2'
services
:
web
:
image
:
inventory
image
:
europeanspallationsource/ics-
inventory
:latest
container_name
:
inventory_web
build
:
.
environment
:
...
...
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