.gitlab-ci.yml 1.23 KB
Newer Older
James Runnalls's avatar
James Runnalls committed
1
# renku: v1.dev20180723
James Runnalls's avatar
James Runnalls committed
2

James Runnalls's avatar
James Runnalls committed
3
4
5
6
7
variables:
  GIT_STRATEGY: fetch
  GIT_SSL_NO_VERIFY: "true"
  GIT_SUBMODULE_STRATEGY: recursive
  GIT_LFS_SKIP_SMUDGE: 1
James Runnalls's avatar
James Runnalls committed
8
  IMAGE_COMMIT: 15b9c35 # Need to be updated when image_build is run. Should be the first 7 digits of the commit ID from the image_build
James Runnalls's avatar
James Runnalls committed
9
10
  SUB_MODULE: 'data/Level_0/00001_LexploreMeteostation'
  
James Runnalls's avatar
James Runnalls committed
11

James Runnalls's avatar
James Runnalls committed
12
13
14
15
16
17
18
19
stages:
  - build

image_build:
  stage: build
  image: docker:stable
  before_script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN http://$CI_REGISTRY
James Runnalls's avatar
James Runnalls committed
20
  script:
James Runnalls's avatar
James Runnalls committed
21
22
23
24
    - CI_COMMIT_SHA_7=$(echo $CI_COMMIT_SHA | cut -c1-7)
    - docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7 .
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7
  tags:
James Runnalls's avatar
James Runnalls committed
25
26
27
28
29
30
31
32
33
    - image-build
  only:
    changes:
      - Dockerfile
      - requirements.txt
      
scripts:
  stage: build
  image: $CI_REGISTRY_IMAGE:$IMAGE_COMMIT
James Runnalls's avatar
James Runnalls committed
34
  before_script:
James Runnalls's avatar
James Runnalls committed
35
  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
James Runnalls's avatar
James Runnalls committed
36
  - eval $(ssh-agent -s)
James Runnalls's avatar
James Runnalls committed
37
  - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
James Runnalls's avatar
James Runnalls committed
38
  - mkdir -p ~/.ssh
James Runnalls's avatar
James Runnalls committed
39
  - chmod 700 ~/.ssh
James Runnalls's avatar
James Runnalls committed
40
  script:
James Runnalls's avatar
James Runnalls committed
41
  - ssh -o StrictHostKeyChecking=no -tt dataops@148.187.97.230 << EOF
James Runnalls's avatar
James Runnalls committed
42
  - cd renku/datalakes/home
James Runnalls's avatar
James Runnalls committed
43
44
  - git pull
  - git submodule update --init -- $SUB_MODULE
James Runnalls's avatar
James Runnalls committed
45
46
  - exit
  - EOF