diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c91f66b --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,68 @@ +def image_name = "dpedu/artifact" + +pipeline { + agent { + kubernetes { + yaml """ +apiVersion: v1 +kind: Pod +spec: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: # avoid nodes already running a jenkins job + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: jenkins + operator: In + values: + - slave + topologyKey: node + containers: + - name: docker + image: docker:20-dind + args: + - "--insecure-registry" + - "dockermirror:5000" + securityContext: + privileged: true +""" + } + } + stages { + stage("Build image") { + steps { + container("docker") { + script { + try { + docker.withRegistry('http://dockermirror:5000') { + docker.image("ubuntu:bionic").pull() + docker.image(image_name).pull() // Pull a recent version to share base layers with (?) + } + } catch (exc) { + echo "couldn't pull image, assuming we're building it for the first time" + } + docker.build(image_name) + } + } + } + } + stage("Push image") { + steps { + container("docker") { + script { + docker.withRegistry('http://dockermirror:5000') { + docker.image(image_name).push("latest") + } + } + } + } + } + stage("Show images") { + steps { + container("docker") { + sh 'docker images' + } + } + } + } +} diff --git a/requirements.txt b/requirements.txt index a6474ab..470c3f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ PGPy==0.4.1 portend==2.4 pyasn1==0.4.5 pycparser==2.19 --e git+https://git.davepedu.com/dave/python-dpkg.git#egg=pydpkg +-e git+https://git.davepedu.com/dave/python-dpkg.git@a1c0212e09#egg=pydpkg PyMySQL==0.9.3 python-dateutil==2.8.0 python-gnupg==0.4.4 @@ -32,5 +32,4 @@ six==1.12.0 SQLAlchemy==1.3.3 tempora==1.14.1 urllib3==1.24.2 -wheel==0.33.1 zc.lockfile==1.4