Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ss22-devops-project-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
Dobromir Palushev
ss22-devops-project-app
Commits
8178b1a3
Commit
8178b1a3
authored
2 years ago
by
Dobromir Palushev
Browse files
Options
Downloads
Plain Diff
Merge branch 'staging' into 'main'
Deployment from main See merge request
!45
parents
543f826e
b67868a8
No related branches found
No related tags found
1 merge request
!45
Deployment from main
Pipeline
#19173
passed
2 years ago
Stage: test
Stage: build
Stage: release
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+7
-5
7 additions, 5 deletions
.gitlab-ci.yml
app/Dockerfile
+0
-29
0 additions, 29 deletions
app/Dockerfile
app/Dockerfile.test
+29
-0
29 additions, 0 deletions
app/Dockerfile.test
with
36 additions
and
34 deletions
.gitlab-ci.yml
+
7
−
5
View file @
8178b1a3
...
...
@@ -15,7 +15,7 @@ variables:
CONTAINER_TAG
:
'
${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}'
stages
:
#
- test
-
test
-
build
-
release
-
deploy
...
...
@@ -36,6 +36,9 @@ run-tests:
services
:
-
name
:
docker:${DOCKER_VERSION}-dind
alias
:
localhost
variables
:
MONGODB_URL_TEST
:
mongodb://localhost:27017/todo-app
JWT_SECRET_TEST
:
my-very-secret-jwt
script
:
-
docker run -p 27017:27017
--detach
...
...
@@ -45,11 +48,10 @@ run-tests:
mongo:${MONGO_VERSION}
-
docker build
--tag "${CONTAINER_TAG}-test"
--target=test
--network=host
--build-arg MONGODB_URL_TEST=
mongodb://localhost:27017/todo-app
--build-arg JWT_SECRET_TEST=
my-very-secret-jwt
--
add-host=host.docker.internal:localho
st
--build-arg MONGODB_URL_TEST=
$MONGODB_URL_TEST
--build-arg JWT_SECRET_TEST=
$JWT_SECRET_TEST
--
file "./app/Dockerfile.te
st
"
"./app"
after_script
:
-
docker stop mongo-container
...
...
This diff is collapsed.
Click to expand it.
app/Dockerfile
+
0
−
29
View file @
8178b1a3
...
...
@@ -14,35 +14,6 @@ ENV \
MONGODB_URL=<dynamically-set-from-k8s> \
JWT_SECRET=<dynamically-set-from-k8s>
# ------------------------------------------------------------------
# # Test stage
# FROM base AS test
# # client tests
# WORKDIR /client
# COPY ./client .
# RUN npm ci --no-audit --no-fund
# RUN npm run test
# # server tests
# WORKDIR /server
# COPY ./server/src ./src/
# COPY ./server/package*.json ./
# RUN npm ci --no-audit --no-fund
# ARG MONGODB_URL_TEST
# ARG JWT_SECRET_TEST
# # MONGODB_URL and JWT_SECRET are available as env variables
# RUN MONGODB_URL=$MONGODB_URL_TEST JWT_SECRET=$JWT_SECRET_TEST npm run test
# ------------------------------------------------------------------
# Build stage
FROM
base
AS
build
...
...
This diff is collapsed.
Click to expand it.
app/Dockerfile.test
0 → 100644
+
29
−
0
View file @
8178b1a3
ARG
NODEJS_VERSION
=
'16.17.0'
# Test stage
FROM
node
:
$NODEJS_VERSION
-
alpine
# client tests
WORKDIR
/
client
COPY
.
/
client
.
RUN
npm
ci
--
no
-
audit
--
no
-
fund
RUN
npm
run
test
# server tests
WORKDIR
/
server
COPY
.
/
server
/
src
.
/
src
/
COPY
.
/
server
/
package
*.
json
.
/
RUN
npm
ci
--
no
-
audit
--
no
-
fund
ARG
\
MONGODB_URL_TEST
=
mongodb
://
host
.
docker
.
internal
:
27017
/
todo
-
app
\
JWT_SECRET_TEST
=<
my
-
very
-
secret
-
jwt
>
# MONGODB_URL and JWT_SECRET are available as env variables
RUN
MONGODB_URL
=
$MONGODB_URL_TEST
JWT_SECRET
=
$JWT_SECRET_TEST
npm
run
test
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