Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lecture-devops-app
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
s80984
lecture-devops-app
Commits
72545b17
Commit
72545b17
authored
3 years ago
by
s80984
Browse files
Options
Downloads
Patches
Plain Diff
Update Test Job
parent
0c33719b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#14150
failed
3 years ago
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+10
-10
10 additions, 10 deletions
.gitlab-ci.yml
app/server/Dockerfile.test
+1
-1
1 addition, 1 deletion
app/server/Dockerfile.test
docker-compose.test.yml
+1
-1
1 addition, 1 deletion
docker-compose.test.yml
with
12 additions
and
12 deletions
.gitlab-ci.yml
+
10
−
10
View file @
72545b17
...
...
@@ -43,7 +43,7 @@ job_build-image:
# - docker info
# - docker-compose --version
script
:
-
docker-compose up -d
-
docker-compose up -d
--build
# - docker-compose up -d --build
# # - docker ps
# # - docker network list
...
...
@@ -71,21 +71,21 @@ job_test-image:
before_script
:
-
apk add --no-cache docker-compose
script
:
-
docker-compose -f docker-compose.test.yml up
-
docker-compose -f docker-compose.test.yml up
--build
# - npm run test
# - docker run
# --detach
# --publish "${outerPort}:8080"
# --name "${CI_PROJECT_ID}-${CI_PIPELINE_IID}"
# "${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}"
-
|
attempts=1
while (wget "http://containerhost:${outerPort}" 2>&1 || true) | grep 'Connection refused' && [ "${attempts}" -lt 5 ]; do
sleep 1 && echo sleeping
attempts=$((attempts + 1))
done
-
(wget --no-cache --quiet --output-document - "http://containerhost:${outerPort}/health" | docker run --rm --interactive stedolan/jq -e '.status == "pass"')
|| (echo 'Test failed' && exit 1)
#
- |
#
attempts=1
#
while (wget "http://containerhost:${outerPort}" 2>&1 || true) | grep 'Connection refused' && [ "${attempts}" -lt 5 ]; do
#
sleep 1 && echo sleeping
#
attempts=$((attempts + 1))
#
done
#
- (wget --no-cache --quiet --output-document - "http://containerhost:${outerPort}/health" | docker run --rm --interactive stedolan/jq -e '.status == "pass"')
#
|| (echo 'Test failed' && exit 1)
after_script
:
# NOTE: clean up after test run (stop and remove container)
# - docker rm --force "${CI_PROJECT_ID}-${CI_PIPELINE_IID}"
...
...
This diff is collapsed.
Click to expand it.
app/server/Dockerfile.test
+
1
−
1
View file @
72545b17
...
...
@@ -43,5 +43,5 @@ COPY . .
EXPOSE
3000
CMD
[
"npm"
,
"start"
]
#
CMD [ "npm", "start" ]
CMD
[
"npm"
,
"run"
,
"test"
]
This diff is collapsed.
Click to expand it.
docker-compose.test.yml
+
1
−
1
View file @
72545b17
...
...
@@ -8,7 +8,7 @@ services:
volumes
:
-
mongodb:/.local/db/data/db
app
:
container_name
:
node-mongo-app
container_name
:
node-mongo-app
-test
# image: ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}
restart
:
always
build
:
...
...
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