aboutsummaryrefslogtreecommitdiffci
path: root/Jenkinsfile
blob: b24512b6f4ad109679aa2aa4c1897296f35153ef (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
71
72
73
pipeline {
    agent none

    options {
        timestamps()
    }

    environment {
        KIWI_FILE = 'Fedora.kiwi'
        IMAGE_TYPE = 'iso'
        IMAGE_PROFILE = 'Workstation-Live'
        OUTPUT_DIR = 'outdir'
    }

    stages {
        stage('Build Fedora Workstation (ARM64)') {
            agent {
                kubernetes {
                    defaultContainer 'kiwi'
                    yaml """
apiVersion: v1
kind: Pod
metadata:
  namespace: jenkins
spec:
  nodeSelector:
    kubernetes.io/arch: arm64
  containers:
    - name: kiwi
      image: fedora:44
      imagePullPolicy: Always
      command: [ 'sleep' ]
      args: [ 'infinity' ]
      tty: true
      resources:
        requests:
          cpu: "2"
          memory: 4Gi
          ephemeral-storage: 20Gi
        limits:
          memory: 12Gi
          ephemeral-storage: 50Gi
"""
                }
            }
            steps {
                checkout scm
                container('kiwi') {
                    script {
                        try {
                            sh '''
                                dnf --assumeyes install git kiwi kiwi-systemdeps distribution-gpg-keys
                                git submodule update --init --recursive

                                ./kiwi-build \\
                                    --kiwi-file="${KIWI_FILE}" \\
                                    --image-type="${IMAGE_TYPE}" \\
                                    --image-profile="${IMAGE_PROFILE}" \\
                                    --output-dir "${OUTPUT_DIR}"

                                ls -lh "${OUTPUT_DIR}-build"
                            '''
                        } catch (Exception e) {
                            echo "Caught exception: ${e.getMessage()}"
                            currentBuild.result = 'FAILURE'
                            throw e
                        }
                    }
                }
            }
        }
    }
}