]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-container: add job to build and push images 971/head
authorSébastien Han <seb@redhat.com>
Tue, 27 Feb 2018 15:36:07 +0000 (16:36 +0100)
committerSébastien Han <seb@redhat.com>
Tue, 27 Feb 2018 18:10:39 +0000 (19:10 +0100)
After a PR is merged we trigger a build and a push the newly built
images to the Docker Hub.

Signed-off-by: Sébastien Han <seb@redhat.com>
ceph-container-build-push-imgs/build/build [new file with mode: 0644]
ceph-container-build-push-imgs/config/JENKINS_URL [new file with mode: 0644]
ceph-container-build-push-imgs/config/definitions/ceph-container-build-push-imgs.yml [new file with mode: 0644]

diff --git a/ceph-container-build-push-imgs/build/build b/ceph-container-build-push-imgs/build/build
new file mode 100644 (file)
index 0000000..6bbb9a6
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+set -e
+
+
+#############
+# FUNCTIONS #
+#############
+
+function login_docker_hub {
+  echo "Login in the Docker Hub"
+  docker login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_PASSWORD"
+}
+
+function build_ceph_imgs {
+  make build.parallel
+}
+
+function push_ceph_imgs {
+  make push
+}
+
+
+########
+# MAIN #
+########
+
+login_docker_hub
+set -x
+cd "$WORKSPACE"/ceph-container/ || exit
+build_ceph_imgs
+push_ceph_imgs
+cd - || exit
+
diff --git a/ceph-container-build-push-imgs/config/JENKINS_URL b/ceph-container-build-push-imgs/config/JENKINS_URL
new file mode 100644 (file)
index 0000000..e97cf67
--- /dev/null
@@ -0,0 +1 @@
+2.jenkins.ceph.com
diff --git a/ceph-container-build-push-imgs/config/definitions/ceph-container-build-push-imgs.yml b/ceph-container-build-push-imgs/config/definitions/ceph-container-build-push-imgs.yml
new file mode 100644 (file)
index 0000000..a42116f
--- /dev/null
@@ -0,0 +1,41 @@
+- job:
+    name: ceph-container-build-push-imgs
+    node: small && trusty
+    project-type: freestyle
+    defaults: global
+    display-name: 'ceph-container: build and push container images to Docker Hub'
+    quiet-period: 5
+    block-downstream: false
+    block-upstream: false
+    retry-count: 3
+    properties:
+      - github:
+          url: https://github.com/ceph/ceph-container
+    logrotate:
+      daysToKeep: -1
+      numToKeep: -1
+      artifactDaysToKeep: -1
+      artifactNumToKeep: -1
+
+    triggers:
+      - github
+
+    scm:
+      - git:
+          url: https://github.com/ceph/ceph-container.git
+          branches:
+            - master
+          browser: auto
+          basedir: "ceph-container"
+          timeout: 20
+
+    builders:
+      - shell:
+          !include-raw:
+            - ../../../scripts/build_utils.sh
+            - ../../build/build
+
+    wrappers:
+      - inject-passwords:
+          global: true
+          mask-password-params: true