Browse Source

move build step to script and add nix

Steven Jacobs 1 year ago
parent
commit
383b11ee2e
4 changed files with 17 additions and 6 deletions
  1. 3 2
      Jenkinsfile
  2. 10 0
      bin/build
  3. 2 2
      nixos/nixos-17.09-x86_64.json
  4. 2 2
      void/void-20171007-x86_64-musl.json

+ 3 - 2
Jenkinsfile

@@ -4,13 +4,14 @@ pipeline {
         stage('Build') {
             steps {
                 echo 'Building..'
-                sh 'cd void/ && packer build -only=qemu void-20171007-x86_64.json && cd ../'
+                sh './bin/build'
             }
         }
     }
     post {
         always {
-            archiveArtifacts artifacts: 'dist/void-x86_64-20171007-qemu/*', fingerprint: true
+            archiveArtifacts artifacts: 'dist/**/*.raw', fingerprint: true
+            archiveArtifacts artifacts: 'dist/**/*.gz', fingerprint: true
         }
     }
 }

+ 10 - 0
bin/build

@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd void/ && \
+    packer build -only=qemu void-20171007-x86_64.json && \
+    packer build -only=qemu void-20171007-x86_64-musl.json && \
+    cd ../
+
+cd nixos/ && \
+    packer build -only=qemu nixos-17.09-x86_64.json && \
+    cd ../

+ 2 - 2
nixos/nixos-17.09-x86_64.json

@@ -54,8 +54,8 @@
       "inline": [
         "mv ../dist/{{user `template`}}-qemu/{{user `template`}} ../dist/{{user `template`}}-qemu/{{user `template`}}.qcow2",
         "qemu-img convert -O raw ../dist/{{user `template`}}-qemu/{{user `template`}}.qcow2 ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
-        "e2fsck -fy ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
-        "resize2fs -M ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
+        "sudo e2fsck -fy ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
+        "sudo resize2fs -M ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
         "gzip -c ../dist/{{user `template`}}-qemu/{{user `template`}}.raw > ../dist/{{user `template`}}-qemu/{{user `template`}}.gz"
       ],
       "only": [

+ 2 - 2
void/void-20171007-x86_64-musl.json

@@ -56,8 +56,8 @@
       "inline": [
         "mv ../dist/{{user `template`}}-qemu/{{user `template`}} ../dist/{{user `template`}}-qemu/{{user `template`}}.qcow2",
         "qemu-img convert -O raw ../dist/{{user `template`}}-qemu/{{user `template`}}.qcow2 ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
-        "e2fsck -fy ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
-        "resize2fs -M ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
+        "sudo e2fsck -fy ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
+        "sudo resize2fs -M ../dist/{{user `template`}}-qemu/{{user `template`}}.raw",
         "gzip -c ../dist/{{user `template`}}-qemu/{{user `template`}}.raw > ../dist/{{user `template`}}-qemu/{{user `template`}}.gz"
       ],
       "only": [