Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
query-service
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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
Microservices
query-service
Commits
fdf8958c
Commit
fdf8958c
authored
4 years ago
by
thijsheijden
Browse files
Options
Downloads
Patches
Plain Diff
Re-enabled test stage of CI/CD
parent
2eb5ce13
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+74
-74
74 additions, 74 deletions
.gitlab-ci.yml
with
74 additions
and
74 deletions
.gitlab-ci.yml
+
74
−
74
View file @
fdf8958c
image
:
golang:1.16
stages
:
#
- test
-
test
-
build
-
docker
-
integration
#
- integration
-
deploy
#
lint:
#
stage: test
#
script:
#
- make lint
lint
:
stage
:
test
script
:
-
make lint
#
unit_tests:
#
stage: test
#
script:
#
- make dep
#
- make test
#
- gocover-cobertura < coverage.txt > coverage.xml
#
artifacts:
#
reports:
#
cobertura: coverage.xml
unit_tests
:
stage
:
test
script
:
-
make dep
-
make test
-
gocover-cobertura < coverage.txt > coverage.xml
artifacts
:
reports
:
cobertura
:
coverage.xml
#
race:
#
stage: test
#
script:
#
- make race
race
:
stage
:
test
script
:
-
make race
#
coverage:
#
stage: test
#
script:
#
- make coverage
#
after_script:
#
- mkdir $CI_COMMIT_BRANCH
#
- cp cover.html $CI_COMMIT_BRANCH
#
- mv $CI_COMMIT_BRANCH/cover.html $CI_COMMIT_BRANCH/index.html
coverage
:
stage
:
test
script
:
-
make coverage
after_script
:
-
mkdir $CI_COMMIT_BRANCH
-
cp cover.html $CI_COMMIT_BRANCH
-
mv $CI_COMMIT_BRANCH/cover.html $CI_COMMIT_BRANCH/index.html
#
- if [[ $CI_COMMIT_BRANCH = "develop" || $CI_COMMIT_BRANCH = "main" ]]; then COVERAGE_PATH=""; else COVERAGE_PATH="features"; fi
-
if [[ $CI_COMMIT_BRANCH = "develop" || $CI_COMMIT_BRANCH = "main" ]]; then COVERAGE_PATH=""; else COVERAGE_PATH="features"; fi
#
# install openssh client and add ssh keys
#
- apt-get install openssh-client curl -y >/dev/null
#
- mkdir ~/.ssh/
#
- eval $(ssh-agent -s)
#
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
#
- chmod 600 ~/.ssh/id_rsa
#
- ssh-add ~/.ssh/id_rsa
#
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
#
- chmod 644 ~/.ssh/known_hosts
#
- ssh -fN -L 1234:science-vs260.science.uu.nl:22 sivan@up.science.uu.nl
#
- scp -r -o StrictHostKeyChecking=no -P 1234 -i ~/.ssh/id_rsa $CI_COMMIT_BRANCH root@localhost:/datadisk/documentation-coverage/home/backend/$CI_PROJECT_NAME/$COVERAGE_PATH
#
artifacts:
#
untracked: false
#
expire_in: 30 days
#
paths:
#
- cover.html
# install openssh client and add ssh keys
-
apt-get install openssh-client curl -y >/dev/null
-
mkdir ~/.ssh/
-
eval $(ssh-agent -s)
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
-
chmod 600 ~/.ssh/id_rsa
-
ssh-add ~/.ssh/id_rsa
-
echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
-
ssh -fN -L 1234:science-vs260.science.uu.nl:22 sivan@up.science.uu.nl
-
scp -r -o StrictHostKeyChecking=no -P 1234 -i ~/.ssh/id_rsa $CI_COMMIT_BRANCH root@localhost:/datadisk/documentation-coverage/home/backend/$CI_PROJECT_NAME/$COVERAGE_PATH
artifacts
:
untracked
:
false
expire_in
:
30 days
paths
:
-
cover.html
build
:
stage
:
build
...
...
@@ -84,36 +84,36 @@ docker:
dependencies
:
-
build
integration-tests
:
image
:
golang:1.16
stage
:
integration
only
:
-
develop
script
:
-
apt-get install openssh-client curl -y >/dev/null
-
mkdir ~/.ssh/
-
eval $(ssh-agent -s)
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
-
chmod 600 ~/.ssh/id_rsa
-
ssh-add ~/.ssh/id_rsa
-
echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
-
ssh -fN -L 1234:science-vs260.science.uu.nl:22 sivan@up.science.uu.nl
# Copy kubernetes files over
-
scp -r -o StrictHostKeyChecking=no -P 1234 -i ~/.ssh/id_rsa integration-testing/pod.yml root@localhost:/root/kubernetes/integration/integrating-pod/pod.yml
# Deploy all yml files
-
ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl apply -f /root/kubernetes/integration/integrating-pod/pod.yml"
# Wait 5 seconds for the pod to start up
-
sleep
5
# CURL the config json to the integration service and store the response in the environment variable 'output'
-
|
output=$(curl -k --header "Content-Type: multipart/form-data" --request POST -F "configFile=@integration-testing/config.json;type=application/json" https://datastrophe.science.uu.nl/integration-test/start)
-
echo $output
# Count the number of occurences of the word FAIL in the output, if this is 1 then the test has failed
-
count=$(echo $output | grep -c "FAIL")
# Delete pod
# - ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl delete -f /root/kubernetes/integration/integrating-pod/pod.yml"
-
if [[ $count = 1 ]]; then exit 1; else exit 0; fi
#
integration-tests:
#
image: golang:1.16
#
stage: integration
#
only:
#
- develop
#
script:
#
- apt-get install openssh-client curl -y >/dev/null
#
- mkdir ~/.ssh/
#
- eval $(ssh-agent -s)
#
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
#
- chmod 600 ~/.ssh/id_rsa
#
- ssh-add ~/.ssh/id_rsa
#
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
#
- chmod 644 ~/.ssh/known_hosts
#
- ssh -fN -L 1234:science-vs260.science.uu.nl:22 sivan@up.science.uu.nl
#
# Copy kubernetes files over
#
- scp -r -o StrictHostKeyChecking=no -P 1234 -i ~/.ssh/id_rsa integration-testing/pod.yml root@localhost:/root/kubernetes/integration/integrating-pod/pod.yml
#
# Deploy all yml files
#
- ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl apply -f /root/kubernetes/integration/integrating-pod/pod.yml"
#
# Wait 5 seconds for the pod to start up
#
- sleep 5
#
# CURL the config json to the integration service and store the response in the environment variable 'output'
#
- |
#
output=$(curl -k --header "Content-Type: multipart/form-data" --request POST -F "configFile=@integration-testing/config.json;type=application/json" https://datastrophe.science.uu.nl/integration-test/start)
#
- echo $output
#
# Count the number of occurences of the word FAIL in the output, if this is 1 then the test has failed
#
- count=$(echo $output | grep -c "FAIL")
#
# Delete pod
#
# - ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl delete -f /root/kubernetes/integration/integrating-pod/pod.yml"
#
- if [[ $count = 1 ]]; then exit 1; else exit 0; fi
deploy
:
stage
:
deploy
...
...
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