Terms of Service | Privacy Policy | Cookie Policy

Commit 299f8f04 authored by Uwe Plonus's avatar Uwe Plonus

Added tests to .gitlab-ci.yml

parent ba0b69d4
Pipeline #453 passed with stages
in 29 minutes and 39 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 $CI_REGISTRY
- 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} ${CI_REGISTRY}
- docker push ${TEST_IMAGE}
test_os:
stage: test
script:
- docker run --rm ${TEST_IMAGE} bash -c "apt-get update && apt-get -y upgrade"
test_java:
stage: test
script:
- docker run --rm ${TEST_IMAGE} bash -c "java -version"
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
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