You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by du...@apache.org on 2018/01/22 18:21:07 UTC
[incubator-openwhisk-cli] branch master updated: Create tarball for
Nginx container in OpenWhisk as part of release deploy script (#184)
This is an automated email from the ASF dual-hosted git repository.
dubeejw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git
The following commit(s) were added to refs/heads/master by this push:
new 6fbc0bb Create tarball for Nginx container in OpenWhisk as part of release deploy script (#184)
6fbc0bb is described below
commit 6fbc0bb09e4be936d05a397863e9c83b65835cd6
Author: Jonathan Springer <jo...@gmail.com>
AuthorDate: Mon Jan 22 13:21:04 2018 -0500
Create tarball for Nginx container in OpenWhisk as part of release deploy script (#184)
* Set up Gradle build w/o Docker
* Add custom platform build documentation.
* Remove scancode scripts; go get golint
* Use build.gradle to control dependency versions.
* Factor away need for the bin/ directory
* Use dynamic GOPATH to find golint install.
* Add --console=plain and README edits.
---
.gitignore | 11 +-
.travis.yml | 42 ++---
Dockerfile | 27 ---
Godeps/Godeps.json | 71 --------
Godeps/Readme | 5 -
Makefile | 52 ------
README.md | 157 +++++++++++------
build.gradle | 323 +++++++++++++++++++++++++++-------
build.sh | 105 -----------
gradle.properties | 1 +
gradle/docker.gradle | 6 +-
settings.gradle | 27 ++-
tests/src/integration/common/utils.go | 10 ++
tests/src/integration/common/wsk.go | 2 +-
tests/src/integration/dummy.go | 18 ++
tools/travis/build_tag_releases.sh | 38 ----
tools/travis/scancode.sh | 11 --
tools/travis/setupscan.sh | 8 -
tools/travis/test_openwhisk.sh | 98 +++++++----
19 files changed, 517 insertions(+), 495 deletions(-)
diff --git a/.gitignore b/.gitignore
index fa48daa..c1d724d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,16 @@
javascript/
wsk
+wsk.exe
scripts
Godeps/_workspace
+
+# IDE-related exclusions
.idea/
*.iml
-.gradle
+
+# Gradle build working directories
+/.gradle/
+/.gogradle/
+/build/
+/release/
+/vendor/
diff --git a/.travis.yml b/.travis.yml
index 85df853..d6da2dd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,30 +8,36 @@ matrix:
sudo: required
group: deprecated-2017Q3
go: 1.8
- env:
- secure: "Br0fD9CAKm8gqyEuwmltNJd4dGJCxPpj6feugHlO+CFFwfE/+kJKkpTlsDuRfrUzUDlWiETNPf0XGSjvPFqZExnLCE9XQh2+XF6u+S3YBWfM+rbbyRVAK6BlTwmt0u3jRJ2JP7spedTGZA+qfIWI+UkwoOexo7NcqtMPLahiZzheaaad8y3J+crHQCrB/kPrhLqKVMEOkIbveFdfV2QLfCOWgqP8e1LGZhPZ2N4QcNo0iB5uI4ZyYszTZDniXFKxz7kBs4tl4ZQDqRHqL02qKPsjbvjrZp83ql+PbC2dpgXi9YpaDuBEqKKX1rTQP5ppcwbobot5U3ItHWzpXbLCdsWxvbde/0enjMmOF1wwl71hPYIf7PkQmNAWXRtL2Z1TguO/dKCeXBLDER4YDQ79GYpikAMqnrRLou4rsyZrNUzg8aHbELzAHppDSpqEJN8ymGgWgmWBT8yPaWVwN5CjPFO [...]
services: docker
+env:
+ secure: "Br0fD9CAKm8gqyEuwmltNJd4dGJCxPpj6feugHlO+CFFwfE/+kJKkpTlsDuRfrUzUDlWiETNPf0XGSjvPFqZExnLCE9XQh2+XF6u+S3YBWfM+rbbyRVAK6BlTwmt0u3jRJ2JP7spedTGZA+qfIWI+UkwoOexo7NcqtMPLahiZzheaaad8y3J+crHQCrB/kPrhLqKVMEOkIbveFdfV2QLfCOWgqP8e1LGZhPZ2N4QcNo0iB5uI4ZyYszTZDniXFKxz7kBs4tl4ZQDqRHqL02qKPsjbvjrZp83ql+PbC2dpgXi9YpaDuBEqKKX1rTQP5ppcwbobot5U3ItHWzpXbLCdsWxvbde/0enjMmOF1wwl71hPYIf7PkQmNAWXRtL2Z1TguO/dKCeXBLDER4YDQ79GYpikAMqnrRLou4rsyZrNUzg8aHbELzAHppDSpqEJN8ymGgWgmWBT8yPaWVwN5CjPFOxLPrVEOb [...]
+ global:
+ - build_file_name=wsk
+ - zip_file_name=OpenWhisk_CLI
git:
depth: 3
before_install:
- - pip install --upgrade pip setuptools
+ - export DEPLOY_BUILD_READY=false
install:
- - ./tools/travis/setupscan.sh
- - export DEPLOY_BUILD_READY=false
- - go get -u github.com/golang/lint/golint
- - go get -u github.com/stretchr/testify
- - go get -u github.com/spf13/viper
- - go get -u github.com/tools/godep
+ - cd $TRAVIS_BUILD_DIR/..
+ - pip install --upgrade pip setuptools
+ - git clone https://github.com/jonpspri/gogradle.git
+ - cd gogradle && ./gradlew --console=plain assemble
+
+before_script:
+ - cd $TRAVIS_BUILD_DIR/..
+ - git clone https://github.com/apache/incubator-openwhisk-utilities.git
+ - git clone https://github.com/apache/incubator-openwhisk.git
+ - ./incubator-openwhisk/tools/travis/setup.sh
script:
+ - cd $TRAVIS_BUILD_DIR
+ - ./gradlew --console=plain release
- ./tools/travis/test_openwhisk.sh
-after_script:
- - make clean
-
after_success:
- DEPLOY_BUILD_READY=true
# This tag is automatically generated for the latest merged commit in master branch.
@@ -45,13 +51,7 @@ after_success:
fi
before_deploy:
- - go get github.com/inconshreveable/mousetrap
- - go get github.com/mattn/go-isatty
- - export build_file_name=wsk
- - export zip_file_name=OpenWhisk_CLI
- - chmod +x tools/travis/build_tag_releases.sh
- - ./tools/travis/build_tag_releases.sh $build_file_name $zip_file_name
- - export RELEASE_PKG_FILE=$(ls $zip_file_name-*.*)
+ - export RELEASE_PKG_FILE=$(cd './release' && ls "${zip_file_name}-*.tgz" "${zip_file_name}-*.zip")
- echo "Deploying $RELEASE_PKG_FILE to GitHub releases."
deploy:
@@ -59,7 +59,9 @@ deploy:
api_key:
secure: Yh1aYiM/qIWkPMSVjGUq1g9TjpACjavQ00QAqp4oqghNZc6xBcmdzsfD2VjzVPHleNI1FIZyjJ1x6laRfWBzRkAcJcjUHXA2bO/V0jqePVmgVm75WwTZ/9EaWIJeAg5CQMm5DGS28Yhc60C0ut3ZzKMWGTiKb73UADXPTGd/tjndxjfksX/THXPuInKB9QZesmluBAC2am/x/6J311WA2wqe0p1+9JFwMr8XwIcwzCwgi/d9CFpS1RnVpLE/ORSgmN/dFbZ7A/qVbx377QoxKiEB0jmUwi13f7REFAw18JdgzbQCH3X4HNu9pCJwHEAq3lP2CfmHbAXcViBeji/Xh9PPJVV9TYqO+uT8oPxCPJND1A/3O2xJ8LyZ/FP2bWqG/Ds/8SZCvxfOR/X77opUeZ4qAp7HJMVCsFi3TsnmzxCe0BOxCppVJLhoSZ2rOAPJi9mKgS/Z/VA5VhNNmnPtkReEWK4vT9h3 [...]
file_glob: true
- file: ${zip_file_name}-*.*
+ file:
+ - release/${zip_file_name}-*.tgz
+ - release/${zip_file_name}-*.zip
overwrite: true
skip_cleanup: true
on:
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index bedb6f7..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,27 +0,0 @@
-FROM golang:1.8
-
-# Install zip
-RUN apt-get -y update && \
- apt-get -y install zip
-
-ENV GOPATH=/
-
-# Download and install tools
-RUN echo "Installing the godep tool"
-RUN go get github.com/tools/godep
-
-ADD . /src/github.com/apache/incubator-openwhisk-cli
-
-# Load all of the dependencies from the previously generated/saved godep generated godeps.json file
-RUN echo "Restoring Go dependencies"
-RUN cd /src/github.com/apache/incubator-openwhisk-cli && /bin/godep restore -v
-
-# wsk binary will be placed under a build folder
-RUN mkdir /src/github.com/apache/incubator-openwhisk-cli/build
-
-ARG CLI_OS
-ARG CLI_ARCH
-
-# Build the Go wsk CLI binaries and compress resultant binaries
-RUN chmod +x /src/github.com/apache/incubator-openwhisk-cli/build.sh
-RUN cd /src/github.com/apache/incubator-openwhisk-cli && ./build.sh
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
deleted file mode 100644
index dc56dda..0000000
--- a/Godeps/Godeps.json
+++ /dev/null
@@ -1,71 +0,0 @@
-{
- "ImportPath": "github.com/apache/incubator-openwhisk-cli",
- "GoVersion": "go1.",
- "GodepVersion": "v74",
- "Deps": [
- {
- "ImportPath": "github.com/cloudfoundry/jibber_jabber",
- "Rev": "bcc4c8345a21301bf47c032ff42dd1aae2fe3027"
- },
- {
- "ImportPath": "github.com/fatih/color",
- "Comment": "v0.1-19-g87d4004",
- "Rev": "87d4004f2ab62d0d255e0a38f1680aa534549fe3"
- },
- {
- "ImportPath": "github.com/google/go-querystring/query",
- "Rev": "9235644dd9e52eeae6fa48efd539fdc351a0af53"
- },
- {
- "ImportPath": "github.com/hokaccha/go-prettyjson",
- "Rev": "f75235bd99dad4e98ff360db8372d5c0ef1d054a"
- },
- {
- "ImportPath": "github.com/inconshreveable/mousetrap",
- "Rev": "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
- },
- {
- "ImportPath": "github.com/mattn/go-colorable",
- "Comment": "v0.0.6-9-gd228849",
- "Rev": "d228849504861217f796da67fae4f6e347643f15"
- },
- {
- "ImportPath": "github.com/mattn/go-isatty",
- "Rev": "66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8"
- },
- {
- "ImportPath": "github.com/mitchellh/go-homedir",
- "Rev": "1111e456ffea841564ac0fa5f69c26ef44dafec9"
- },
- {
- "ImportPath": "github.com/nicksnyder/go-i18n/i18n/...",
- "Comment": "v1.4.0",
- "Rev": "37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3"
- },
- {
- "ImportPath": "github.com/spf13/cobra",
- "Rev": "1238ba19d24b0b9ceee2094e1cb31947d45c3e86"
- },
- {
- "ImportPath": "github.com/spf13/pflag",
- "Rev": "367864438f1b1a3c7db4da06a2f55b144e6784e0"
- },
- {
- "ImportPath": "golang.org/x/sys/unix",
- "Rev": "7f918dd405547ecb864d14a8ecbbfe205b5f930f"
- },
- {
- "ImportPath": "gopkg.in/yaml.v2",
- "Rev": "cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b"
- },
- {
- "ImportPath": "github.com/ghodss/yaml",
- "Comment": "v1.0.0",
- "Rev": "0ca9ea5df5451ffdf184b4428c902747c2c11cd7"
- },
- {
- "ImportPath": "github.com/apache/incubator-openwhisk-client-go/whisk",
- "Rev": "ba3bbee442357a239667ef6de378d5b7d33e0ceb"
- }
- ]
-}
diff --git a/Godeps/Readme b/Godeps/Readme
deleted file mode 100644
index 4cdaa53..0000000
--- a/Godeps/Readme
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory tree is generated automatically by godep.
-
-Please do not edit.
-
-See https://github.com/tools/godep for more information.
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 5425c77..0000000
--- a/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-SOURCEDIR=.
-
-SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
-BINARY=wsk
-
-VERSION=1.0.0
-
-BUILD=`git rev-parse HEAD`
-
-deps:
- @echo "Installing dependencies"
- godep restore -v
-
-LDFLAGS=-ldflags "-X main.CLI_BUILD_TIME=`date -u '+%Y-%m-%dT%H:%M:%S%:z'`"
-
-updatedeps:
- @echo "Updating all dependencies"
- @go get -d -u -f -fix -t ./...
-
-# Build the project
-build: deps
- go build ${LDFLAGS} -o ${BINARY}
-
-test:
- @echo "Launch the unit tests."
- go test ./... -tags=unit
-
-native_test:
- @echo "Launch the native tests for the commands."
- go test -v ./... -tags=native
-
-# Run the integration test against OpenWhisk
-integration_test:
- @echo "Launch the integration tests."
- go test -v ./... -tags=integration
-
-format:
- @echo "Formatting"
- go fmt ./...
-
-lint: format
- @echo "Linting"
- golint .
-
-install:
- go install
-
-# Cleans our project: deletes binaries
-clean:
- if [ -f ${BINARY} ] ; then rm ${BINARY}; fi
-
-.PHONY: clean install
diff --git a/README.md b/README.md
index b2bba77..83f566e 100644
--- a/README.md
+++ b/README.md
@@ -4,110 +4,161 @@
# Disclaimer
-This project is currently on an experimental stage. We periodically synchronize the source code and test cases of this
-repository with the [CLI folder](https://github.com/apache/incubator-openwhisk/tree/master/tools/cli/go-whisk-cli) and the [test folder](https://github.com/apache/incubator-openwhisk/tree/master/tests) in OpenWhisk. The framework of test cases is under construction
-for this repository. Please contribute to the [CLI folder](https://github.com/apache/incubator-openwhisk/tree/master/tools/cli/go-whisk-cli) in OpenWhisk for any CLI changes, before we officially announce the separation
+This project is currently on an experimental stage. We periodically synchronize
+the source code and test cases of this repository with the [CLI
+folder](https://github.com/apache/incubator-openwhisk/tree/master/tools/cli/go-whisk-cli)
+and the [test
+folder](https://github.com/apache/incubator-openwhisk/tree/master/tests) in
+OpenWhisk. The framework of test cases is under construction for this
+repository. Please contribute to the [CLI
+folder](https://github.com/apache/incubator-openwhisk/tree/master/tools/cli/go-whisk-cli)
+in OpenWhisk for any CLI changes, before we officially announce the separation
of OpenWhisk CLI from OpenWhisk.
+The OpenWhisk Command Line Interface (OpenWhisk CLI) is a unified tool that
+provides a consistent interface to interact with OpenWhisk services. With this
+tool to download and configure, you are able to manage OpenWhisk services from
+the command line and automate them through scripts.
-The OpenWhisk Command Line Interface (OpenWhisk CLI) is a unified tool that provides a consistent interface to
-interact with OpenWhisk services. With this tool to download and configure, you are able to manage OpenWhisk services
-from the command line and automate them through scripts.
+# Where to download the binary of OpenWhisk CLI
+The OpenWhisk CLI is available on the release page: [click here to
+download](https://github.com/apache/incubator-openwhisk-cli/releases). We
+currently have binaries available for Linux, Mac OS and Windows under i386 and
+amd64 architectures. Linux versions are also available under Linux on Z, Power
+and 64-bit ARM architectures. You can download the binary, which fits your
+local environment.
-# Where to download the binary of OpenWhisk CLI
+# How to build the binary locally
-The OpenWhisk CLI is available on the release page: [click here to download](https://github.com/apache/incubator-openwhisk-cli/releases).
-We currently have binaries available for Linux, Mac OS and windows under amd64 architecture. You can download the
-binary, which fits your local environment.
+The OpenWhisk CLI is written in the Go language. You have two options to build
+the binary locally:
+1. Build using the packaged Gradle scripts (including the 'gogradle' plugin),
+now the preferred build method.
+2. Compile in your local Go environment,
-# How to build the binary locally
+## Build the binary with Gradle
-You can also choose to build the binaries locally from the source code with Go tool.
+**Note:** For those who may have used the Gradle build previously, it has been
+re-engineered to no longer required Docker or Go to be pre-installed on your
+system. Using the [gogradle](https://github.com/gogradle/gogradle) plugin,
+Gradle now uses a prexisting Go environment to build if it can be located, or
+downloads and installs an environment within the build directory.
-Make sure that you have Go installed [installing Go](https://golang.org/doc/install), and `$GOPATH` is defined [Go development environment](https://golang.org/doc/code.html).
+To build with Gradle, open an terminal, go to the directory of OpenWhisk CLI
+home directory, and build the binary via the following command under Linux or
+Mac:
+
+```
+$ ./gradlew compile -PnativeCompile
+```
-Then download the source code of the OpenWhisk CLI and the dependencies by typing:
+or run the following command for Windows:
```
-$ cd $GOPATH
-$ go get github.com/apache/incubator-openwhisk-cli
+$ ./gradlew.bat compile -PnativeCompile
```
+After the build, you can find the binary `wsk` or `wsk.exe` in the build folder
+under the OpenWhisk CLI home directory. In addition, it is also available under
+the folder `build/<os>-<architecture>/`. For example, if your local operating
+system is Mac, and the CPU architecture is amd64, the binary can be found at
+`build/mac-amd64/wsk` and `build/mac`.
+
+If you would like to build the binaries available for all the operating systems
+and architectures, run the following command:
+
+```
+$ ./gradlew compile
+```
-## Build the binary with Go
+The build script will place the binaries into the folder `build/<os>-<cpu arc>/`
+for each operating system and CPU architecture pair. The build supports both
+amd64 and 386 for Linux, Mac and Windows operating systems, as well as Power,
+64-bit ARM, and S390X architectures for Linux.
-Open an terminal, go to the directory of OpenWhisk CLI home directory, and build the binary via the following command:
+A binary compatible with the local architecture will be placed at `build/wsk`
+(`build\wsk.exe` on Windows).
+
+To specify a build for specific architectures, you can provide a comma or
+space-delimited list of hyphenated os-architecture pairs, like this:
```
-$ go build -o wsk
+$ ./gradlew compile -PbuildPlatforms=linux-amd64,mac-amd64,windows-amd64
```
-If you would like to build the binary for a specific operating system, you may add the arguments GOOS and
-GOARCH into the Go build command. Since it is only applicable under amd64 architecture, you have to set GOARCH
-to amd64. GOOS can be set to "linux" "darwin" or "windows".
+The build library understands most representations of most Operating Systems.
-For example, run the following command to build the binary for Linux:
+Tests can be run using the Gradle script as well:
```
-$ GOOS=linux GOARCH=amd64 go build -o wsk
+$ ./gradlew goTests -PgoTags=unit
+$ ./gradlew goTests -PgoTags=native
```
-If it is executed successfully, you can find your binary `wsk` directly under OpenWhisk CLI home directory.
+Integration tests are best left to the Travis build as they depend on a fully
+functional OpenWhisk environment.
-## Build the binary with Docker and Gradle
+## Compile the binary using your local Go environment
-This is the second choice for you to build the binary. Make sure that you have Docker and gradle on your machine:
-[installing Docker](https://docs.docker.com/engine/installation/) and [installing Gradle](https://gradle.org/install) for your local machine.
+Make sure that you have Go installed [installing
+Go](https://golang.org/doc/install), and `$GOPATH` is defined [Go development
+environment](https://golang.org/doc/code.html).
-After that, open an terminal, go to the directory of OpenWhisk CLI home directory, and
-build the binary via the following command under Linux or Mac:
+Then download the source code of the OpenWhisk CLI and the dependencies by
+typing:
```
-$ ./gradlew buildBinaries
+$ cd $GOPATH
+$ go get github.com/apache/incubator-openwhisk-cli
+$ cd $GOPATH/src/github.com/apache/incubator-openwhisk-cli
```
-or run the following command for Windows:
+Unfortunately, it has become necessary to lock dependencies versions to obtain a
+clean build of wsk. To that end, it's now necessary to populate the `vendors`
+folder using the versions selected in the `build.gradle`:
```
-$ ./gradlew.bat buildBinaries
+$ ./gradlew goVendor
```
-Finally, you can find the binary `wsk` or `wsk.exe` in the bin folder under the OpenWhisk CLI home directory. In
-addition, it is also available under the folder bin/\<os\>/\<cpu arc\>/. For example, if your local operating system is Mac,
-and the CPU architecture is amd64, the binary and its compressed package can also be found under bin/mac/amd64/.
+Once vendor is populated, it's possible to build the binary:
-OpenWhisk CLI(`wsk`) is produced in a Docker container during the build process which is copied from the
-Docker container to the local file system in the following directory: bin. This binary will be platform
-specific, it will only run on the operating system, and CPU architecture that matches the build machine.
+```
+$ go build -o wsk
+```
+
+If you would like to build the binary for a specific operating system, you may
+add the arguments GOOS and GOARCH into the Go build command. GOOS can
+be set to "linux" "darwin" or "windows".
-If you would like to build the binaries available for all the operating systems and architectures, run the following
-command:
+For example, run the following command to build the binary for Linux:
```
-$ ./gradlew buildBinaries -PcrossCompileCLI=true
+$ GOOS=linux GOARCH=amd64 go build -o wsk-$GOOS-$GOARCH
```
-Then, you will find the binaries and their compressed packages generated under the folder bin/\<os\>/\<cpu arc\>/ for each
-operating system and CPU architecture pair. We supports both amd64 and 386 for Linux, Mac and Windows operating systems.
-
+If it is executed successfully, you can find your binary `wsk` directly under
+OpenWhisk CLI home directory.
# How to use the binary
-When you have the binary, you can copy the binary to any folder, and add folder into the system PATH in order to
-run the OpenWhisk CLI command. To get the CLI command help, execute the following command:
+When you have the binary, you can copy the binary to any folder, and add folder
+into the system PATH in order to run the OpenWhisk CLI command. To get the CLI
+command help, execute the following command:
```
$ wsk --help
```
-To get CLI command debug information, include the -d, or --debug flag when executing this command.
-
+To get CLI command debug information, include the -d, or --debug flag when
+executing this command.
# Continuous Integration
-In order to build OpenWhisk CLI binaries with good quality, OpenWhisk CLI uses Travis CI as the continuous
-delivery service for Linux and Mac. OpenWhisk CLI is a Go project. Currently Travis CI supports the environments
-of Linux and Mac, but it is not available for Windows. We will add support of AppVeyor CI in future to run the
-test cases and build the binary for Windows.
+In order to build OpenWhisk CLI binaries with good quality, OpenWhisk CLI uses
+Travis CI as the continuous delivery service for Linux and Mac. OpenWhisk CLI is
+a Go project. Currently Travis CI supports the environments of Linux and Mac,
+but it is not available for Windows. We will add support of AppVeyor CI in
+future to run the test cases and build the binary for Windows.
diff --git a/build.gradle b/build.gradle
index b2e471d..3a6d6ef 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,93 +1,290 @@
-ext.dockerImageName = "cli"
-ext.dockerContainerName = "cli"
-ext.dockerBuildArgs = getDockerBuildArgs()
-apply from: 'gradle/docker.gradle'
+/*
+ Holding these lines for when gogradle 0.8.2 is released (hopefully with
+ pull #194 (https://github.com/gogradle/gogradle/pull/194)
+plugins {
+ id 'com.github.blindpirate.gogradle' version '0.8.2'
+}
+*/
-task removeBinary(type: Delete) {
- delete "${projectDir}/bin/wsk"
- delete "${projectDir}/bin/mac"
- delete "${projectDir}/bin/linux"
- delete "${projectDir}/bin/windows"
+buildscript {
+ repositories {
+ mavenLocal()
+ jcenter()
+ }
+ dependencies {
+ classpath "org.antlr:antlr4:4.6"
+ classpath group: 'com.google.inject', name: 'guice', version: '4.1.0'
+ classpath group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
+ classpath group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
+ classpath group: 'commons-codec', name: 'commons-codec', version: '1.10'
+ classpath group: 'commons-io', name: 'commons-io', version: '2.5'
+ classpath 'com.google.guava:guava:20.0'
+ classpath 'com.github.zafarkhaja:java-semver:0.9.0'
+ classpath group: 'org.jsoup', name: 'jsoup', version: '1.7.2'
+ classpath group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.5'
+ classpath group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.8.5'
+ classpath group: 'com.google.code.findbugs', name: 'annotations', version: '3.0.1'
+ classpath group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.8.5'
+ classpath group: 'net.lingala.zip4j', name: 'zip4j', version: '1.3.2'
+ classpath group: 'org.apache.ant', name: 'ant', version: '1.10.0'
+ classpath group: 'com.typesafe.sbt', name: 'sbt-interface', version: '0.13.13'
+ classpath group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.6.3'
+ classpath group: 'org.codehaus.woodstox', name: 'woodstox-core-asl', version: '4.4.1'
+ classpath group: 'org.jooq', name: 'joor', version: '0.9.6'
+ classpath 'com.moandjiezana.toml:toml4j:0.7.2'
+ classpath files('../gogradle/build/libs/gogradle-0.8.1.jar')
+ }
}
-task distBinary(dependsOn: [removeBinary, buildBinaries]) {
- doLast {
- run(dockerBinary + ["rm", "-f", dockerContainerName], true)
- run(dockerBinary + ["run", "--name", dockerContainerName, dockerTaggedImageName])
+apply plugin: 'com.github.blindpirate.gogradle'
- // Copy all Go binaries from Docker into openwhisk/bin folder
- run(dockerBinary + ["cp", dockerContainerName +
- ":/src/github.com/apache/incubator-openwhisk-cli/build/.", "${projectDir}/bin"])
+golang {
+ packagePath = 'github.com/apache/incubator-openwhisk-cli' as String
+ buildTags = (rootProject.findProperty('goTags')?:'').split(',')
+}
- run(dockerBinary + ["rm", "-f", dockerContainerName])
+dependencies {
+ golang {
+ // BEGIN - Imported from Godeps
+ build(['name':'github.com/cloudfoundry/jibber_jabber', 'version':'bcc4c8345a21301bf47c032ff42dd1aae2fe3027', 'transitive':false])
+ build(['name':'github.com/fatih/color', 'version':'87d4004f2ab62d0d255e0a38f1680aa534549fe3', 'transitive':false])
+ build(['name':'github.com/google/go-querystring/query', 'version':'9235644dd9e52eeae6fa48efd539fdc351a0af53', 'transitive':false])
+ build(['name':'github.com/hokaccha/go-prettyjson', 'version':'f75235bd99dad4e98ff360db8372d5c0ef1d054a', 'transitive':false])
+ build(['name':'github.com/inconshreveable/mousetrap', 'version':'76626ae9c91c4f2a10f34cad8ce83ea42c93bb75', 'transitive':false])
+ build(['name':'github.com/mattn/go-colorable', 'version':'d228849504861217f796da67fae4f6e347643f15', 'transitive':false])
+ build(['name':'github.com/mattn/go-isatty', 'version':'66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8', 'transitive':false])
+ build(['name':'github.com/mitchellh/go-homedir', 'version':'1111e456ffea841564ac0fa5f69c26ef44dafec9', 'transitive':false])
+ build(['name':'github.com/nicksnyder/go-i18n/i18n/...', 'version':'37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3', 'transitive':false])
+ build(['name':'github.com/spf13/cobra', 'version':'1238ba19d24b0b9ceee2094e1cb31947d45c3e86', 'transitive':false])
+ build(['name':'github.com/spf13/pflag', 'version':'367864438f1b1a3c7db4da06a2f55b144e6784e0', 'transitive':false])
+ build(['name':'golang.org/x/sys/unix', 'version':'7f918dd405547ecb864d14a8ecbbfe205b5f930f', 'transitive':false])
+ build(['name':'gopkg.in/yaml.v2', 'version':'cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b', 'transitive':false])
+ build(['name':'github.com/ghodss/yaml', 'version':'0ca9ea5df5451ffdf184b4428c902747c2c11cd7', 'transitive':false])
+ build(['name':'github.com/apache/incubator-openwhisk-client-go/whisk','version':'ba3bbee442357a239667ef6de378d5b7d33e0ceb','transitive':false])
+ // END - Imported from Godeps
+ test name:'github.com/stretchr/testify', version:'b91bfb9ebec76498946beb6af7c0230c7cc7ba6c', transitive:false //, tag: 'v1.2.0'
+ test name:'github.com/spf13/viper', version:'aafc9e6bc7b7bb53ddaa75a5ef49a17d6e654be5', transitive:false
+ test name:'github.com/cpuguy83/go-md2man/md2man', version:'1d903dcb749992f3741d744c0f8376b4bd7eb3e1', transitive:false //, tag:'v1.0.7'
+ test name:'github.com/davecgh/go-spew/spew', version:'346938d642f2ec3594ed81d874461961cd0faa76', transitive:false //, tag:'v1.1.0'
+ test name:'github.com/pmezard/go-difflib/difflib', version:'792786c7400a136282c1664665ae0a8db921c6c2', transitive:false
}
}
-task dumpOSInfo {
- doLast {
- println "os.name = "+getOsName()
- println "os.arch = "+getOsArch()
- println "go.name = "+mapOsNameToGoName(getOsName())
- println "go.arch = "+mapOsArchToGoArch(getOsArch())
+/*
+ The OpenWhiskPlatform class is a utility class to make the rest of what
+ happens with platforms a bit more understandable. A "Platform" is a tuple
+ of an operating system and a processor. Currently, the OpenWhisk CLI
+ supports three OS's: Linux, Mac/Darwin, and Windows. It supports x86
+ (32-bit or 64-bit) on all OS's. On Linux, it also support System Z (s390x),
+ PowerPC (ppc64le), and ARM (32-bit and 64-bit) architectures.
+
+ Different contexts use different codings to refer to these architectures --
+ the class attempts to provide and interpret all needed codings. Internal
+ storage is in "GO" format:
+
+ OS: linux, darwin, windows
+ Arch: 386, amd64, s390x, ppc64le, arm
+
+ TODO - It may be appropriate to refactor into a general purpose Platform
+ class for all builds, then to extend with specifics needed for
+ the OpenWhisk CLI build.
+ */
+class OpenWhiskPlatform {
+ String goOs
+ String goArch
+
+ /*
+ The 'zipFileName' property is the root file name to use for archives.
+ */
+ static String zipFileName
+
+ /*
+ Create a platform for the local platform
+ */
+ OpenWhiskPlatform() {
+ this(System.properties['os.name'], System.properties['os.arch'])
+ }
+
+ OpenWhiskPlatform(String platformSpec) {
+ this(*platformSpec.split('-'))
+ }
+
+ OpenWhiskPlatform(String inOs, String inArch) {
+ goOs=inOs.toLowerCase()
+ .replaceAll(~/^mac.*$/,'darwin')
+ .replaceAll(~/^.*n[ui]x.*$/,'linux')
+ goArch=inArch.toLowerCase()
+ .replaceAll('x86_64','amd64')
+ .replaceAll('i386','386')
+ .replaceAll('x86_32','386')
}
-}
-task copyCLIShortcut(type: Copy, dependsOn: [distBinary, dumpOSInfo]) {
- String go_osname = mapOsNameToGoName(getOsName())
- String go_osarch = mapOsArchToGoArch(getOsArch())
- String from_path_wsk = "${projectDir}/bin/${go_osname}/${go_osarch}/wsk"
- String to_path_dir = "${projectDir}/bin"
+ /**
+ * Return the Openwhisk OS for this Platform
+ */
+ String getOwOs() {
+ ((goOs == 'darwin') ? 'mac' : goOs)
+ }
+
+ String getGoPlatform() {
+ "${goOs}-${goArch}"
+ }
+
+ /*
+ Everything below here is specific to the CLI build and could be
+ factored out into a subclass.
+ */
+ String getArchiveDirName() {
+ "${this.owOs}/${goArch}"
+ }
- from from_path_wsk
- into to_path_dir
+ String getArchiveFileName() {
+ String suffix
+ switch (goArch) {
+ case "386": suffix = '-32bit'; break;
+ case "amd64": suffix = ''; break;
+ default: suffix = "-${goArch}"; break;
+ }
+ String archivetype = (goOs == 'linux') ? 'tgz' : 'zip'
+ "${zipFileName}-${this.owOs}${suffix}.${archivetype}"
+ }
}
-pushImage.finalizedBy copyCLIShortcut
+/*
+ Configuration of OpenWhisk Platform behavior based on environment and defaults
+ */
+OpenWhiskPlatform.zipFileName =
+ System.env['zip_file_name'] ?:
+ (rootProject.findProperty('zipFileName') ?: 'OpenWhisk_CLI')
+
+String buildFileName = System.env['build_file_name'] ?:
+ (rootProject.findProperty('buildFileName') ?: 'wsk')
+
+/*
+ 'platforms' property will be null for a local compile, or a list (comma or
+ space-separated) of hyphenated Goos-Goarch pairs. Some transformation is
+ done when parsing to handle misconceptions.
-// Returns the Go CLI docker build args
-def getDockerBuildArgs() {
- String local_os = mapOsNameToGoName(getOsName())
- String local_arch = mapOsArchToGoArch(getOsArch())
- def res = []
+ TODO: More syntax/validity checking and feedback, perhaps as part of a
+ Platform object as proposed above...
+*/
+rootProject.ext.localPlatform = new OpenWhiskPlatform()
- if(!project.hasProperty('crossCompileCLI') || project.crossCompileCLI == "false") {
- res = ["CLI_OS=${local_os}", "CLI_ARCH=${local_arch}"]
+if (rootProject.hasProperty('buildPlatforms')) {
+ rootProject.ext.platforms = buildPlatforms.tokenize(' ,').collect {
+ new OpenWhiskPlatform(it)
+ }
+} else {
+ if (!rootProject.hasProperty('nativeCompile')) {
+ rootProject.ext.platforms = [
+ 'linux-386', 'linux-amd64',
+ 'linux-s390x', 'linux-ppc64le', 'linux-arm', 'linux-arm64',
+ 'darwin-386', 'darwin-amd64',
+ 'windows-386', 'windows-amd64'
+ ].collect { new OpenWhiskPlatform(it) }
} else {
- res = ["CLI_OS=mac linux windows", "CLI_ARCH=386 amd64"]
+ rootProject.ext.platforms = [ rootProject.localPlatform ]
}
+}
- return res
+/*
+ Checks -- add golint and scancode to the checks run prior to build.
+ The get step is needed to be sure a golint binary is available to run.
+ */
+task getGoLint(type: com.github.blindpirate.gogradle.Go) {
+ go 'get -u github.com/golang/lint/golint'
}
-def run(cmd, ignoreError = false) {
- println("Executing '${cmd.join(" ")}'")
- def proc = cmd.execute()
- proc.waitFor()
- if(!ignoreError && proc.exitValue() != 0) {
- println("Command '${cmd.join(" ")}' failed with exitCode ${proc.exitValue()}")
- }
+task goLint(type: com.github.blindpirate.gogradle.Go, dependsOn: getGoLint) {
+ // WARNING: The single quotes are intentional! The gogradle plugin will
+ // parse the command with the GString engine at execution time.
+ run '${GOPATH}/bin/golint ' + golang.packagePath
+}
+
+goCheck.dependsOn(goLint)
+
+goBuild {
+ targetPlatform = rootProject.platforms*.goPlatform
+ def now = new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
+
+ // WARNING: The single quotes are intentional! The gogradle plugin will
+ // parse the command with the GString engine at execution time.
+ go(['build',
+ '-ldflags', "-X main.CLI_BUILD_TIME=${now}" as String,
+ '-o', './build/${GOOS}-${GOARCH}/'+buildFileName+'${GOEXE}',
+ golang.packagePath ] as List<String>)
}
-def getOsName() {
- return System.properties['os.name']
+task compile(type: Copy, dependsOn: goBuild) {
+ destinationDir = file('./build')
+ from("./build/${rootProject.localPlatform.goOs}-${rootProject.localPlatform.goArch}")
}
-def getOsArch() {
- return System.properties['os.arch']
+/*
+ Set up the goTest task to print useful information to Stdout:
+ */
+goTest.generateTestReport = { testClassResults ->
+ testClassResults*.results.flatten()*.failures.flatten().each() { failure ->
+ logger.quiet( '-' * 40 )
+ logger.quiet(failure.message)
+ logger.quiet( '-' * 40 )
+ }
+}
+
+/*
+ For each platform, create an individual archive in a platform appropriate
+ format (tarball for Linux, zipfile for Mac & Windows).
+ */
+task individualArchives(
+ dependsOn: rootProject.platforms.collect() { p ->
+ task("release${p.goOs.capitalize()}${p.goArch.capitalize()}",
+ type: (p.goOs == 'linux') ? Tar : Zip, dependsOn: compile) {
+ if (p.goOs == 'linux') { compression = Compression.GZIP }
+ destinationDir = file('./release')
+ baseName = "${p.zipFileName}-latest-${p.owOs}-${p.goArch}"
+ from "./build/${p.goOs}-${p.goArch}/"
+ include "${buildFileName}*"
+ }
+ })
+
+/*
+ Create a 'content.json' file representing all that was
+ compiled and its appropriate directory in the Tarball that will be created
+ for deployment to local Nginx instances.
+ */
+
+task index() {
+ def content = [:]
+ for (p in platforms) {
+ def pathObject = [ "path" : "${p.archiveDirName}/${p.archiveFileName}" ]
+ content.get(p.owOs,[:])[p.goArch] = pathObject
+ // TODO: Default architecture should be configurable as a property
+ if (p.goArch == 'amd64') {
+ content.get(p.owOs,[:])['default'] = pathObject
+ }
+ }
+
+ doLast {
+ mkdir('./build')
+ file('./build/content.json').text = groovy.json.JsonOutput.toJson(["cli": content])
+ }
}
-def mapOsNameToGoName(String osname) {
- String osname_l = osname.toLowerCase()
- if (osname_l.contains("nux") || osname.contains("nix")) return "linux"
- if (osname_l.contains("mac")) return "mac"
- if (osname_l.contains("windows")) return "windows"
- return osname_l
+task release(type: Tar, dependsOn: [individualArchives, index]) {
+ compression = Compression.GZIP
+ destinationDir = file('./release')
+ baseName = "${OpenWhiskPlatform.zipFileName}-latest-all"
+ from('./build/content.json') { into('.') }
+ rootProject.platforms.each() { p ->
+ from('./release/') {
+ include("${p.zipFileName}-latest-${p.owOs}-${p.goArch}.*")
+ into p.archiveDirName
+ rename { p.archiveFileName }
+ }
+ }
}
-def mapOsArchToGoArch(String osarch) {
- String osarch_l = osarch.toLowerCase()
- if (osarch_l.contains("x86_64") || osarch_l == "amd64") return "amd64"
- if (osarch_l.contains("i386") || osarch_l.contains("x86_32")) return "386"
- return osarch_l
+task clean(type: Delete, dependsOn: goClean) {
+ delete './build', './release'
}
diff --git a/build.sh b/build.sh
deleted file mode 100644
index 172106c..0000000
--- a/build.sh
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/bash
-
-set +x
-set -e
-
-get_bin_name () {
- local os=$1
- local bin="wsk"
-
- if [ $os = "windows" ]; then
- bin="${bin}.exe";
- fi
-
- echo $bin;
-};
-
-build_cli () {
- local os=$1
- local arch=$2
- local bin=$3
-
- echo "Building for OS '$os' and architecture '$arch'"
-
- if [ $os = "mac" ]; then
- export GOOS=darwin;
- else
- export GOOS=$os;
- fi
-
- export GOARCH=$arch
-
- cd /src/github.com/apache/incubator-openwhisk-cli
- go build -ldflags "-X main.CLI_BUILD_TIME=`date -u '+%Y-%m-%dT%H:%M:%S%:z'`" -v -o build/$os/$arch/$bin main.go;
-};
-
-get_compressed_name() {
- local os=$1
- local arch=$2
- local product_name="OpenWhisk_CLI"
-
- if [ $arch = amd64 ]; then
- comp_name="$product_name-$os";
- elif [ $arch = 386 ]; then
- comp_name="$product_name-$os-32bit";
- else
- comp_name="$product_name-$os-$arch";
- fi
-
- echo $comp_name;
-};
-
-compress_binary() {
- local comp_name=$1
- local bin=$2
- local os=$3
- local arch=$4
-
- cd build/$os/$arch
-
- if [ $os = "linux" ]; then
- comp_name="$comp_name.tgz"
- tar -cvzf $comp_name $bin >/dev/null 2>&1;
- else
- comp_name="$comp_name.zip"
- zip $comp_name $bin >/dev/null 2>&1;
- fi
-
- cd ../../..
- echo $os/$arch/$comp_name;
-};
-
-create_cli_packages() {
- local dirIndex="{\"cli\":{"
-
- for platform in $platforms; do
- dirIndex="$dirIndex\"$platform\":{"
-
- for arch in $archs; do
- bin=$(get_bin_name $platform)
- build_cli $platform $arch $bin
- comp_name=$(get_compressed_name $platform $arch)
- comp_path=$(compress_binary $comp_name $bin $platform $arch)
-
- if [ $arch = $default_arch ]; then
- dirIndex="$dirIndex\"default\":{\"path\":\"$comp_path\"},";
- fi
-
- dirIndex="$dirIndex\"$arch\":{\"path\":\"$comp_path\"},";
- done
-
- dirIndex="$(echo $dirIndex | rev | cut -c2- | rev)"
- dirIndex="$dirIndex},";
- done
-
- dirIndex="$(echo $dirIndex | rev | cut -c2- | rev)"
- dirIndex="$dirIndex}}"
-
- echo $dirIndex > ./build/content.json
-};
-
-platforms="$CLI_OS"
-archs="$CLI_ARCH";
-default_arch="amd64"
-
-create_cli_packages
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..dd6667a
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1 @@
+systemProp.gogradle.alias=true
diff --git a/gradle/docker.gradle b/gradle/docker.gradle
index 9930f61..f716c7b 100644
--- a/gradle/docker.gradle
+++ b/gradle/docker.gradle
@@ -3,7 +3,7 @@ import groovy.time.*
/**
* Utility to build docker images based in gradle projects
*
- * This extends gradle's 'application' plugin logic with a 'buildBinaries' task which builds
+ * This extends gradle's 'application' plugin logic with a 'distDocker' task which builds
* a docker image from the Dockerfile of the project that applies this file. The image
* is automatically tagged and pushed if a tag and/or a registry is given.
*
@@ -42,7 +42,7 @@ if(project.hasProperty('dockerBuildArgs')) {
}
}
-task buildBinaries {
+task distDocker {
doLast {
def start = new Date()
def cmd = dockerBinary + dockerBuildArg + ['-t', dockerImageName, project.buildscript.sourceFile.getParentFile().getAbsolutePath()]
@@ -74,7 +74,7 @@ task pushImage {
}
pushImage.dependsOn tagImage
pushImage.onlyIf { dockerRegistry != '' }
-buildBinaries.finalizedBy pushImage
+distDocker.finalizedBy pushImage
def retry(cmd, retries, timeout) {
println("${new Date()}: Executing '${cmd.join(" ")}'")
diff --git a/settings.gradle b/settings.gradle
index f38f444..dd36ccf 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,11 +1,30 @@
-def owPath = System.getenv("OPENWHISK_HOME")
+def owPath = System.getenv("OPENWHISK_HOME") ?: '../incubator-openwhisk'
def owDirectory = new File(owPath)
-include 'common:scala'; project(':common:scala').projectDir = new File(owDirectory, 'common/scala')
-include 'core:controller'; project(':core:controller').projectDir = new File(owDirectory, 'core/controller')
-include 'core:invoker'; project(':core:invoker').projectDir = new File(owDirectory, 'core/invoker')
+if (!owDirectory.exists()) {
+ throw new GradleScriptException(
+ "Environment variable OPENWHISK_HOME must point to a valid OpenWhisk build", null)
+}
+
include 'clitests'; project(':clitests').projectDir = new File(owDirectory, 'tests')
+[ 'common:scala',
+ 'core:controller',
+ 'core:invoker',
+ 'actionRuntimes:nodejs6Action',
+ 'actionRuntimes:actionProxy',
+ 'actionRuntimes:pythonAction',
+ 'actionRuntimes:python2Action',
+ 'actionRuntimes:javaAction',
+ 'actionRuntimes:swift3.1.1Action',
+ 'sdk:docker',
+ 'tests:dat:blackbox:badaction',
+ 'tests:dat:blackbox:badproxy'
+].each() { p ->
+ include p
+ project(':'+p).projectDir = new File(owDirectory, p.replaceAll(':','/'))
+}
+
include 'tests'
rootProject.name = 'openwhisk-cli'
diff --git a/tests/src/integration/common/utils.go b/tests/src/integration/common/utils.go
index 4f9064d..c24b23e 100644
--- a/tests/src/integration/common/utils.go
+++ b/tests/src/integration/common/utils.go
@@ -21,6 +21,8 @@ import (
"os"
"unicode"
"io"
+ "path"
+ "runtime"
"strings"
)
@@ -104,6 +106,14 @@ func GetRepoPath() string {
return os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-cli"
}
+func GetBinPath() string {
+ _, goFileName, _, _ := runtime.Caller(1)
+ // Yes, this assumes we're using the official build script. I haven't
+ // figured out a better approach yet given the panoply of options.
+ // Maybe some sort of Go search path?
+ return path.Join(path.Dir(goFileName), "../../../../build")
+}
+
type InvalidArg struct {
Cmd []string
Err string
diff --git a/tests/src/integration/common/wsk.go b/tests/src/integration/common/wsk.go
index 08b025e..4af89e1 100644
--- a/tests/src/integration/common/wsk.go
+++ b/tests/src/integration/common/wsk.go
@@ -33,7 +33,7 @@ type Wsk struct {
}
func NewWsk() *Wsk {
- return NewWskWithPath(GetRepoPath())
+ return NewWskWithPath(GetBinPath())
}
func NewWskWithPath(path string) *Wsk {
diff --git a/tests/src/integration/dummy.go b/tests/src/integration/dummy.go
new file mode 100644
index 0000000..077d0a4
--- /dev/null
+++ b/tests/src/integration/dummy.go
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+package tests
diff --git a/tools/travis/build_tag_releases.sh b/tools/travis/build_tag_releases.sh
deleted file mode 100755
index c8ab958..0000000
--- a/tools/travis/build_tag_releases.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env bash
-
-# Currently supported combinations of OS and Architecture
-declare -a builds=(
- "linux amd64"
- "linux 386"
- "linux s390x"
- "linux ppc64le"
- "darwin amd64"
- "darwin 386"
- "windows amd64"
- "windows 386"
-)
-
-build_file_name=${1:-"wsk"}
-zip_file_name=${2:-"OpenWhisk_CLI"}
-
-for build in "${builds[@]}"
-do
- # A little bash foo to tokenize the build string
- IFS=' ' read os arc <<< "${build}"
- wsk=$build_file_name
- os_name=$os
- if [ "$os" == "windows" ]; then
- wsk="$wsk.exe"
- fi
- if [ "$os" == "darwin" ]; then
- os_name="mac"
- fi
- cd $TRAVIS_BUILD_DIR || exit
- GOOS=$os GOARCH=$arc go build -ldflags "-X main.CLI_BUILD_TIME=`date -u '+%Y-%m-%dT%H:%M:%S%:z'`" -o build/$os/$arc/$wsk
- cd build/$os/$arc || exit
- if [[ "$os" == "linux" ]]; then
- tar -czvf "$TRAVIS_BUILD_DIR/$zip_file_name-$TRAVIS_TAG-$os_name-$arc.tgz" $wsk
- else
- zip -r "$TRAVIS_BUILD_DIR/$zip_file_name-$TRAVIS_TAG-$os_name-$arc.zip" $wsk
- fi
-done
diff --git a/tools/travis/scancode.sh b/tools/travis/scancode.sh
deleted file mode 100755
index 2202c45..0000000
--- a/tools/travis/scancode.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-set -e
-
-# Build script for Travis-CI.
-SCRIPTDIR=$(cd $(dirname "$0") && pwd)
-ROOTDIR="$SCRIPTDIR/../.."
-UTIL_DIR="$ROOTDIR/../incubator-openwhisk-utilities"
-
-# run scancode
-cd $UTIL_DIR
-scancode/scanCode.py $ROOTDIR
\ No newline at end of file
diff --git a/tools/travis/setupscan.sh b/tools/travis/setupscan.sh
deleted file mode 100755
index 35f070f..0000000
--- a/tools/travis/setupscan.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-SCRIPTDIR=$(cd $(dirname "$0") && pwd)
-HOMEDIR="$SCRIPTDIR/../../../"
-
-# clone OpenWhisk utilities repo. in order to run scanCode.py
-cd $HOMEDIR
-git clone https://github.com/apache/incubator-openwhisk-utilities.git
diff --git a/tools/travis/test_openwhisk.sh b/tools/travis/test_openwhisk.sh
index 1dfb513..2370521 100755
--- a/tools/travis/test_openwhisk.sh
+++ b/tools/travis/test_openwhisk.sh
@@ -2,57 +2,89 @@
set -e
-cd $TRAVIS_BUILD_DIR
-./tools/travis/scancode.sh
-make lint
-make build
-make test
-export PATH=$PATH:$TRAVIS_BUILD_DIR;
-make native_test;
-
-export OPENWHISK_HOME="$(dirname "$TRAVIS_BUILD_DIR")/incubator-openwhisk";
+#
+# At this point, the Travis build should already have built the binaries and
+# the release. If you're running manually, this command should get you to
+# the same place:
+#
+# ./gradlew release
+#
+# Also at this point, you should already have incubator-openwhisk pulled down
+# from gradle in the parent directory, using a command such as:
+#
+# git clone --depth 3 https://github.com/apache/incubator-openwhisk.git
+#
+# To be clear, your directory structure will look something like...
+#
+# $HOMEDIR
+# |- incubator-openwhisk
+# |- incubator-openwhisk-cli (This project)
+# |- incubator-openwhisk-utilities (For scancode)
+#
+# The idea is to only build once and to be transparent about building in
+# the Travis script. To that end, some of the other builds that had been
+# done in this script will be moved into Travis.yml.
+#
+
+#
+# Determine default directories, etc., so we're not beholden to Travis
+# when running tests of the script during the development cycle.
+#
+scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+TRAVIS_BUILD_DIR="$( cd "${TRAVIS_BUILD_DIR:-$scriptdir/../..}" && pwd )"
+export TRAVIS_BUILD_DIR
+
+# For the gradle builds.
HOMEDIR="$(dirname "$TRAVIS_BUILD_DIR")"
-cd $HOMEDIR
+OPENWHISK_HOME="$( cd "${OPENWHISK_HOME:-$HOMEDIR/incubator-openwhisk}" && pwd )"
+export OPENWHISK_HOME
-# Clone the OpenWhisk code
-git clone --depth 3 https://github.com/apache/incubator-openwhisk.git
+#
+# Perform code validation using scanCode and Golint
+#
+../incubator-openwhisk-utilities/scancode/scanCode.py $TRAVIS_BUILD_DIR
+./gradlew --console=plain goLint
-# Build script for Travis-CI.
-WHISKDIR="$HOMEDIR/incubator-openwhisk"
+#
+# Run Unit and native tests
+#
+./gradlew --console=plain goTest -PgoTags=unit,native
-cd $WHISKDIR
-./tools/travis/setup.sh
+#
+# Set up the OpenWhisk environment for integration testing
+#
-ANSIBLE_CMD="ansible-playbook -i environments/local -e docker_image_prefix=testing"
-TERM=dumb ./gradlew distDocker -PdockerImagePrefix=testing
+# Build docker images
+cd $OPENWHISK_HOME
+./gradlew --console=plain distDocker -PdockerImagePrefix=testing
-cd $WHISKDIR/ansible
+# Fire up the cluster
+cd $OPENWHISK_HOME/ansible
+ANSIBLE_CMD="ansible-playbook -i environments/local -e docker_image_prefix=testing"
$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 -e openwhisk_cli_home=$TRAVIS_BUILD_DIR
# Copy the binary generated into the OPENWHISK_HOME/bin, so that the test cases will run based on it.
-mkdir -p $WHISKDIR/bin
-cp $TRAVIS_BUILD_DIR/bin/wsk $WHISKDIR/bin
+mkdir -p $OPENWHISK_HOME/bin
+cp -f $TRAVIS_BUILD_DIR/build/wsk $OPENWHISK_HOME/bin
-# Run the test cases under openwhisk to ensure the quality of the binary.
+# Run the test cases under openwhisk to ensure the quality of the runnint API.
cd $TRAVIS_BUILD_DIR
-
-./gradlew :tests:test -Dtest.single=*ApiGwCliTests*
+./gradlew --console=plain :tests:test -Dtest.single=*ApiGwCliTests*
sleep 30
-./gradlew :tests:test -Dtest.single=*ApiGwCliRoutemgmtActionTests*
+./gradlew --console=plain :tests:test -Dtest.single=*ApiGwCliRoutemgmtActionTests*
sleep 30
-./gradlew :tests:test -Dtest.single=*ApiGwCliEndToEndTests*
+./gradlew --console=plain :tests:test -Dtest.single=*ApiGwCliEndToEndTests*
sleep 30
-./gradlew :tests:test -Dtest.single=*Wsk*Tests*
+./gradlew --console=plain :tests:test -Dtest.single=*Wsk*Tests*
-make integration_test
+#
+# Finally, run the integration test for the CLI
+#
+./gradlew --console=plain goTest -PgoTags=integration
--
To stop receiving notification emails like this one, please contact
dubeejw@apache.org.