summaryrefslogtreecommitdiff
path: root/.cci.jenkinsfile
blob: ce29289964b4f6324f96fee430e7020bc6666d6c (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Documentation: https://github.com/coreos/coreos-ci/blob/main/README-upstream-ci.md

stage("Build") {
  def n = 5
  buildPod(memory: "2Gi", cpu: "${n}") {
      checkout scm
      stage("Static analysis") {
          shwrap("./ci/codestyle.sh")
      }
      stage("Core build") {
        shwrap("""
          # fetch tags so `git describe` gives a nice NEVRA when building the RPM
          git fetch origin --tags
          git submodule update --init

          env MAKE_JOBS=${n} SKIP_INSTALLDEPS=1 ./ci/build.sh
        """)
      }
      stage("Unit tests") {
        try {
          shwrap("""
            make check
            make syntax-check
          """)
        } finally {
            shwrap("cat test-suite.log || true")
            archiveArtifacts allowEmptyArchive: true, artifacts: 'test-suite.log'
        }
      }
      stage("Build installed tests") {
        shwrap("make -C tests/kolainst")
      }
      stage("Generate artifacts") {
        shwrap("""
          make install DESTDIR=\$(pwd)/installed/rootfs
          make -C tests/kolainst install DESTDIR=\$(pwd)/installed/tests
        """)
      }
      stash includes: "installed/", name: 'build'
  }
}

// Build FCOS and run kola tests.
// Both fcosKola and fcosKolaTestIso require 4G max. Add 512M for overhead.
stage("FCOS") {
  cosaPod(runAsUser: 0, memory: "4608Mi", cpu: "4") {
    stage("Build FCOS") {
      checkout scm
      unstash 'build'
      shwrap("""
        # Move the bits into the cosa pod
        rsync -rlv installed/rootfs/ /
        rsync -rlv installed/tests/ /
        coreos-assembler init --force https://github.com/coreos/fedora-coreos-config
        mkdir -p overrides/rootfs
        # And override the on-host bits
        mv installed/rootfs/* overrides/rootfs/
        rm installed -rf
        coreos-assembler fetch
        coreos-assembler build
        coreos-assembler buildextend-metal
        coreos-assembler buildextend-metal4k
        coreos-assembler buildextend-live --fast

      """)
    }
    fcosKola(cosaDir: "${env.WORKSPACE}")
    fcosKolaTestIso(cosaDir: "${env.WORKSPACE}", skipMetal4k: true, skipMultipath: true)
  }
}