Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cppinttest
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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
caosdb
Software
caosdb-cppinttest
Commits
e9875330
Verified
Commit
e9875330
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: pipeline
parent
5c8f7146
No related branches found
No related tags found
No related merge requests found
Pipeline
#8324
failed
3 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.docker/Dockerfile
+7
-1
7 additions, 1 deletion
.docker/Dockerfile
.gitlab-ci.yml
+149
-12
149 additions, 12 deletions
.gitlab-ci.yml
with
156 additions
and
13 deletions
.docker/Dockerfile
+
7
−
1
View file @
e9875330
ARG
CI_REGISTRY_IMAGE
ARG
CI_REGISTRY_IMAGE
FROM
$CI_REGISTRY_IMAGE
FROM
$CI_REGISTRY_IMAGE
COPY
.docker/wait-for-it.sh /wait-for-it.sh
# build and install caosdb-cpplib
WORKDIR
/libcaosdb/
WORKDIR
/libcaosdb/
RUN
mkdir
build
RUN
mkdir
build
WORKDIR
/libcaosdb/build
WORKDIR
/libcaosdb/build
...
@@ -8,4 +11,7 @@ RUN cmake ..
...
@@ -8,4 +11,7 @@ RUN cmake ..
RUN
cmake
--build
.
RUN
cmake
--build
.
RUN
cmake
--install
.
--prefix
/usr/local/
RUN
cmake
--install
.
--prefix
/usr/local/
CMD
/bin/bash
CMD
/wait-for-it.sh caosdb-server:10443 -t 500 -- \
# ... and run tests
ctest
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
+
149
−
12
View file @
e9875330
...
@@ -20,17 +20,51 @@
...
@@ -20,17 +20,51 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# along with this program. If not, see <https://www.gnu.org/licenses/>.
variables
:
variables
:
CI_REGISTRY_IMAGE_CPPLIB
:
$CI_REGISTRY/caosdb/src/caosdb-cpplib/testenv:latest
# this is the image where cpplib repo is present (artifact from pipeline in
CI_REGISTRY_IMAGE
:
$CI_REGISTRY/caosdb/src/caosdb-cppinttest/testenv:latest
# caosdb-cpplib)
CI_REGISTRY_IMAGE_CPPLIB
:
$CI_REGISTRY/caosdb/src/caosdb-cpplib/testenv:$CPP
# this is the image where all the docker containers (server, mysql and test
# suite) are started
CI_REGISTRY_IMAGE_BASE
:
$CI_REGISTRY/caosdb/src/caosdb-pyinttest/base:latest
CPPINTTEST_TESTENV_IMAGE_SUFFIX
:
$CI_COMMIT_REF_NAME
CPPINTTEST_REPO_PATH
:
caosdb/src/caosdb-cppinttest
CPPINTTEST_TESTENV_IMAGE_TAG
:
${CPPINTTEST_REPO_PATH}/testenv:${CPPINTTEST_IMAGE_SUFFIX}
# this is the image where the cpplib is installed and where the testsuite runs
CPPINTTEST_REGISTRY_IMAGE
:
${CI_REGISTRY}/${CPPINTTEST_IMAGE_TAG}
# this is the name of the image in the /image-cache/ directory
CPPINTTEST_IMAGE_CACHE
:
${CPPINTTEST_IMAGE_TAG}.tar
## FOR DEBUGGING
TRIGGERED_BY_REPO
:
CPPINTTEST
TRIGGERED_BY_REPO
:
CPPINTTEST
TRIGGERED_BY_REF
:
$CI_COMMIT_REF_NAME
TRIGGERED_BY_REF
:
$CI_COMMIT_REF_NAME
TRIGGERED_BY_HASH
:
$CI_COMMIT_SHORT_SHA
TRIGGERED_BY_HASH
:
$CI_COMMIT_SHORT_SHA
## Run tests against this cpplib version
CPPLIB_VERSION
:
0.0.1
CPPLIB_VERSION
:
0.0.1
# This is the caosdb-deploy branch which build the images for caosdb-server and caosdb-mysql
# TODO change to dev after merge of f-grpc to dev
DEPLOY_REF
:
f-grpc
stages
:
stages
:
-
info
-
setup
-
setup
-
build
-
test
-
test
info
:
tags
:
[
cached-dind
]
image
:
docker:20.10
stage
:
setup_tests
timeout
:
1 minutes
needs
:
[]
script
:
-
echo "Pipeline triggered by $TRIGGERED_BY_REPO@$TRIGGERED_BY_REF ($TRIGGERED_BY_HASH)"
# Build a docker image in which tests for this repository can run
# Build a docker image in which tests for this repository can run
build-testenv
:
build-testenv
:
tags
:
[
cached-dind
]
tags
:
[
cached-dind
]
...
@@ -39,28 +73,131 @@ build-testenv:
...
@@ -39,28 +73,131 @@ build-testenv:
timeout
:
2h
timeout
:
2h
needs
:
[]
needs
:
[]
script
:
script
:
-
echo "Pipeline triggered by $TRIGGERED_BY_REPO@$TRIGGERED_BY_REF ($TRIGGERED_BY_HASH)"
-
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
-
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
-
docker pull $CI_REGISTRY_IMAGE_CPPLIB||
true
## Determine the cppinttest branch...
# ... use an f-branch if posible...
-
if echo "$CI_COMMIT_REF_NAME" | grep -c "^f-" ; then
# this is an f-branch
CPPINT_REF=$CI_COMMIT_REF_NAME ;
fi;
# ... or use main if possible...
-
if [[ "$CI_COMMIT_REF_NAME" == "main" ]] ; then
CPPINT_REF=main ;
fi
# ... and fall-back to dev
-
CPPINT_REF=${CPPINT_REF:-dev}
#build testenv image
-
docker pull $CI_REGISTRY_IMAGE_CPPLIB ||
true
# remove??? docker build --pull???
-
docker build
-
docker build
--build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE_CPPLIB
--build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE_CPPLIB
--file .docker/Dockerfile
--file .docker/Dockerfile
--pull
--pull
--cache-from $CI_REGISTRY_IMAGE
--cache-from $CPPINTTEST_REGISTRY_IMAGE
--tag $CI_REGISTRY_IMAGE .
--tag $CPPINTTEST_REGISTRY_IMAGE .
-
docker push $CI_REGISTRY_IMAGE
-
docker push $CPPINTTEST_REGISTRY_IMAGE
-
docker save $CPPINTTEST_REGISTRY_IMAGE > /image-cache/${CPPINTTEST_IMAGE_CACHE}
#
run
integration tests
#
build
integration tests
test
:
build-
test
:
image
:
$C
I
_REGISTRY_IMAGE
image
:
$C
PPINTTEST
_REGISTRY_IMAGE
dependencies
:
dependencies
:
-
build-testenv
-
build-testenv
tags
:
[
docker
]
tags
:
[
docker
]
stage
:
test
stage
:
build
script
:
script
:
-
mkdir build
-
mkdir build
-
cd build
-
cd build
-
cmake -D CMAKE_PREFIX_PATH=/usr/local/lib/libcaosdb-${CPPLIB_VERSION} ..
-
cmake -D CMAKE_PREFIX_PATH=/usr/local/lib/libcaosdb-${CPPLIB_VERSION} ..
-
cmake --build .
-
cmake --build .
-
ctest
artifacts
:
path
:
-
build/
expire_in
:
1 week
test
:
tags
:
[
docker
]
services
:
-
docker:20.10.3-dind
variables
:
# This is a workaround for the gitlab-runner health check mechanism when
# using docker-dind service. The runner will otherwise guess the port
# wrong and the health check will timeout.
SERVICE_PORT_2376_TCP_PORT
:
2375
stage
:
test
image
:
$CI_REGISTRY_IMAGE_BASE
needs
:
-
job
:
build-test
artifacts
:
true
script
:
-
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
-
if [[ "$CAOSDB_TAG" == "" ]]; then
# the CAOSDB_TAG has to be guessed...
if echo "$F_BRANCH" | grep -c "^f-" ; then
CAOSDB_TAG=${DEPLOY_REF}_F_${F_BRANCH}-latest;
echo "Load deploy images with tag
:
$CAOSDB_TAG ..."
if ! docker pull $CI_REGISTRY/caosdb/src/caosdb-deploy:$CAOSDB_TAG ; then
echo "Load deploy images with tag
:
$CAOSDB_TAG ... error. Try another:" ;
CAOSDB_TAG=${DEPLOY_REF}-latest ;
echo "Load deploy images with tag
:
$CAOSDB_TAG ..."
docker pull $CI_REGISTRY/caosdb/src/caosdb-deploy:$CAOSDB_TAG ;
echo "Load deploy images with tag
:
$CAOSDB_TAG ... success"
fi
else
# no F_BRANCH -> use default DEPLOY_REF branch
CAOSDB_TAG=${DEPLOY_REF}-latest ;
echo "Load deploy images with tag
:
$CAOSDB_TAG ..."
docker pull $CI_REGISTRY/caosdb/src/caosdb-deploy:$CAOSDB_TAG ;
echo "Load deploy images with tag
:
$CAOSDB_TAG ... success"
fi;
else
# If the CAOSDB_TAG was given
echo "Load deploy images with tag
:
$CAOSDB_TAG ..."
docker pull $CI_REGISTRY/caosdb/src/caosdb-deploy:$CAOSDB_TAG ;
echo "Load deploy images with tag
:
$CAOSDB_TAG ... success"
fi
-
docker load < /image-cache/${CPPINTTEST_IMAGE_CACHE} ||
true
-
docker pull $CPPINTTEST_REGISTRY_IMAGE
# load any(!!!) mariab image
-
docker load < /image-cache/mariadb.tar ||
true
-
cd .docker
# here the server and the mysql backend docker are being started
-
CAOSDB_TAG=$CAOSDB_TAG docker-compose up -d
# the pyinttest docker writes the return value of the tests into the
# file result
-
/bin/sh ./run.sh
# collect log files
-
cd ..
-
docker logs docker_caosdb-server_1 &> ../caosdb_log.txt
-
docker logs docker_sqldb_1 &> ../mariadb_log.txt
# shut down
-
docker-compose -f .docker/docker-compose.yml down
# collect results
-
rc=`cat .docker/result`
# renew mariadb image in the cache (why? to renew the timestamp???)
-
echo mariadb:$(docker image ls mariadb | grep mariadb | awk '{print $2}')
-
docker save mariadb:$(docker image ls mariadb | grep mariadb | awk '{print $2}') > /image-cache/mariadb.tar ||
true
# exit with fail when errors exist
-
exit $rc
dependencies
:
[
cert
]
timeout
:
3h
artifacts
:
paths
:
-
caosdb_log.txt
-
mariadb_log.txt
-
.docker/hash_*
expire_in
:
1 week
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