.gitlab-ci.yml 1.62 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
32
33
    - packer validate -var "iso_checksum_url=https://mirror.pkgbuild.com/iso/latest/sha1sums.txt" -except=vagrant-cloud vagrant.json
    - packer validate local.json
    - packer validate cloud.json
Christian Rebischke's avatar
Christian Rebischke committed
34

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

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

publish:
  stage: publish
  tags:
63
64
    - ipv6
    - secure
65
66
67
  before_script:
    - pacman -Syu --needed --noconfirm qemu-headless virtualbox packer
  script:
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
68
    - packer build -parallel-builds=1 -var "vagrant_cloud_token=$VAGRANT_API_TOKEN" -except=vmware-iso vagrant.json
69
70
71
  only:
    variables:
      - $SCHEDULED_PUBLISH == "TRUE"
72
  resource_group: vm-build