From 364d34930c077ed487e8621720177cf25fd90416 Mon Sep 17 00:00:00 2001
From: Jonah Graham <jonah@kichwacoders.com>
Date: Thu, 4 Aug 2022 13:18:30 -0400
Subject: [PATCH] Migrate builds to GitHub as source

---
 Jenkinsfile                                   | 42 +++++++++++++++++++
 .../cdt-full-pod-plus-eclipse-install.yaml    | 39 +++++++++++++++++
 jenkins/pod-templates/cdt-full-pod-small.yaml | 39 +++++++++++++++++
 .../pod-templates/cdt-full-pod-standard.yaml  | 39 +++++++++++++++++
 4 files changed, 159 insertions(+)
 create mode 100644 Jenkinsfile
 create mode 100644 jenkins/pod-templates/cdt-full-pod-plus-eclipse-install.yaml
 create mode 100644 jenkins/pod-templates/cdt-full-pod-small.yaml
 create mode 100644 jenkins/pod-templates/cdt-full-pod-standard.yaml

diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 00000000000..2220b8e9bfd
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,42 @@
+pipeline {
+  agent {
+    kubernetes {
+      yamlFile 'jenkins/pod-templates/cdt-full-pod-standard.yaml'
+    }
+  }
+  options {
+    timestamps()
+    disableConcurrentBuilds()
+  }
+  stages {
+    stage('Run build') {
+      steps {
+        container('cdt') {
+          timeout(activity: true, time: 20) {
+            withEnv(['MAVEN_OPTS=-XX:MaxRAMPercentage=60.0']) {
+                sh "/usr/share/maven/bin/mvn \
+                      clean verify -B -V \
+                      -Dmaven.test.failure.ignore=true \
+                      -DexcludedGroups=flakyTest,slowTest \
+                      -P baseline-compare-and-replace \
+                      -Ddsf.gdb.tests.timeout.multiplier=50 \
+                      -Dindexer.timeout=300 \
+                      -P production \
+                      -Dmaven.repo.local=/home/jenkins/.m2/repository \
+                      --settings /home/jenkins/.m2/settings.xml \
+                      "
+            }
+          }
+        }
+      }
+    }
+  }
+  post {
+    always {
+      container('cdt') {
+        junit '*/*/target/surefire-reports/*.xml,terminal/plugins/org.eclipse.tm.terminal.test/target/surefire-reports/*.xml'
+        archiveArtifacts '*/*/target/surefire-reports/**,terminal/plugins/org.eclipse.tm.terminal.test/target/surefire-reports/**,**/target/work/data/.metadata/.log,releng/org.eclipse.cdt.repo/target/org.eclipse.cdt.repo.zip,releng/org.eclipse.cdt.repo/target/repository/**,releng/org.eclipse.cdt.testing.repo/target/org.eclipse.cdt.testing.repo.zip,releng/org.eclipse.cdt.testing.repo/target/repository/**,debug/org.eclipse.cdt.debug.application.product/target/product/*.tar.gz,debug/org.eclipse.cdt.debug.application.product/target/products/*.zip,debug/org.eclipse.cdt.debug.application.product/target/products/*.tar.gz,debug/org.eclipse.cdt.debug.application.product/target/repository/**,lsp4e-cpp/org.eclipse.lsp4e.cpp.site/target/repository/**,lsp4e-cpp/org.eclipse.lsp4e.cpp.site/target/org.eclipse.lsp4e.cpp.repo.zip'
+      }
+    }
+  }
+}
diff --git a/jenkins/pod-templates/cdt-full-pod-plus-eclipse-install.yaml b/jenkins/pod-templates/cdt-full-pod-plus-eclipse-install.yaml
new file mode 100644
index 00000000000..f788287b877
--- /dev/null
+++ b/jenkins/pod-templates/cdt-full-pod-plus-eclipse-install.yaml
@@ -0,0 +1,39 @@
+apiVersion: v1
+kind: Pod
+spec:
+  containers:
+  - name: cdt
+    image: quay.io/eclipse-cdt/cdt-infra-plus-eclipse-install@sha256:efa01be7dc63af2f239fff3ea929d2d79b07084983e9ab859eb480fcc17b5ba2
+    tty: true
+    args: ["/bin/sh", "-c", "/home/vnc/.vnc/xstartup.sh && cat"]
+    resources:
+      requests:
+        memory: "2662Mi"
+        cpu: "1"
+      limits:
+        memory: "2662Mi"
+        cpu: "1"
+    volumeMounts:
+    - name: settings-xml
+      mountPath: /home/jenkins/.m2/settings.xml
+      subPath: settings.xml
+      readOnly: true
+    - name: m2-repo
+      mountPath: /home/jenkins/.m2/repository
+  - name: jnlp
+    resources:
+      requests:
+        memory: "512Mi"
+        cpu: "200m"
+      limits:
+        memory: "512Mi"
+        cpu: "500m"
+  volumes:
+  - name: settings-xml
+    secret:
+      secretName: m2-secret-dir
+      items:
+      - key: settings.xml
+        path: settings.xml
+  - name: m2-repo
+    emptyDir: {}
diff --git a/jenkins/pod-templates/cdt-full-pod-small.yaml b/jenkins/pod-templates/cdt-full-pod-small.yaml
new file mode 100644
index 00000000000..18f6b50c3a8
--- /dev/null
+++ b/jenkins/pod-templates/cdt-full-pod-small.yaml
@@ -0,0 +1,39 @@
+apiVersion: v1
+kind: Pod
+spec:
+  containers:
+  - name: cdt
+    image: quay.io/eclipse-cdt/cdt-infra-eclipse-full@sha256:b892f93d8b2a2acbb6045438f8771790d31b4722040ca815d391b532cc796182
+    tty: true
+    args: ["/bin/sh", "-c", "/home/vnc/.vnc/xstartup.sh && cat"]
+    resources:
+      requests:
+        memory: "2Gi"
+        cpu: "1"
+      limits:
+        memory: "2Gi"
+        cpu: "1"
+    volumeMounts:
+    - name: settings-xml
+      mountPath: /home/jenkins/.m2/settings.xml
+      subPath: settings.xml
+      readOnly: true
+    - name: m2-repo
+      mountPath: /home/jenkins/.m2/repository
+  - name: jnlp
+    resources:
+      requests:
+        memory: "512Mi"
+        cpu: "200m"
+      limits:
+        memory: "512Mi"
+        cpu: "500m"
+  volumes:
+  - name: settings-xml
+    secret:
+      secretName: m2-secret-dir
+      items:
+      - key: settings.xml
+        path: settings.xml
+  - name: m2-repo
+    emptyDir: {}
diff --git a/jenkins/pod-templates/cdt-full-pod-standard.yaml b/jenkins/pod-templates/cdt-full-pod-standard.yaml
new file mode 100644
index 00000000000..3d901b200c6
--- /dev/null
+++ b/jenkins/pod-templates/cdt-full-pod-standard.yaml
@@ -0,0 +1,39 @@
+apiVersion: v1
+kind: Pod
+spec:
+  containers:
+  - name: cdt
+    image: quay.io/eclipse-cdt/cdt-infra-eclipse-full@sha256:b892f93d8b2a2acbb6045438f8771790d31b4722040ca815d391b532cc796182
+    tty: true
+    args: ["/bin/sh", "-c", "/home/vnc/.vnc/xstartup.sh && cat"]
+    resources:
+      requests:
+        memory: "2662Mi"
+        cpu: "1"
+      limits:
+        memory: "2662Mi"
+        cpu: "1"
+    volumeMounts:
+    - name: settings-xml
+      mountPath: /home/jenkins/.m2/settings.xml
+      subPath: settings.xml
+      readOnly: true
+    - name: m2-repo
+      mountPath: /home/jenkins/.m2/repository
+  - name: jnlp
+    resources:
+      requests:
+        memory: "512Mi"
+        cpu: "200m"
+      limits:
+        memory: "512Mi"
+        cpu: "500m"
+  volumes:
+  - name: settings-xml
+    secret:
+      secretName: m2-secret-dir
+      items:
+      - key: settings.xml
+        path: settings.xml
+  - name: m2-repo
+    emptyDir: {}