openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrutkow...@apache.org
Subject [incubator-openwhisk-release] branch master updated: Create the basic Travis environment (#1)
Date Mon, 22 Jan 2018 21:49:26 GMT
This is an automated email from the ASF dual-hosted git repository.

mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-release.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c292fa  Create the basic Travis environment (#1)
8c292fa is described below

commit 8c292fad2a938bfea0083d067ff7f242844af5fa
Author: Vincent <shou@us.ibm.com>
AuthorDate: Mon Jan 22 16:49:24 2018 -0500

    Create the basic Travis environment (#1)
    
    This PR empowers the project with the following features:
    
    * Add the support to define the list of repos to be released
    and the hash value to be picked for each repo in a config file of
    JSON format define the hash value
    
    * Download the repos based on the definitions in the config file.
    
    * Install openwhisk based on the dowloaded source code, build the
    binaries for CLI and wskdeploy.
---
 .travis.yml                          | 24 +++++++++++++++++++
 Dockerfile                           |  2 ++
 tools/travis/cleanup.sh              |  8 +++++++
 tools/travis/config.json             | 24 +++++++++++++++++++
 tools/travis/download_source_code.sh | 36 +++++++++++++++++++++++++++++
 tools/travis/package_source_code.sh  | 11 +++++++++
 tools/travis/setup.sh                | 45 ++++++++++++++++++++++++++++++++++++
 tools/travis/util.sh                 | 11 +++++++++
 tools/travis/verify_source_code.sh   |  9 ++++++++
 9 files changed, 170 insertions(+)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2cd1331
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+sudo: required
+
+group: deprecated-2017Q3
+
+language: scala
+
+scala:
+   - 2.11.8
+
+services:
+  - docker
+
+jobs:
+  include:
+    - stage: verify source code
+      script: ./tools/travis/verify_source_code.sh
+    - stage: deploy
+      script: ./tools/travis/setup.sh
+    - stage: package
+      script: ./tools/travis/package_source_code.sh
+
+after_failure:
+  - echo "failed build"
+  - ./tools/travis/cleanup.sh
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..2679754
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,2 @@
+FROM ubuntu
+RUN echo "Hello, Docker setup!" > hello.txt
\ No newline at end of file
diff --git a/tools/travis/cleanup.sh b/tools/travis/cleanup.sh
new file mode 100755
index 0000000..460e995
--- /dev/null
+++ b/tools/travis/cleanup.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+SUFFIX="$TRAVIS_BUILD_NUMBER"
+PR_NUM="$TRAVIS_PULL_REQUEST"
+
+mkdir -p ~/docker
+cd ~/docker
+ls
+rm *.tar
diff --git a/tools/travis/config.json b/tools/travis/config.json
new file mode 100644
index 0000000..5226aa9
--- /dev/null
+++ b/tools/travis/config.json
@@ -0,0 +1,24 @@
+{
+  "RepoList": [
+    "incubator-openwhisk",
+    "incubator-openwhisk-catalog",
+    "incubator-openwhisk-runtime-nodejs",
+    "incubator-openwhisk-cli",
+    "incubator-openwhisk-wskdeploy"
+  ],
+  "incubator_openwhisk": {
+    "hash": "fc98e9a"
+  },
+  "incubator_openwhisk_catalog": {
+    "hash": "ad24d4c"
+  },
+  "incubator_openwhisk_runtime_nodejs": {
+    "hash": "1c6c5db"
+  },
+  "incubator_openwhisk_cli": {
+    "hash": "7b78091"
+  },
+  "incubator_openwhisk_wskdeploy": {
+    "hash": "9840db4"
+  }
+}
diff --git a/tools/travis/download_source_code.sh b/tools/travis/download_source_code.sh
new file mode 100755
index 0000000..8a2cdf1
--- /dev/null
+++ b/tools/travis/download_source_code.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+set -e
+
+sudo apt-get install jq
+
+HOMEDIR="$(dirname "$TRAVIS_BUILD_DIR")"
+OPENWHISKDIR="$HOMEDIR/openwhisk"
+source "$TRAVIS_BUILD_DIR/tools/travis/util.sh"
+
+clone_depth=${1:-"10"}
+
+function git_clone_repo() {
+    PROJECT_NAME=$1
+    HASH=$2
+    git clone --depth $clone_depth https://github.com/apache/$PROJECT_NAME.git $OPENWHISKDIR/$PROJECT_NAME
+    cd $OPENWHISKDIR/$PROJECT_NAME
+    git reset --hard $HASH
+    rm -rf .git
+}
+
+rm -rf $OPENWHISKDIR/*
+
+CONFIG=$(read_file $TRAVIS_BUILD_DIR/tools/travis/config.json)
+repos=$(echo $(json_by_key "$CONFIG" "RepoList") | sed 's/[][]//g')
+
+for repo in $(echo $repos | sed "s/,/ /g")
+do
+    repo_name=$(echo "$repo" | sed -e 's/^"//' -e 's/"$//')
+    HASH_KEY=${repo_name//-/_}.hash
+    HASH=$(json_by_key "$CONFIG" $HASH_KEY)
+    if [ "$HASH" != "null" ]; then
+        echo "The hash for $repo_name is $HASH"
+        git_clone_repo $repo_name $HASH
+    fi
+done
diff --git a/tools/travis/package_source_code.sh b/tools/travis/package_source_code.sh
new file mode 100755
index 0000000..62df67e
--- /dev/null
+++ b/tools/travis/package_source_code.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -e
+
+cd $TRAVIS_BUILD_DIR
+./tools/travis/download_source_code.sh
+
+# TODO: add release note and license file if necessary
+echo "add release note and license file if necessary"
+
+# TODO: package all the source code and upload them into the designated directory
diff --git a/tools/travis/setup.sh b/tools/travis/setup.sh
new file mode 100755
index 0000000..d79c58c
--- /dev/null
+++ b/tools/travis/setup.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+set -e
+
+echo "hello openwhisk release"
+
+# Define the parent directory of TRAVIS_BUILD_DIR(the directory of the current repository)
as HOMEDIR
+HOMEDIR="$(dirname "$TRAVIS_BUILD_DIR")"
+OPENWHISKDIR="$HOMEDIR/openwhisk"
+SUFFIX="$TRAVIS_BUILD_NUMBER"
+PR_NUM="$TRAVIS_PULL_REQUEST"
+PREFIX="build_testing"
+
+export OPENWHISK_HOME="$OPENWHISKDIR/incubator-openwhisk";
+
+mkdir -p $OPENWHISKDIR
+cd $OPENWHISKDIR
+
+echo "list images in setup before build"
+docker images
+
+cd $TRAVIS_BUILD_DIR
+./tools/travis/download_source_code.sh
+
+cd $OPENWHISKDIR/incubator-openwhisk
+./tools/travis/setup.sh
+TERM=dumb ./gradlew core:controller:distDocker core:invoker:distDocker -PdockerImagePrefix=$PREFIX
+
+cd ansible
+ANSIBLE_CMD="ansible-playbook -i environments/local -e docker_image_prefix=$PREFIX"
+$ANSIBLE_CMD setup.yml
+$ANSIBLE_CMD prereq.yml
+$ANSIBLE_CMD couchdb.yml
+$ANSIBLE_CMD initdb.yml
+$ANSIBLE_CMD apigateway.yml
+$ANSIBLE_CMD wipe.yml
+$ANSIBLE_CMD openwhisk.yml
+
+# Build the binaries for CLI
+cd $OPENWHISKDIR/incubator-openwhisk-cli
+./gradlew buildBinaries -PcrossCompileCLI=true
+
+# Build the binaries for wskdeploy
+cd $OPENWHISKDIR/incubator-openwhisk-wskdeploy
+./gradlew distDocker -PcrossCompileWSKDEPLOY=true
diff --git a/tools/travis/util.sh b/tools/travis/util.sh
new file mode 100755
index 0000000..7654c40
--- /dev/null
+++ b/tools/travis/util.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+function read_file() {
+    cat $1
+}
+
+function json_by_key() {
+    input=$1
+    key=$2
+    echo $input | jq ''.$key'' | sed -e 's/^"//' -e 's/"$//'
+}
diff --git a/tools/travis/verify_source_code.sh b/tools/travis/verify_source_code.sh
new file mode 100755
index 0000000..ef1e1a6
--- /dev/null
+++ b/tools/travis/verify_source_code.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+set -e
+
+cd $TRAVIS_BUILD_DIR
+./tools/travis/download_source_code.sh
+
+# TODO: verify the source code headers
+echo "TODO: verify the source code headers"

-- 
To stop receiving notification emails like this one, please contact
mrutkowski@apache.org.

Mime
View raw message