.gitlab-ci.yml 2.04 KB
Newer Older
1 2
image: openjdk:8-jdk

Maxime Lefrançois's avatar
Maxime Lefrançois committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
variables:
    SAREF_DEV_KEY: <my_private_key>
    SAREF_PORTAL_KEY: <my_private_key>

before_script:
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$SAREF_DEV_KEY")
  - mkdir -p ~/.ssh
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

stages:
  - test
  - build
  - deploy

test-develop:
  stage: test
20
  script:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
21
    - curl -L -o saref-pipeline.jar "https://forge.etsi.org/rep/SAREF/saref-pipeline/-/jobs/artifacts/master/raw/target/saref-pipeline.jar?job=build"
Maxime Lefrançois's avatar
Maxime Lefrançois committed
22 23
    - java -jar saref-pipeline.jar develop -s && touch target/success
  allow_failure: true
24 25 26 27 28 29 30
  except:
    - /^prerelease-v/
    - /^release-v/
  artifacts:
    when: always
    paths:
      - target/site
Maxime Lefrançois's avatar
Maxime Lefrançois committed
31
      - target/success
32 33 34
    reports:
      junit: target/report_output.xml

Maxime Lefrançois's avatar
Maxime Lefrançois committed
35 36
test-prerelease:
  stage: test
37
  script:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
38
    - curl -L -o saref-pipeline.jar "https://forge.etsi.org/rep/SAREF/saref-pipeline/-/jobs/artifacts/master/raw/target/saref-pipeline.jar?job=build"
Maxime Lefrançois's avatar
Maxime Lefrançois committed
39 40 41
    - java -jar saref-pipeline.jar release -t && touch target/success
  allow_failure: true
  only:
42 43 44 45 46
    - /^prerelease-v/
  artifacts:
    when: always
    paths:
      - target/site
Maxime Lefrançois's avatar
Maxime Lefrançois committed
47
      - target/success
48 49
    reports:
      junit: target/report_output.xml
Maxime Lefrançois's avatar
Maxime Lefrançois committed
50 51 52 53

deploy-report:
  stage: deploy
  script:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
54
    - scp -pr target/site saref-dev@saref.etsi.org:~/snapshot/$CI_PIPELINE_ID
Maxime Lefrançois's avatar
Maxime Lefrançois committed
55 56 57 58 59 60 61 62
    - echo "SAREF pipeline report  https://saref.etsi.org/snapshot/$CI_PIPELINE_ID/report.html" 
    - exit $(test -f target/success) $?
  except:
    - /^release-v/

test-release:
  stage: test
  script:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
63
    - curl -L -o saref-pipeline.jar "https://forge.etsi.org/rep/SAREF/saref-pipeline/-/jobs/artifacts/master/raw/target/saref-pipeline.jar?job=build"
Maxime Lefrançois's avatar
Maxime Lefrançois committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77
    - java -jar saref-pipeline.jar release -t
  only:
    - /^release-v/

trigger-release:
  stage: deploy
  only:
    - /^release-v/
  variables:
    SAREF_DEV_KEY: $SAREF_DEV_KEY
    SAREF_PORTAL_KEY: $SAREF_PORTAL_KEY
  trigger:
    project: saref/saref-portal
    branch: master