summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile27
-rw-r--r--Jenkinsfile50
2 files changed, 71 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
index 17864402..bf639707 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,6 +9,8 @@ RUN echo 'deb http://ftp.debian.org/debian jessie-backports main' | tee -a /etc/
vim \
git \
make \
+ sudo \
+ locales \
live-build \
pbuilder \
devscripts \
@@ -73,11 +75,24 @@ RUN echo 'deb http://ftp.debian.org/debian stretch main' | tee -a /etc/apt/sourc
apt-get update &&\
rm -rf /var/lib/apt/lists/*
-#install packer
+# Standard shell should be bash not dash
+RUN echo "dash dash/sh boolean false" | debconf-set-selections && \
+ DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
+
+RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
+ENV LANG en_US.utf8
+
+# Install packer
RUN export LATEST="$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | \
- jq -r -M '.current_version')"; \
- echo "url https://releases.hashicorp.com/packer/"$LATEST"/packer_"$LATEST"_linux_amd64.zip" |\
- curl -K- | gzip -d > /usr/bin/packer
-RUN chmod +x /usr/bin/packer
+ jq -r -M '.current_version')"; \
+ echo "url https://releases.hashicorp.com/packer/"$LATEST"/packer_"$LATEST"_linux_amd64.zip" |\
+ curl -K- | gzip -d > /usr/bin/packer && \
+ chmod +x /usr/bin/packer
+
+# Create vyos_bld user account and enable sudo
+RUN useradd -ms /bin/bash -u 1006 --gid users vyos_bld && \
+ usermod -aG sudo vyos_bld && \
+ echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
-WORKDIR ~
+USER vyos_bld
+WORKDIR /home/vyos_bld
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 00000000..d46fdcbf
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,50 @@
+#!/usr/bin/env groovy
+
+@NonCPS
+def setDescription() {
+ def item = Jenkins.instance.getItemByFullName(env.JOB_NAME)
+ item.setDescription("VyOS image build using a\nPipeline build inside Docker container.")
+ item.save()
+}
+
+setDescription()
+
+/* Only keep the 10 most recent builds. */
+def projectProperties = [
+ [$class: 'BuildDiscarderProperty',strategy: [$class: 'LogRotator', numToKeepStr: '5']],
+]
+
+properties(projectProperties)
+
+pipeline {
+ agent {
+ dockerfile {
+ filename 'Dockerfile'
+ label 'jessie-amd64'
+ args '--privileged'
+ }
+ }
+
+ stages {
+ stage('Configure') {
+ steps {
+ sh './configure --build-by="autobuild@vyos.net" --debian-mirror="http://ftp.us.debian.org/debian/"'
+ }
+ }
+ stage('Build ISO') {
+ steps {
+ sh 'sudo make iso'
+ }
+ }
+ }
+
+ post {
+ always {
+ echo 'One way or another, I have finished'
+ // change build dir file permissions so wen can cleanup as regular
+ // user (jenkins) afterwards
+ sh 'sudo chmod -R 777 .'
+ deleteDir() /* cleanup our workspace */
+ }
+ }
+}