.gitlab-ci.yml 2.06 KB
Newer Older
Maxime Lefrançois's avatar
Maxime Lefrançois committed
variables:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    SAREF_DEV_KEY: <my_private_key>
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    SAREF_PORTAL_KEY: <my_private_key>

Maxime Lefrançois's avatar
Maxime Lefrançois committed
stages:
  - pipeline
  - staging
  - release

prepare-prerelease:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  image: openjdk:8-jdk
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  stage: pipeline
  allow_failure: true
  script:
    - curl -L -o saref-pipeline.jar "https://gitlab.emse.fr/saref/saref-pipeline/-/jobs/artifacts/master/raw/target/saref-pipeline.jar?job=build"
Maxime Lefrançois's avatar
ee  
Maxime Lefrançois committed
    - java -jar saref-pipeline.jar prerelease-portal -t && touch target/success
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  except:
    - master
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  artifacts:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    when: always
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    paths:
      - target/site
Maxime Lefrançois's avatar
Maxime Lefrançois committed
      - target/success
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    reports:
      junit: target/report_output.xml

prepare-release:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  image: openjdk:8-jdk
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  stage: pipeline
  script:
    - curl -L -o saref-pipeline.jar "https://gitlab.emse.fr/saref/saref-pipeline/-/jobs/artifacts/master/raw/target/saref-pipeline.jar?job=build"
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - java -jar saref-pipeline.jar release-portal && touch target/success
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  only:
    - master
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  artifacts:
    paths:
      - target/site
Maxime Lefrançois's avatar
Maxime Lefrançois committed
      - target/dataset
Maxime Lefrançois's avatar
Maxime Lefrançois committed
      - target/success
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    reports:
      junit: target/report_output.xml

staging:
Maxime Lefrançois's avatar
e  
Maxime Lefrançois committed
  image: maximelefrancois86/alpine-ssh-rsync
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  stage: staging
  script:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - 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'
    - scp -pr '-P 29419' target/site saref-dev@saref.etsi.org:~/staging/$CI_PIPELINE_ID
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - echo "SAREF staging portal  https://saref.etsi.org/staging/$CI_PIPELINE_ID/" 
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - exit $(test -f target/success) $?

deploy:
  image: maximelefrancois86/alpine-ssh-rsync
  stage: release
  when: manual
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  script:
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SAREF_PORTAL_KEY")
    - mkdir -p ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - rsync -rtcv -e 'ssh -p 29419' error-documents/ saref-portal@saref.etsi.org:~/error-documents
    - rsync -rtcv -e 'ssh -p 29419' target/site/ saref-portal@saref.etsi.org:~/site
Maxime Lefrançois's avatar
Maxime Lefrançois committed
    - scp -pr '-P 29419' target/dataset saref-portal@saref.etsi.org:~/dataset
Maxime Lefrançois's avatar
Maxime Lefrançois committed
  only:
   - master