Terms of Service | Privacy Policy | Cookie Policy

Commit 4c74e233 authored by Uwe Plonus's avatar Uwe Plonus

Added tests to .gitlab-ci.yml

parent e2acafb1
Pipeline #454 passed with stages
in 11 minutes and 59 seconds
......@@ -10,28 +10,39 @@ services:
stages:
- build
- test
- deploy
variables:
TEST_IMAGE: $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME:test
DEPLOY_IMAGE: $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME
TEST_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}:test
DEPLOY_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}
build:
stage: build
script:
- docker build -f Dockerfile -t $TEST_IMAGE --build-arg CI_REGISTRY=$CI_REGISTRY --no-cache=true .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $TEST_IMAGE
- docker push $TEST_IMAGE
- docker build -f Dockerfile -t ${TEST_IMAGE} --build-arg CI_REGISTRY=${CI_REGISTRY} --no-cache=true .
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${TEST_IMAGE}
- docker push ${TEST_IMAGE}
test_os:
stage: test
script:
- docker run --rm ${TEST_IMAGE} bash -c "apt-get update && apt-get -y upgrade"
test_nodejs:
stage: test
script:
- docker run --rm ${TEST_IMAGE} bash -c "node -v && npm -v"
deploy:
stage: deploy
script:
- docker pull $TEST_IMAGE
- docker tag $TEST_IMAGE $DEPLOY_IMAGE:latest
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $DEPLOY_IMAGE:latest
- docker tag $TEST_IMAGE $DEPLOY_IMAGE:$(date +%Y%m%d)
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $DEPLOY_IMAGE:$(date +%Y%m%d)
- docker pull ${TEST_IMAGE}
- docker tag ${TEST_IMAGE} ${DEPLOY_IMAGE}:latest
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker push ${DEPLOY_IMAGE}:latest
- docker tag ${TEST_IMAGE} ${DEPLOY_IMAGE}:$(date +%Y%m%d)
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker push ${DEPLOY_IMAGE}:$(date +%Y%m%d)
only:
- master
......@@ -5,6 +5,4 @@ RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install curl gnupg2 && \
curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
apt-get -y install nodejs && \
node -v && \
npm -v
apt-get -y install nodejs
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment