summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/templates/Packer.gitlab-ci.yml
blob: 3db712c6dc5d8082e2589863a67ead9b4eb69f30 (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
30
31
32
33
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Packer.gitlab-ci.yml

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
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      when: manual