.gitlab-ci.yml 1.58 KB
Newer Older
Yori Fournier's avatar
Yori Fournier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
image: openshift/origin-cli

default:
    tags:
       - debian
    timeout: 1h 00m

stages:
    - test
    - build
    - deploy

variables:
    OPENSHIFT_SERVER: https://${OPENSHIFT_IP}:${OPENSHIFT_PORT}/
    OPENSHIFT_DOMAIN: apps.okd.aip.de
# Configure this variable in Secure Variables:
#OPENSHIFT_TOKEN:
#OPENSHIFT_PROJECT: python

Yori Fournier's avatar
Yori Fournier committed
20 21 22 23 24
.login_to_okd: &login_to_okd
    - oc login "$OPENSHIFT_SERVER" --token="$OPENSHIFT_TOKEN" --insecure-skip-tls-verify	
    - oc project "$CI_PROJECT_NAME-$CI_PROJECT_ID" 2> /dev/null || oc new-project "$CI_PROJECT_NAME-$CI_PROJECT_ID"

.build_image: &build_image
Yori Fournier's avatar
wierd  
Yori Fournier committed
25
    - oc new-build --strategy=docker --binary --name "$APP" --to "python-$APP"
Yori Fournier's avatar
Yori Fournier committed
26
    - oc start-build $APP --from-dir=./$APP --follow
Yori Fournier's avatar
Yori Fournier committed
27

Yori Fournier's avatar
Yori Fournier committed
28 29 30 31 32 33 34 35 36
build-proc1:
    stage: build
    variables:
      APP: proc1
      DOCKER_FILE: dockerfile_proc1
      APP_HOST: $CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$OPENSHIFT_DOMAIN
    before_script:
      - *login_to_okd
    script:
Yori Fournier's avatar
Yori Fournier committed
37
      - *build_image
Yori Fournier's avatar
Yori Fournier committed
38 39 40 41 42 43 44 45 46 47

build-proc2:
    stage: build
    variables:
      APP: proc2
      DOCKER_FILE: dockerfile_proc2
      APP_HOST: $CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$OPENSHIFT_DOMAIN
    before_script:
      - *login_to_okd
    script:
Yori Fournier's avatar
wierd  
Yori Fournier committed
48
      - oc new-build --strategy=docker --binary --name proc2 --to="python-proc2"
Yori Fournier's avatar
Yori Fournier committed
49
      - oc start-build proc2 --from-dir=./proc2 --follow
Yori Fournier's avatar
Yori Fournier committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

test1:
    stage: test
    before_script: []
    script:
      - echo run tests
  
test2:
    stage: test
    before_script: []
    script:
      - echo run tests


deploy:
    stage: deploy
    before_script:
      - *login_to_okd
    script:
      - oc apply -f manifest.yaml