SE4 Virtualisation TP Wasilewski - Gitlab CI file

De wiki-se.plil.fr
Aller à la navigation Aller à la recherche
variables:
  NOMAD_ADDR: http://TODO
  docker_registry: TODO
  docker_image: TODO

stages:
  - build
  - deploy

build:
  stage: build
  image: docker
  tags:
    - docker
  script:
    - tag=${docker_registry}/${docker_image}:${CI_COMMIT_SHORT_SHA}
    - echo "building and pushing tag $tag"
    - docker build -t ${tag} -f Dockerfile .
    - docker push ${tag}

deploy:
  stage: deploy
  image: hendrikmaus/nomad-cli
  tags:
    - docker
  script:
    - apk add gettext
    - envsubst '${CI_COMMIT_SHORT_SHA}' < project.nomad > job.nomad
    - cat job.nomad
    - nomad validate job.nomad
    - nomad plan job.nomad || if [ $? -eq 255 ]; then exit 255; else echo "success"; fi
    - nomad run job.nomad