Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
Addming CircleCi build (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
rareddy committed Oct 25, 2018
1 parent aa6941a commit a354bd7
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
108 changes: 108 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,108 @@
#
# Copyright (C) 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
version: 2

common_env: &common_env
MAVEN_OPTS: -Xmx1024m
DOCKER_VERSION: 17.04.0-ce

job_default: &job_defaults
working_directory: /workspace
docker:
- image: openjdk:8-jdk

push_images: &push_images
deploy:
command: |
if [ "${CIRCLE_PROJECT_USERNAME}" != "teiid-komodo" ]; then
exit 0
fi
if [ ! -x /usr/bin/docker ]; then
curl -fsSL https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz | tar xz -C /usr/bin --strip-components 1
fi
if [ "${CIRCLE_BRANCH}" == "teiid-syndesis" ]; then
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
for image in ${DOCKER_IMAGES} ; do
docker push teiid/${image}:latest | cat -
done
fi
if [[ "${CIRCLE_TAG}" =~ ^[0-9]+(\.[0-9]+){2} ]]; then
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
for image in ${IMAGES} ; do
docker push teiid/${image}:${CIRCLE_TAG} | cat -
docker tag teiid/${image}:${CIRCLE_TAG} teiid/${image}:$(echo ${CIRCLE_TAG} | sed -e 's/\.[0-9][0-9]*$//')
docker push teiid/${image}:$(echo ${CIRCLE_TAG} | sed -e 's/\.[0-9][0-9]*$//')
done
fi
load_m2: &load_m2
attach_workspace:
at: ~/.m2

save_m2: &save_m2
persist_to_workspace:
root: ~/.m2
paths:
- repository/org/teiid

save_junit: &save_junit
run:
name: Collect junit reports
when: always
command: |
mkdir -p /workspace/junit/
find . -type f -regextype posix-extended -regex ".*target/.*TESTS?-.*xml" | xargs -i cp --backup --suffix=.xml {} /workspace/junit/
irc_notify_on_failure: &irc_notify_on_failure
run:
name: "IRC Notify failure to #teiid"
command: bash ./.circleci/send_irc_notification.sh
when: on_fail

jobs:
build:
branches:
only:
- teiid-syndesis
server:
<<: *job_defaults
environment:
DOCKER_IMAGES: komodo-server
<<: *common_env
steps:
- setup_remote_docker
- checkout
- restore_cache:
key: komodo-mvn-server-{{ checksum "pom.xml" }}
- <<: *load_m2
- run:
name: Build Server
command: |
mvn clean install -Pimage | tee build_log.txt
- <<: *save_junit
- store_test_results:
path: /workspace/junit
- store_artifacts:
path: build_log.txt
- <<: *push_images
- <<: *save_m2
- save_cache:
key: komodo-mvn-server-{{ checksum "pom.xml" }}
paths:
- ~/.m2
- <<: *irc_notify_on_failure
22 changes: 22 additions & 0 deletions .circleci/send_irc_notification.sh
@@ -0,0 +1,22 @@
#!/bin/bash

exec 5<>/dev/tcp/chat.freenode.net/6667
echo "USER komodo-ci 8 * : Komodo CircleCI" >&5
echo "NICK komodo-ci" >&5
echo "PRIVMSG NickServ :IDENTIFY ${IRC_NICKSERV_PASSWORD:-2hot2work}" >&5
sleep 20
echo "JOIN #teiid" >&5

if [ -n "$CIRCLE_PR_NUMBER" ]; then
echo "PRIVMSG #teiid :😱 PR $CIRCLE_PR_NUMBER ($CIRCLE_PR_USERNAME) - CircleCI job '$CIRCLE_JOB' failed" >&5
sleep 2
echo "PRIVMSG #teiid :📝 https://github.com/teiid/teiid-komodo/pull/$CIRCLE_PR_NUMBER" >&5
sleep 2
else
echo "PRIVMSG #teiid :😱 Master : CircleCI job '$CIRCLE_JOB' failed (last commit: $CIRCLE_USERNAME)" >&5
sleep 2
fi

echo "PRIVMSG #teiid :🚧 $CIRCLE_BUILD_URL" >&5
echo "QUIT" >&5
cat <&5

0 comments on commit a354bd7

Please sign in to comment.