Skip to content
Snippets Groups Projects

pipeline multiple updates

Merged Dobromir Palushev requested to merge just-a-test into staging
1 file
+ 3
4
Compare changes
  • Side-by-side
  • Inline
+ 24
7
@@ -7,9 +7,10 @@ workflow:
variables:
DOCKER_VERSION: '20.10.17'
K8S_VERSION: '1.24'
GOOGLE_CLOUD_SDK_IMAGE_VERSION: '400.0.0'
MONGO_VERSION: '4.4'
K8S_NAMESPACE: 'todoapp-devops'
GOOGLE_CLOUD_SDK_IMAGE_VERSION: '400.0.0'
GCP_COMPUTE_REGION: 'europe-west4a'
CONTAINER_TAG: '${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}'
stages:
@@ -26,25 +27,44 @@ stages:
- gcloud config set compute/zone ${GCP_COMPUTE_REGION}
- gcloud container clusters get-credentials ${GCP_PROJECT_ID}-gke
test-image:
run-tests:
stage: test
tags:
- docker-privileged
# - docker
image: docker:${DOCKER_VERSION}
# image: node:16.17.0-alpine
services:
- name: docker:${DOCKER_VERSION}-dind
script:
- docker run -p 27017:27017 -d --name mongo-container --rm --add-host=host.docker.internal:host-gateway mongo:${MONGO_VERSION}
- docker build
--tag "${CONTAINER_TAG}-test"
--target=test
--add-host=host.docker.internal:host-gateway
"./app"
# - echo ‘http://dl-cdn.alpinelinux.org/alpine/v3.6/main’ >> /etc/apk/repositories
# - echo ‘http://dl-cdn.alpinelinux.org/alpine/v3.6/community’ >> /etc/apk/repositories
# - apk update
# - apk add mongodb mongodb-tools
# - mkdir -p /data/db/
# - mongod --config "./app/server/dev.mongo.conf"
# - cd "./app/client"
# - npm ci --no-audit --no-fund
# - npm run test
# - cd "../server"
# - npm ci --no-audit --no-fund
# - MONGODB_URL=mongodb://localhost:27017/todo-app JWT_SECRET=a-big-secret npm run test
# - jest --ci
after_script:
- docker stop mongo-container
- docker images -a | grep "mongo" | awk '{print $3}' | xargs docker rmi --force
- docker image rm --force "${CONTAINER_TAG}-test"
build-image:
stage: build
needs:
- 'test-image'
- 'run-tests'
tags:
- docker-privileged
image: docker:${DOCKER_VERSION}
@@ -67,9 +87,6 @@ build-image:
create-release_image:
stage: release
rules:
- if: $CI_COMMIT_REF_NAME =~ /main/
when: 'always'
tags:
- docker-privileged
image: docker:${DOCKER_VERSION}
Loading