.gitlab-ci.yml 1.55 KB
Newer Older
1
2
default:
  image: "archlinux:latest"
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
3
4
5

variables:
  PACKER_LOG: 1
6
7

stages:
8
  - lint
9
  - build
10
  - publish
11

Christian Rebischke's avatar
Christian Rebischke committed
12
shellcheck:
13
  stage: lint
14
15
  before_script:
    - pacman -Syu --needed --noconfirm shellcheck
Christian Rebischke's avatar
Christian Rebischke committed
16
  script:
17
    - find . -iname "*.sh" -exec shellcheck {} +
Christian Rebischke's avatar
Christian Rebischke committed
18
19

shfmt:
20
  stage: lint
21
22
  before_script:
    - pacman -Syu --needed --noconfirm shfmt
Christian Rebischke's avatar
Christian Rebischke committed
23
  script:
24
    - find . -iname "*.sh" -exec shfmt -i 2 -ci -d {} +
Christian Rebischke's avatar
Christian Rebischke committed
25
26

validate-packer:
27
  stage: lint
28
29
  before_script:
    - pacman -Syu --needed --noconfirm packer
Christian Rebischke's avatar
Christian Rebischke committed
30
  script:
31
    - packer validate -var "iso_checksum_url=https://mirror.pkgbuild.com/iso/latest/sha1sums.txt" -except=publish vagrant.json
32
    - packer validate cloud.json
Christian Rebischke's avatar
Christian Rebischke committed
33

34
35
# Note: We explicitly need the `ipv6` tag here because otherwise we'd get random
# gpg/pacman-key issues.
36
37
build:cloud-qemu:
  stage: build
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
38
39
  tags:
    - ipv6
40
41
42
  before_script:
    - pacman -Syu --needed --noconfirm packer qemu-headless
  script:
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
43
    - packer build -except=sign cloud.json
44
  artifacts:
45
    name: "qcow2"
46
    paths:
47
      - "Arch-Linux-x86_64-cloudimg-*.*"
48
49
50
    expire_in: 2d

build:vagrant-qemu:
51
  stage: build
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
52
53
  tags:
    - ipv6
54
  before_script:
55
    - pacman -Syu --needed --noconfirm packer qemu-headless
56
  script:
57
    - packer build -only=qemu -except publish vagrant.json
58
59
60
61

publish:
  stage: publish
  tags:
62
63
    - ipv6
    - secure
64
65
66
  before_script:
    - pacman -Syu --needed --noconfirm qemu-headless virtualbox packer
  script:
67
    - packer build -var "vagrant_cloud_token=$VAGRANT_API_TOKEN" vagrant.json
68
69
70
  only:
    variables:
      - $SCHEDULED_PUBLISH == "TRUE"
71
  resource_group: vm-build