summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/templates/Packer.gitlab-ci.yml
blob: 28255eb893c855ea91e25865f1ce55ce306b809a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
image:
  name: hashicorp/packer:latest
  entrypoint:
    - '/usr/bin/env'
    - 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

before_script:
  - packer --version

stages:
  - validate
  - build
  - test
  - deploy

validate:
  stage: validate
  script:
    - find . -maxdepth 1 -name '*.json' -print0 | xargs -t0n1 packer validate

build:
  stage: deploy
  environment: production
  script:
    - find . -maxdepth 1 -name '*.json' -print0 | xargs -t0n1 packer build
  when: manual
  only:
    variables:
      - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME