houshengbo closed pull request #2: Set up the Travis
URL: https://github.com/apache/incubator-openwhisk-release/pull/2
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..4acbb15
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,57 @@
+sudo: required
+
+group: deprecated-2017Q3
+
+language: scala
+scala:
+   - 2.11.8
+
+services:
+  - docker
+
+#install:
+#  - ./tools/travis/setup.sh
+
+#script:
+#  - travis_wait 66 ./tools/travis/build.sh
+
+
+#    mkdir -p $HOME/docker && docker images -a --filter='dangling=false' 
--format '{{.Repository}}:{{.Tag}} {{.ID}}'
+#    | xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | 
gzip -2 > $HOME/docker/$1.tar.gz'
+
+cache:
+  directories:
+    - $HOME/docker
+
+#before_install:
+  # Load cached docker images
+#  - if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} 
sh -c "zcat {file} | docker load"; fi
+
+#dependencies:
+#  cache_directories:
+#    - "~/docker"
+
+#  override:
+#    - if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; 
fi
+    #- docker build --rm=false -t circleci/elasticsearch .
+    #- mkdir -p ~/docker; docker save circleci/elasticsearch > 
~/docker/image.tar
+
+#jobs:
+#  include:
+#    - stage: build docker image
+#      script:
+#      - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
+#      - docker build -t travis-ci-build-stages-demo .
+#      - docker images
+#      - docker tag travis-ci-build-stages-demo 
$DOCKER_USERNAME/travis-ci-build-stages-demo
+#      - docker push $DOCKER_USERNAME/travis-ci-build-stages-demo
+#    - stage: test
+#      script: docker run --rm $DOCKER_USERNAME/travis-ci-build-stages-demo 
cat hello.txt
+#    - script: docker run --rm $DOCKER_USERNAME/travis-ci-build-stages-demo 
cat hello.txt
+
+jobs:
+  include:
+    - stage: set up
+      script: ./tools/travis/setup.sh
+    - stage: deploy
+      script: ./tools/travis/build.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/build.sh b/tools/travis/build.sh
new file mode 100755
index 0000000..0dd22a4
--- /dev/null
+++ b/tools/travis/build.sh
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+echo "Can I sleep 60 mins?"
+
+# Build script for Travis-CI.
+#WHISKDIR="$HOMEDIR/incubator-openwhisk"
+
+#cd $WHISKDIR
+
+function parse_yaml {
+   local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
+   sed -ne "s|^\($s\):|\1|" \
+        -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
+        -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p"  $1 |
+   awk -F$fs '{
+      indent = length($1)/2;
+      vname[indent] = $2;
+      for (i in vname) {if (i > indent) {delete vname[i]}}
+      if (length($3) > 0) {
+         vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
+         printf("%s%s=\"%s\"\n", vn, $2, $3);
+      }
+   }'
+}
+
+cd $TRAVIS_BUILD_DIR/tools/travis
+parse_yaml test.yaml
+eval $(parse_yaml test.yaml)
+echo $output_file
+
+#HOMEDIR="$(dirname "$TRAVIS_BUILD_DIR")"
+#cd $HOMEDIR
+
+# Build script for Travis-CI.
+#WHISKDIR="$HOMEDIR/incubator-openwhisk"
+
+#cd $WHISKDIR
+#ls
+
+#echo "load images in build"
+#if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; fi
+
+echo "list images in build"
+docker images
\ No newline at end of file
diff --git a/tools/travis/setup.sh b/tools/travis/setup.sh
new file mode 100755
index 0000000..500349d
--- /dev/null
+++ b/tools/travis/setup.sh
@@ -0,0 +1,114 @@
+#!/usr/bin/env bash
+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"
+export OPENWHISK_HOME="$OPENWHISKDIR/incubator-openwhisk";
+
+#function clone_repo {
+#}
+
+# Clone the OpenWhisk code
+
+# TO do: clone all the repos to be released based on a commit hash
+# All the source code is going to be put under the directory $HOMEDIR/openwhisk
+mkdir -p $OPENWHISKDIR
+cd $OPENWHISKDIR
+
+echo "list images in setup before build"
+docker images
+
+# Download the openwhisk core components.
+git clone --depth 10 https://github.com/apache/incubator-openwhisk.git
+cd incubator-openwhisk
+git reset --hard 3fdea43
+cd ..
+
+# Download the openwhisk catalog.
+git clone --depth 10 https://github.com/apache/incubator-openwhisk-catalog.git
+cd incubator-openwhisk-catalog
+git reset --hard ad24d4c
+cd ..
+
+# Download the openwhisk runtime nodejs.
+git clone https://github.com/apache/incubator-openwhisk-runtime-nodejs.git
+cd incubator-openwhisk-runtime-nodejs
+git reset --hard 1c6c5db
+cd ..
+
+# Download the openwhisk CLI.
+git clone https://github.com/apache/incubator-openwhisk-cli.git
+cd incubator-openwhisk-cli
+git reset --hard 7b78091
+cd ..
+
+# To do: build the invoker, controller, runtime images, etc.
+# Build the core openwhisk.
+cd $OPENWHISKDIR/incubator-openwhisk
+#./gradlew core:controller:distDocker
+#./gradlew core:invoker:distDocker
+
+# Build the runtime nodejs.
+cd $OPENWHISKDIR/incubator-openwhisk-runtime-nodejs
+#./gradlew core:nodejs6Action:distDocker
+
+# Build the CLI binaries.
+cd $OPENWHISKDIR/incubator-openwhisk-cli
+#./gradlew buildBinaries -PcrossCompileCLI=true
+
+# To do: build the source code in one docker image
+cd $OPENWHISKDIR
+ls
+
+# Generate Dockerfile
+echo "FROM scratch" >> Dockerfile
+echo "ADD . /openwhisk" >> Dockerfile
+docker build --rm=false -t houshengbo/sourcecode .
+
+# To do: save all the images in the cache directory ~/docker/.
+
+
+echo "$TRAVIS_BUILD_DIR"
+echo "$HOMEDIR"
+
+echo "load images in setup"
+if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; fi
+
+echo "list images in setup"
+docker images
+
+echo "build the image"
+cd $TRAVIS_BUILD_DIR
+docker build --rm=false -t houshengbo/test .
+
+# Build script for Travis-CI.
+WHISKDIR="$HOMEDIR/incubator-openwhisk"
+
+cd $WHISKDIR
+#./gradlew distDocker
+
+
+
+
+mkdir -p ~/docker; docker save houshengbo/test > ~/docker/image.tar
+echo "cache images here"
+
+#./tools/travis/setup.sh
+
+#ANSIBLE_CMD="ansible-playbook -i environments/local -e 
docker_image_prefix=testing"
+#TERM=dumb ./gradlew distDocker -PdockerImagePrefix=testing
+
+#cd $WHISKDIR/ansible
+#$ANSIBLE_CMD setup.yml
+#$ANSIBLE_CMD prereq.yml
+#$ANSIBLE_CMD couchdb.yml
+#$ANSIBLE_CMD initdb.yml
+#$ANSIBLE_CMD apigateway.yml
+
+#cd $TRAVIS_BUILD_DIR
+#TERM=dumb ./gradlew buildBinaries
+
+#cd $WHISKDIR/ansible
+#$ANSIBLE_CMD wipe.yml
+#$ANSIBLE_CMD openwhisk.yml
diff --git a/tools/travis/test.yaml b/tools/travis/test.yaml
new file mode 100644
index 0000000..c3947f8
--- /dev/null
+++ b/tools/travis/test.yaml
@@ -0,0 +1,10 @@
+global:
+  debug: yes
+  verbose: no
+  debugging:
+    detailed: "no"
+    header: "debugging started"
+
+## output
+output:
+  file: "yes"
\ No newline at end of file


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to