summaryrefslogtreecommitdiffstats
path: root/.circleci
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-04-04 16:37:09 +0200
committerDylan William Hardison <dylan@hardison.net>2018-04-04 16:37:09 +0200
commit85a2490e1e696c8d62562f8752fc486c02578ec3 (patch)
treeecccf51876427cd08a8036c984f7e6e5e2b5d119 /.circleci
parent0d820e69bc52f5ee1f9f1ea89eb83b82d83550db (diff)
downloadbugzilla-85a2490e1e696c8d62562f8752fc486c02578ec3.tar.gz
bugzilla-85a2490e1e696c8d62562f8752fc486c02578ec3.tar.xz
no bug - add dev build pipeline to circleci
Diffstat (limited to '.circleci')
-rw-r--r--.circleci/build.sh12
-rw-r--r--.circleci/deploy.sh25
2 files changed, 37 insertions, 0 deletions
diff --git a/.circleci/build.sh b/.circleci/build.sh
new file mode 100644
index 000000000..7d476c85d
--- /dev/null
+++ b/.circleci/build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+set -euf -o pipefail
+
+docker build \
+ --build-arg CI="$CI" \
+ --build-arg CIRCLE_SHA1="$CIRCLE_SHA1" \
+ --build-arg CIRCLE_BUILD_URL="$CIRCLE_BUILD_URL" \
+ -t bmo .
+
+docker run --name bmo --entrypoint true bmo
+docker cp bmo:/app/version.json build_info/version.json
diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh
new file mode 100644
index 000000000..3d8a3852f
--- /dev/null
+++ b/.circleci/deploy.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -euf -o pipefail
+
+[[ -n "$DOCKERHUB_REPO" && -n "$DOCKER_USER" && -n "$DOCKER_PASS" ]] || exit 0
+docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
+
+if [[ "$CIRCLE_BRANCH" == "master" ]]; then
+ TAG="$(cat /app/build_info/tag.txt)"
+ [[ -n "$GITHUB_PERSONAL_TOKEN" ]] || exit 0
+ if [[ -n "$TAG" && -f build_info/publish.txt ]]; then
+ git config credential.helper "cache --timeout 120"
+ git config user.email "$GITHUB_EMAIL"
+ git config user.name "$GITHUB_NAME"
+ git tag $TAG
+ git push https://${GITHUB_PERSONAL_TOKEN}:x-oauth-basic@github.com/$GITHUB_REPO.git $TAG
+ docker tag bmo "$DOCKERHUB_REPO:$TAG"
+ docker push "$DOCKERHUB_REPO:$TAG"
+ fi
+ docker tag bmo "$DOCKERHUB_REPO:latest"
+ docker push "$DOCKERHUB_REPO:latest"
+elif [[ "$CIRCLE_BRANCH" == "development" ]]; then
+ docker tag bmo "$DOCKERHUB_REPO:build-${CIRCLE_BUILD_NUM}"
+ docker push "$DOCKERHUB_REPO:build-${CIRCLE_BUILD_NUM}"
+fi