Skip to content
.gitlab-ci.yml 1.12 KiB
Newer Older
nimrod's avatar
nimrod committed
---
include:
  - project: shore/ci-templates
    file: templates/pre-commit.yml
  - project: shore/ci-templates
    file: templates/terraform.yml
nimrod's avatar
nimrod committed

nimrod's avatar
nimrod committed
default:
  before_script:
    # yamllint disable-line rule:line-length
    - wget https://releases.hashicorp.com/terraform/0.15.3/terraform_0.15.3_linux_amd64.zip -O /tmp/terraform.zip
    - unzip /tmp/terraform.zip terraform -d /usr/local/bin/
    - terraform version
nimrod's avatar
nimrod committed
    - rm -rf .terraform*
nimrod's avatar
nimrod committed
    - touch payload.zip

nimrod's avatar
nimrod committed
Generate payload:
  stage: build
  image: registry.shore.co.il/ci-images:python3
  variables:
    XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
  before_script:
    - apt-get update
    - apt-get install -y zip
  script:
    make payload.zip
  artifacts:
    paths:
      - payload.zip
  cache:
    paths:
      - .cache/

Terraform plan:
  extends: .tf_plan
nimrod's avatar
nimrod committed
  stage: test
nimrod's avatar
nimrod committed
  dependencies:
    - Generate payload
nimrod's avatar
nimrod committed
  cache:
    paths: &tf_cache
      - .terraform
      - .terraform.lock.hcl
nimrod's avatar
nimrod committed

Terraform apply:
  extends: .tf_apply
nimrod's avatar
nimrod committed
  stage: deploy
nimrod's avatar
nimrod committed
  dependencies: &tf_apply_dependecies
    - Generate payload
    - Terraform plan
  needs: *tf_apply_dependecies
nimrod's avatar
nimrod committed
  cache:
    paths: *tf_cache