.gitlab-ci.yml 1.58 KB
Newer Older
1
2
default:
  image: "archlinux:latest"
3
4

stages:
5
  - lint
6
  - build
7
  - publish
8

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

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

validate-packer:
24
  stage: lint
25
26
  before_script:
    - pacman -Syu --needed --noconfirm packer
Christian Rebischke's avatar
Christian Rebischke committed
27
  script:
28
29
30
    - 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
31

32
33
34
35
36
build:cloud-qemu:
  stage: build
  before_script:
    - pacman -Syu --needed --noconfirm packer qemu-headless
  script:
37
    - packer build -parallel-builds=1 -var 'write_zeroes=yes' -except=sign cloud.json
38
39
40
41
42
43
44
  artifacts:
    name: "cloud-qemu"
    paths:
      - "release/Arch-Linux-x86_64-cloudimg-*.img"
    expire_in: 2d

build:vagrant-qemu:
45
  stage: build
46
  before_script:
47
    - pacman -Syu --needed --noconfirm packer qemu-headless
48
  script:
49
    - packer build -parallel-builds=1 -var 'write_zeroes=yes' -only=qemu local.json
50
51
52
53
54
55
56
57
58

publish:
  stage: publish
  tags:
    - secure-kvm
    - secure-virtualbox
  before_script:
    - pacman -Syu --needed --noconfirm qemu-headless virtualbox packer
  script:
59
    - packer build -parallel-builds=1 -var "vagrant_cloud_token=$VAGRANT_API_TOKEN" -var 'write_zeroes=yes' -except=vmware-iso vagrant.json
60
61
62
  only:
    variables:
      - $SCHEDULED_PUBLISH == "TRUE"
63
  resource_group: vm-build