From commits-return-13136-archive-asf-public=cust-asf.ponee.io@fineract.apache.org Thu Oct 29 19:20:48 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-he-de.apache.org (mxout1-he-de.apache.org [95.216.194.37]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id EEE05180648 for ; Thu, 29 Oct 2020 20:20:47 +0100 (CET) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-he-de.apache.org (ASF Mail Server at mxout1-he-de.apache.org) with SMTP id 46754656CC for ; Thu, 29 Oct 2020 19:20:47 +0000 (UTC) Received: (qmail 47690 invoked by uid 500); 29 Oct 2020 19:20:46 -0000 Mailing-List: contact commits-help@fineract.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@fineract.apache.org Delivered-To: mailing list commits@fineract.apache.org Received: (qmail 47519 invoked by uid 99); 29 Oct 2020 19:20:46 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Oct 2020 19:20:46 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id B786C820D1; Thu, 29 Oct 2020 19:20:45 +0000 (UTC) Date: Thu, 29 Oct 2020 19:20:49 +0000 To: "commits@fineract.apache.org" Subject: [fineract-cn-interoperation] 04/04: add docker and travis build file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: kaze@apache.org In-Reply-To: <160399924559.19793.14863507946338344070@gitbox.apache.org> References: <160399924559.19793.14863507946338344070@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: fineract-cn-interoperation X-Git-Refname: refs/heads/develop X-Git-Reftype: branch X-Git-Rev: 6157c5630eecbe597c85822a4e0c5c82e66e98df X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20201029192045.B786C820D1@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. kaze pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/fineract-cn-interoperation.git commit 6157c5630eecbe597c85822a4e0c5c82e66e98df Author: Audrey Ndum AuthorDate: Mon Oct 19 16:16:52 2020 +0100 add docker and travis build file --- Dockerfile | 36 +++++++++++++++++++++++++++ shared.gradle | 21 +++++++++++++++- travis.sh | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ travis.yml | 33 +++++++++++++++++++++++++ 4 files changed, 168 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d707ff8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +FROM openjdk:8-jdk-alpine AS builder +RUN mkdir builddir +COPY . builddir +WORKDIR builddir +RUN ./gradlew publishToMavenLocal + +FROM openjdk:8-jdk-alpine AS runner + +ARG interoperation_port=2034 + +ENV server.max-http-header-size=16384 \ + server.port=$interoperation_port \ + system.initialclientid=service-runner + +WORKDIR /tmp +COPY --from=builder /builddir/service/build/libs/service-0.1.0-BUILD-SNAPSHOT-boot.jar ./interoperation-service-boot.jar + +CMD ["java", "-jar", "interoperation-service-boot.jar"] diff --git a/shared.gradle b/shared.gradle index a547bcc..77efdc0 100644 --- a/shared.gradle +++ b/shared.gradle @@ -50,6 +50,7 @@ tasks.withType(JavaCompile) { repositories { jcenter() mavenLocal() + maven { url 'https://mifos.jfrog.io/mifos/libs-snapshot/' } } dependencyManagement { @@ -82,6 +83,22 @@ jar { duplicatesStrategy = DuplicatesStrategy.EXCLUDE } +artifactory { + contextUrl = System.getenv("ARTIFACTORY_URL") + publish { + repository { + repoKey = project.findProperty('artifactoryRepoKey') + username = System.getenv("ARTIFACTORY_USER") + password = System.getenv("ARTIFACTORY_PASSWORD") + } + + defaults { + publications ('api', 'componentTest', 'service', 'bootService') + } + } +} +artifactoryPublish.dependsOn('publishToMavenLocal') + license { header rootProject.file('../HEADER') strictCheck false @@ -90,6 +107,7 @@ license { xml = 'XML_STYLE' yml = 'SCRIPT_STYLE' yaml = 'SCRIPT_STYLE' + uxf = 'XML_STYLE' } } @@ -102,6 +120,7 @@ rat { "**/build/**", "gradlew", "gradlew.bat", - "README.md" + "README.md", + "**/.dockerignore/**" ] } diff --git a/travis.sh b/travis.sh new file mode 100644 index 0000000..d54330d --- /dev/null +++ b/travis.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +# Documentation: https://cwiki.apache.org/confluence/display/FINERACT/Fineract-CN+Artifactory + +#Exit immediately if a command exits with a non-zero status. +set -e +EXIT_STATUS=0 + +# Builds and Publishes a SNAPSHOT +function build_snapshot() { + echo -e "Building and publishing a snapshot out of branch [$TRAVIS_BRANCH]" + ./gradlew -PartifactoryRepoKey=libs-snapshot-local -DbuildInfo.build.number=${TRAVIS_COMMIT::7} artifactoryPublish --stacktrace || EXIT_STATUS=$? +} + +# Builds a Pull Request +function build_pullrequest() { + echo -e "Building pull request #$TRAVIS_PULL_REQUEST of branch [$TRAVIS_BRANCH]. Won't publish anything to Artifactory." + ./gradlew publishToMavenLocal rat || EXIT_STATUS=$? +} + +# Builds Forked (non-apache) Repository +function build_fork() { + echo -e "Building branch $TRAVIS_BRANCH of fork $TRAVIS_REPO_SLUG. Won't publish anything to Artifactory." + ./gradlew publishToMavenLocal rat || EXIT_STATUS=$? +} + +# For other branches we need to add branch name as prefix +function build_otherbranch() { + echo -e "Building a snapshot out of branch [$TRAVIS_BRANCH] and publishing it with prefix '${TRAVIS_BRANCH}-SNAPSHOT'" + ./gradlew -PartifactoryRepoKey=libs-snapshot-local -DbuildInfo.build.number=${TRAVIS_COMMIT::7} -PexternalVersion=${TRAVIS_BRANCH}-SNAPSHOT artifactoryPublish --stacktrace || EXIT_STATUS=$? +} + +# Builds and Publishes a Tag +function build_tag() { + echo -e "Building tag [$TRAVIS_TAG] and publishing it as a release" + ./gradlew -PartifactoryRepoKey=libs-release-local -PexternalVersion=$TRAVIS_TAG artifactoryPublish --stacktrace || EXIT_STATUS=$? + +} + +echo -e "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG" +echo -e "TRAVIS_BRANCH=$TRAVIS_BRANCH" +echo -e "TRAVIS_TAG=$TRAVIS_TAG" +echo -e "TRAVIS_COMMIT=${TRAVIS_COMMIT::7}" +echo -e "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" + +if [[ $TRAVIS_REPO_SLUG != apache* ]]; then + build_fork +elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + build_pullrequest +elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ]; then + build_otherbranch +elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ]; then + build_snapshot +elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then + build_tag +else + echo -e "WARN: Unexpected env variable values => Branch [$TRAVIS_BRANCH], Tag [$TRAVIS_TAG], Pull Request [#$TRAVIS_PULL_REQUEST]" + ./gradlew clean build +fi + +exit ${EXIT_STATUS} diff --git a/travis.yml b/travis.yml new file mode 100644 index 0000000..af12f46 --- /dev/null +++ b/travis.yml @@ -0,0 +1,33 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +language: java +sudo: false +jdk: + - openjdk8 +install: true +script: "./travis.sh" +env: + global: + - BUILD_SNAPSHOTS_BRANCH=develop + - ARTIFACTORY_URL=https://mifos.jfrog.io/mifos + - ARTIFACTORY_USER=travis-ci + - secure: "E5IyImya7x5cHLB1vGLGIJUC1M+7RxKZivb5iUM+RR/xW39/7b4Qd3JeX4yBUeiPjf9lNMMxcGVyqI/4htT95++WCNc0u6OoxwGgxQEB9JHE8OWecaYgK4uLO7+651XF4DNbSiH3NVmc2b8Q0c0jBlu3MHAeEUIQ6BOiTXSsqnewtWAW0XETBooNmo2nTqZyKvzez0698oJuuYfZeFbqm8wJ9rIwtptyJluRzqcTlzw1cH/CvcIskLDmITVqbuZxAW59j1BqUnZNQpuOFZ692iqntdxq78CxliCG1MEYy4zWY8xcIWNVp28OKkMULXdi+V80oZXY4TyTwZfH6e2oZFz6/X9GpNNR6EwaHV0tT3wZi2NrkoBokD8bEBxQubIgxDCaDAFG9VMByC+++nwm0GJzerKBV4CpNSy/93XLrFAQ8+lOVauVtkVHuzFBWleLLQYcBGAXRz/C/UF4/m0m014jvD7vT [...] +after_failure: + - ./gradlew rat + - cat api/build/reports/rat/rat-report.txt