SE4 Virtualisation TP Wasilewski - Gitlab CI file

De wiki-se.plil.fr
Révision datée du 11 mars 2024 à 16:33 par Jwasilew (discussion | contributions) (Page créée avec « <syntaxhighlight lang="yaml" line="1"> variables: NOMAD_ADDR: http://10.99.99.96:4646 docker_registry: 10.99.99.97:5000 docker_image: web-$VMID 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: he... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à la navigation Aller à la recherche
variables:
  NOMAD_ADDR: http://10.99.99.96:4646
  docker_registry: 10.99.99.97:5000
  docker_image: web-$VMID

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