From 093ea64f638a7bc8508eebb34840fbfba185d532 Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Thu, 11 Feb 2021 18:27:07 -0600 Subject: [PATCH 1/8] Remove unused Godeps files; update README for Go Modules --- Godeps/Godeps.json | 176 --------------------------------------------- Godeps/Readme | 5 -- README.md | 97 +++++++++++-------------- 3 files changed, 43 insertions(+), 235 deletions(-) delete mode 100644 Godeps/Godeps.json delete mode 100644 Godeps/Readme diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index 28eb4224a..000000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "ImportPath": "github.com/apache/openwhisk-wskdeploy", - "GoVersion": "go1.9", - "GodepVersion": "v62", - "Deps": [ - { - "ImportPath": "github.com/cloudfoundry/jibber_jabber", - "Rev": "bcc4c8345a21301bf47c032ff42dd1aae2fe3027" - }, - { - "ImportPath": "github.com/fatih/color", - "Comment": "v1.5.0", - "Rev": "570b54cabe6b8eb0bc2dfce68d964677d63b5260" - }, - { - "ImportPath": "github.com/fsnotify/fsnotify", - "Comment": "v1.4.2-2-gfd9ec7d", - "Rev": "fd9ec7deca8bf46ecd2a795baaacf2b3a9be1197" - }, - { - "ImportPath": "github.com/google/go-querystring/query", - "Rev": "9235644dd9e52eeae6fa48efd539fdc351a0af53" - }, - { - "ImportPath": "github.com/hashicorp/hcl", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hashicorp/hcl/hcl/ast", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hashicorp/hcl/hcl/parser", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hashicorp/hcl/hcl/scanner", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hashicorp/hcl/hcl/strconv", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hashicorp/hcl/hcl/token", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hashicorp/hcl/json/parser", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hashicorp/hcl/json/scanner", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hashicorp/hcl/json/token", - "Rev": "973f376f0e7cf09c96e445b44712416c0cb22ec4" - }, - { - "ImportPath": "github.com/hokaccha/go-prettyjson", - "Rev": "f75235bd99dad4e98ff360db8372d5c0ef1d054a" - }, - { - "ImportPath": "github.com/inconshreveable/mousetrap", - "Rev": "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" - }, - { - "ImportPath": "github.com/magiconair/properties", - "Comment": "v1.7.0-5-g0723e35", - "Rev": "0723e352fa358f9322c938cc2dadda874e9151a9" - }, - { - "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/mapstructure", - "Rev": "f3009df150dadf309fdee4a54ed65c124afad715" - }, - { - "ImportPath": "github.com/nicksnyder/go-i18n/i18n", - "Comment": "v1.6.0-1-g991e81c", - "Rev": "991e81cc94f6c54209edb3192cb98e3995ad71c1" - }, - { - "ImportPath": "github.com/nicksnyder/go-i18n/i18n/bundle", - "Comment": "v1.6.0-1-g991e81c", - "Rev": "991e81cc94f6c54209edb3192cb98e3995ad71c1" - }, - { - "ImportPath": "github.com/nicksnyder/go-i18n/i18n/language", - "Comment": "v1.6.0-1-g991e81c", - "Rev": "991e81cc94f6c54209edb3192cb98e3995ad71c1" - }, - { - "ImportPath": "github.com/nicksnyder/go-i18n/i18n/translation", - "Comment": "v1.6.0-1-g991e81c", - "Rev": "991e81cc94f6c54209edb3192cb98e3995ad71c1" - }, - { - "ImportPath": "github.com/apache/openwhisk-client-go/whisk", - "Rev": "ee5b8709787cd37201c42e38040e9709f6d1e9c8" - }, - { - "ImportPath": "github.com/apache/openwhisk-client-go/wski18n", - "Rev": "ee5b8709787cd37201c42e38040e9709f6d1e9c8" - }, - { - "ImportPath": "github.com/pelletier/go-buffruneio", - "Rev": "df1e16fde7fc330a0ca68167c23bf7ed6ac31d6d" - }, - { - "ImportPath": "github.com/pelletier/go-toml", - "Comment": "v0.3.5-16-g45932ad", - "Rev": "45932ad32dfdd20826f5671da37a5f3ce9f26a8d" - }, - { - "ImportPath": "github.com/spf13/afero", - "Rev": "06b7e5f50606ecd49148a01a6008942d9b669217" - }, - { - "ImportPath": "github.com/spf13/afero/mem", - "Rev": "06b7e5f50606ecd49148a01a6008942d9b669217" - }, - { - "ImportPath": "github.com/spf13/cast", - "Rev": "2580bc98dc0e62908119e4737030cc2fdfc45e4c" - }, - { - "ImportPath": "github.com/spf13/cobra", - "Rev": "6e91dded25d73176bf7f60b40dd7aa1f0bf9be8d" - }, - { - "ImportPath": "github.com/spf13/jwalterweatherman", - "Rev": "33c24e77fb80341fe7130ee7c594256ff08ccc46" - }, - { - "ImportPath": "github.com/spf13/pflag", - "Rev": "5ccb023bc27df288a957c5e994cd44fd19619465" - }, - { - "ImportPath": "github.com/spf13/viper", - "Rev": "651d9d916abc3c3d6a91a12549495caba5edffd2" - }, - { - "ImportPath": "golang.org/x/sys/unix", - "Rev": "9a2e24c3733eddc63871eda99f253e2db29bd3b9" - }, - { - "ImportPath": "golang.org/x/text/transform", - "Rev": "a8b38433e35b65ba247bb267317037dee1b70cea" - }, - { - "ImportPath": "golang.org/x/text/unicode/norm", - "Rev": "a8b38433e35b65ba247bb267317037dee1b70cea" - }, - { - "ImportPath": "gopkg.in/yaml.v2", - "Rev": "eb3733d160e74a9c7e442f435eb3bea458e1d19f" - }, - { - "ImportPath": "github.com/palantir/stacktrace", - "Rev": "78658fd2d1772b755720ed8c44367d11ee5380d6" - }, - { - "ImportPath": "github.com/ghodss/yaml", - "Rev": "25d852aebe32c875e9c044af3eef9c7dc6bc777f" - } - ] -} diff --git a/Godeps/Readme b/Godeps/Readme deleted file mode 100644 index 4cdaa53d5..000000000 --- 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/README.md b/README.md index 47c1e1fa6..9cb2655c9 100644 --- a/README.md +++ b/README.md @@ -41,37 +41,61 @@ You can use this in addition to the OpenWhisk CLI. In fact, this utility uses t --- -## Building the project +## Contributing to the project ### GoLang setup -The wskdeploy utility is a GoLang program so you will first need to [Download and install GoLang](https://golang.org/doc/install) onto your local machine. +The wskdeploy utility is a GoLang program so you will first need to [Download and install GoLang](https://golang.org/dl/) onto your local machine. + +> **Note** Go version 1.15 or higher is recommended Make sure your `$GOPATH` is defined correctly in your environment. For detailed setup of your GoLang development environment, please read [How to Write Go Code](https://golang.org/doc/code.html). +### Git repository setup -### Get the source code from GitHub +1. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the Apache repository -Once your environment is setup, download `wskdeploy` and its dependencies: + If you intend to contribute code, you will want to fork the `apache/openwhisk-wskdeploy` repository into your github account and use that as the source for your clone. -```sh -$ cd $GOPATH -$ go get github.com/apache/openwhisk-wskdeploy # see known issues below if you get an error -$ go get github.com/tools/godep # get the dependency manager -``` +1. Clone the repository from your fork: + + ```sh + git clone git@github.com:${GITHUB_ACCOUNT_USERNAME}/openwhisk-wskdeploy.git + ``` + + You can now use `git push` to push local `commit` changes to your `origin` repository and submit pull requests to the `upstream` project repository. + +1. Add the Apache repository as a remote with the `upstream` alias: + + ```sh + git remote add upstream git@github.com:apache/openwhisk-wskdeploy + ``` + + Optionally, prevent accidental pushes to upstream: + ```sh + git remote set-url --push upstream no_push + ``` + +### Sync your fork before starting commits -### Build the binary +Be sure to [Sync your fork](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) before starting any contributions to keep it up-to-date with the upstream repository. + +--- + +## Building the `wskdeploy` binary + +Use the Go utility to build the ```wskdeploy``` binary + +Change into the cloned project directory and use `go build` with the target output name for the binary: -Use the Go utility to build the ```wskdeploy``` binary as follows: ```sh -$ cd src/github.com/apache/openwhisk-wskdeploy/ -$ godep restore $ go build -o wskdeploy ``` -### building for other Operating Systems (GOOS) and Architectures (GOARCH) +### Building for other Operating Systems (GOOS) and Architectures (GOARCH) 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. You may set + - ```GOOS``` to "linux", "darwin" or "windows" - ```GOARCH``` to "amd64" or "386" @@ -81,23 +105,11 @@ For example, run the following command to build the binary for 64-bit Linux: $ GOOS=linux GOARCH=amd64 go build -o wskdeploy ``` -### build using GoDep tool - -If you want to build with the godep tool, please execute the following commands. - -```sh -$ go get github.com/tools/godep # Install the godep tool. -$ godep get # Download and install packages with specified dependencies. -$ godep go build -o wskdeploy # build the wskdeploy tool. -``` - - - ## Running ```wskdeploy``` After building the wskdeploy binary, you can run it as follows: -#### Running the Binary file +### Running the Binary file Start by verifying the utility can display the command line help: ```sh @@ -109,7 +121,7 @@ then try deploying an OpenWhisk Manifest and Deployment file: $ ./wskdeploy -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/triggerrule/deployment.yml ``` -#### Running as a Go program +### Running as a Go program Since ```wskdeploy``` is a GoLang program, you may choose to run it using the Go utility: ```sh @@ -120,7 +132,8 @@ and deploying using the Go utility would look like: ```sh $ go run main.go -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/triggerrule/deployment.yml ``` - + +--- ## Downloading released binaries @@ -133,33 +146,9 @@ _If you are a Developer or Contributor, **we recommend building from the latest -## Contributing to the project - -Start by creating a fork of `openwhisk-wskdeploy` and then change the git `origin` to point to your forked repository, as follows: - -```sh -$ cd $GOPATH/src/github.com/apache/openwhisk-wskdeploy -$ git remote rename origin upstream -$ git remote add origin https://github.com//openwhisk-wskdeploy -$ git fetch --all -$ git branch --set-upstream-to origin/master # track master from origin now -``` You can now use `git push` to push changes to your repository and submit pull requests. -### Developers should use "go deps" and "go build" not "go get" - -The Whisk deploy project is setup for development purposes and uses "go deps" for dependency management. We do NOT recommend using "go get" as this will use the latest dependencies for all imported GitHub repos. which is not supported. - -- See: [https://github.com/tools/godep](https://github.com/tools/godep) - -Specifically, for development please use ```go build```: - -``` -$ git clone git@github.com:/openwhisk-wskdeploy -$ cd openwhisk-wskdeploy -$ go build -``` for end-users, please use versioned releases of binaries. - [https://github.com/apache/openwhisk-wskdeploy/releases](https://github.com/apache/openwhisk-wskdeploy/releases) @@ -172,7 +161,7 @@ After compiling, a suitable wskdeploy binary that works for your OS platform wil 1. First you need a docker daemon running locally on your machine. -2. Make sure you have Java 1.7 or above installed. +2. Make sure you have Java 8 or above installed. 3. Clone the wskdeploy repo with command ```git clone https://github.com/apache/openwhisk-wskdeploy.git``` From c3e7e0f3f5a1b5a6bda79d956dfbf4195c7a1f04 Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Thu, 11 Feb 2021 18:44:36 -0600 Subject: [PATCH 2/8] Remove unused Godeps files; update README for Go Modules --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 34fe6e4f0..13d4549a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ # limitations under the License. # -FROM golang:1.9 +FROM golang:1.15 # Install zip RUN apt-get -y update && \ @@ -24,14 +24,14 @@ RUN apt-get -y update && \ ENV GOPATH=/ # Download and install tools -RUN echo "Installing the godep tool" -RUN go get github.com/tools/godep +# RUN echo "Installing the godep tool" +# RUN go get github.com/tools/godep ADD . /src/github.com/apache/openwhisk-wskdeploy # 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/openwhisk-wskdeploy && /bin/godep restore -v +#RUN echo "Restoring Go dependencies" +#RUN cd /src/github.com/apache/openwhisk-wskdeploy && /bin/godep restore -v # All of the Go CLI binaries will be placed under a build folder RUN rm -rf /src/github.com/apache/openwhisk-wskdeploy/build From 736d4cf6afb06a96bd4184fe4e26dda1f1cedb1e Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Thu, 11 Feb 2021 18:49:26 -0600 Subject: [PATCH 3/8] Remove unused Godeps files; update README for Go Modules --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index bf632b01e..e8663b04e 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,9 @@ BUILD=`git rev-parse HEAD` BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -deps: - @echo "Installing dependencies" - godep restore -v - LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.GitCommit=${BUILD} -X main.BuildDate=${BUILD_DATE} -X main.Build=`git rev-parse HEAD` " -test: deps +test: @echo "Testing" go test ./... -tags=unit From be224049a2cad36818fc1f99fdf6e78f7b97d7b8 Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Fri, 12 Feb 2021 09:30:23 -0600 Subject: [PATCH 4/8] Remove unused Godeps files; update README for Go Modules --- README.md | 85 +++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 9cb2655c9..6fdc08820 100644 --- a/README.md +++ b/README.md @@ -63,15 +63,16 @@ Make sure your `$GOPATH` is defined correctly in your environment. For detailed git clone git@github.com:${GITHUB_ACCOUNT_USERNAME}/openwhisk-wskdeploy.git ``` - You can now use `git push` to push local `commit` changes to your `origin` repository and submit pull requests to the `upstream` project repository. - 1. Add the Apache repository as a remote with the `upstream` alias: ```sh git remote add upstream git@github.com:apache/openwhisk-wskdeploy ``` - Optionally, prevent accidental pushes to upstream: + You can now use `git push` to push local `commit` changes to your `origin` repository and submit pull requests to the `upstream` project repository. + + 1. Optionally, prevent accidental pushes to `upstream` using this command: + ```sh git remote set-url --push upstream no_push ``` @@ -105,6 +106,43 @@ For example, run the following command to build the binary for 64-bit Linux: $ GOOS=linux GOARCH=amd64 go build -o wskdeploy ``` +### How to Cross Compile Binary with Gradle/Docker + +If you don't want to bother with go installation, build, git clone etc, and you can do it with Gradle/Docker. + +After compiling, a suitable wskdeploy binary that works for your OS platform will be available under /bin directory. + +1. First you need a docker daemon running locally on your machine. + +2. Make sure you have Java 8 or above installed. + +3. Clone the wskdeploy repo with command ```git clone https://github.com/apache/openwhisk-wskdeploy.git``` + +4. If you use Windows OS, type ```gradlew.bat -version ```. For Unix/Linux/Mac, please type ```./gradlew -version```. + +5. Make sure you can see the correct Gradle version info on your console. Currently the expected Gradle +version is 3.3. + +6. For Windows type ```gradlew.bat distDocker```. For Linux/Unix/Mac, please type ```./gradlew distDocker```. These +commands will start the wskdeploy cross compile for your specific OS platform inside a Docker container. + +7. After build success, you should find a correct binary under current /bin dir of you openwhisk-deploy clone dir. + +If you would like to build the binaries available for all the operating systems and architectures, run the following command: + +```sh +$ ./gradlew distDocker -PcrossCompileWSKDEPLOY=true +``` + +Then, you will find the binaries and their compressed packages generated under the folder ```bin///``` for each supported Operating System and CPU Architecture pair. + +### Building for Internationalization + +Please follow this process for building any changes to translatable strings: +- [How to generate the file i18n_resources.go for internationalization](https://github.com/apache/openwhisk-wskdeploy/blob/master/wski18n/README.md) + +--- + ## Running ```wskdeploy``` After building the wskdeploy binary, you can run it as follows: @@ -144,50 +182,9 @@ For each release, we typically provide binaries built for Linux, Mac OS (Darwin) _If you are a Developer or Contributor, **we recommend building from the latest source code** from the project's master branch._ - - - -You can now use `git push` to push changes to your repository and submit pull requests. - - for end-users, please use versioned releases of binaries. - [https://github.com/apache/openwhisk-wskdeploy/releases](https://github.com/apache/openwhisk-wskdeploy/releases) -### How to Cross Compile Binary with Gradle/Docker - -If you don't want to bother with go installation, build, git clone etc, and you can do it with Gradle/Docker. - -After compiling, a suitable wskdeploy binary that works for your OS platform will be available under /bin directory. - -1. First you need a docker daemon running locally on your machine. - -2. Make sure you have Java 8 or above installed. - -3. Clone the wskdeploy repo with command ```git clone https://github.com/apache/openwhisk-wskdeploy.git``` - -4. If you use Windows OS, type ```gradlew.bat -version ```. For Unix/Linux/Mac, please type ```./gradlew -version```. - -5. Make sure you can see the correct Gradle version info on your console. Currently the expected Gradle -version is 3.3. - -6. For Windows type ```gradlew.bat distDocker```. For Linux/Unix/Mac, please type ```./gradlew distDocker```. These -commands will start the wskdeploy cross compile for your specific OS platform inside a Docker container. - -7. After build success, you should find a correct binary under current /bin dir of you openwhisk-deploy clone dir. - -If you would like to build the binaries available for all the operating systems and architectures, run the following command: - -```sh -$ ./gradlew distDocker -PcrossCompileWSKDEPLOY=true -``` - -Then, you will find the binaries and their compressed packages generated under the folder ```bin///``` for each supported Operating System and CPU Architecture pair. - -### Building for Internationalization - -Please follow this process for building any changes to translatable strings: -- [How to generate the file i18n_resources.go for internationalization](https://github.com/apache/openwhisk-wskdeploy/blob/master/wski18n/README.md) - ## Troubleshooting From b7f7f4a58b16fa5907ddcd4401b6cddf39c7730f Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Fri, 12 Feb 2021 13:28:51 -0600 Subject: [PATCH 5/8] Remove unused Godeps files; update README for Go Modules --- README.md | 160 +++++++++++++++++++------------ build.gradle | 1 - docs/creating_tagged_releases.md | 11 ++- 3 files changed, 104 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index 6fdc08820..a831e170d 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,32 @@ `wskdeploy` is a utility to help you describe and deploy any part of the OpenWhisk programming model using a Manifest file written in YAML. Use it to deploy all your OpenWhisk [Packages](https://github.com/apache/openwhisk/blob/master/docs/packages.md), [Actions](https://github.com/apache/openwhisk/blob/master/docs/actions.md), [Triggers, and Rules](https://github.com/apache/openwhisk/blob/master/docs/triggers_rules.md) using a single command! -`wskdeploy export --projectname managed_project_name` allows to "export" a specified managed project into a local file system. Namely, a `managed_project_name.yml` Manifest file will be created automatically. This Manifest file can be used with `wskdeploy` to redeploy the managed project at a different OpenWhisk instance. If the managed project contains dependencies on other managed projects, then these projects will be exported automatically into their respective manifests. +#### Running `wskdeploy` standalone -You can use this in addition to the OpenWhisk CLI. In fact, this utility uses the [OpenWhisk "Go" Client](https://github.com/apache/openwhisk-client-go) to create its HTTP REST calls for deploying and undeploying your packages. +You can use this utility separately from the OpenWhisk CLI as it uses the same [OpenWhisk "Go" Client](https://github.com/apache/openwhisk-client-go) as the Openwhisk CLI does to create its HTTP REST calls for deploying and undeploying your Openwhisk packages and entities. -## Here are some quick links for: +#### Running `wskdeploy` as part of the `wsk` CLI -- [Downloading wskdeploy](#downloading-released-binaries) - released binaries for Linux, Mac OS and Windows -- [Running wskdeploy](#running-wskdeploy) - run wskdeploy as a binary or Go program +Alternatively, you can use the `wskdeploy` functionality within the OpenWhisk CLI as it is now embedded as the `deploy` command. That is, you can invoke it as `wsk deploy` using all the same parameters documented for the standalone utility. + +#### Using `wskdeploy` to manage OpenWhisk entities as projects + +In addition to simple deployment, `wskdeploy` also has the powerful `export` command to manage sets of OpenWhisk entities that work together as a named project. The command: + +```sh +wskdeploy export --projectname ` +``` + +allows you to "export" a specified project into a local file system and manage it as a single entity. + +In the above example, a `.yml` Manifest file would be created automatically which can be used with `wskdeploy` to redeploy the managed project on a different OpenWhisk instance. If the managed project contains dependencies on other managed projects, then these projects will be exported automatically into their respective manifests. + +## Getting started + +Here are some quick links to help you get started: + +- [Downloading released binaries](#downloading-released-binaries) - released binaries for Linux, Mac OS and Windows +- [Running wskdeploy](#running-wskdeploy) - run `wskdeploy` as a binary or Go program - :eight_spoked_asterisk: [Writing Package Manifests](docs/programming_guide.md#wskdeploy-utility-by-example) - a step-by-step guide on writing Package Manifest files for ```wskdeploy``` - :eight_spoked_asterisk: [Exporting OpenWhisk assets](docs/export.md) - how to use `export` feature - [Building the project](#building-the-project) - download and build the GoLang source code @@ -41,49 +59,64 @@ You can use this in addition to the OpenWhisk CLI. In fact, this utility uses t --- -## Contributing to the project +## Downloading released binaries -### GoLang setup +Binaries of `wskdeploy` are available for download on the project's GitHub release page: +- [https://github.com/apache/openwhisk-wskdeploy/releases](https://github.com/apache/openwhisk-wskdeploy/releases). -The wskdeploy utility is a GoLang program so you will first need to [Download and install GoLang](https://golang.org/dl/) onto your local machine. +For each release, we typically provide binaries built for Linux, Mac OS (Darwin) and Windows on the AMD64 architecture. However, we provide instructions on how to build your own binaries as well from source code with the Go tool. See [Building the project](#building-the-project). -> **Note** Go version 1.15 or higher is recommended +_If you are a Developer or Contributor, **we recommend building from the latest source code** from the project's master branch._ -Make sure your `$GOPATH` is defined correctly in your environment. For detailed setup of your GoLang development environment, please read [How to Write Go Code](https://golang.org/doc/code.html). +for end-users, please use versioned releases of binaries. +- [https://github.com/apache/openwhisk-wskdeploy/releases](https://github.com/apache/openwhisk-wskdeploy/releases) -### Git repository setup +--- -1. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the Apache repository +## Running ```wskdeploy``` - If you intend to contribute code, you will want to fork the `apache/openwhisk-wskdeploy` repository into your github account and use that as the source for your clone. +Start by verifying the utility can display the command line help: +```sh +$ ./wskdeploy --help +``` -1. Clone the repository from your fork: +then try deploying an OpenWhisk Manifest and Deployment file: +```sh +$ ./wskdeploy -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/triggerrule/deployment.yml +``` - ```sh - git clone git@github.com:${GITHUB_ACCOUNT_USERNAME}/openwhisk-wskdeploy.git - ``` +--- -1. Add the Apache repository as a remote with the `upstream` alias: +## Building the project - ```sh - git remote add upstream git@github.com:apache/openwhisk-wskdeploy - ``` +### GoLang setup - You can now use `git push` to push local `commit` changes to your `origin` repository and submit pull requests to the `upstream` project repository. +The wskdeploy utility is a GoLang program so you will first need to [Download and install GoLang](https://golang.org/dl/) onto your local machine. - 1. Optionally, prevent accidental pushes to `upstream` using this command: +> **Note** Go version 1.15 or higher is recommended - ```sh - git remote set-url --push upstream no_push - ``` +Make sure your `$GOPATH` is defined correctly in your environment. For detailed setup of your GoLang development environment, please read [How to Write Go Code](https://golang.org/doc/code.html). -### Sync your fork before starting commits +### Download the source code from GitHub -Be sure to [Sync your fork](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) before starting any contributions to keep it up-to-date with the upstream repository. +As the code is managed using GitHub, it is easiest to retrieve the code using the `git clone` command. ---- +if you just want to build the code and do not intend to be a Contributor, you can clone the latest code from the Apache repository: + +```sh +git clone git@github.com:apache/openwhisk-wskdeploy +``` + +or you can specify a release (tag) if you do not want the latest code by using the `--branch ` flag. For example, you can clone the source code for the tagged 1.1.0 [release](https://github.com/apache/openwhisk-wskdeploy/releases) + +```sh +git clone --branch 1.1.0 git@github.com:apache/openwhisk-wskdeploy +``` -## Building the `wskdeploy` binary +You can also pull the code from a fork of the repository. If you intend to become a Contributor to the project, read the section [Contributing to the project](#contributing-to-the-project) below on how to setup a fork. + + +### Building using `go build` Use the Go utility to build the ```wskdeploy``` binary @@ -93,6 +126,8 @@ Change into the cloned project directory and use `go build` with the target outp $ go build -o wskdeploy ``` +an executable named `wskdeploy` will be created in the current directory for your current operating system and architecture. + ### Building for other Operating Systems (GOOS) and Architectures (GOARCH) 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. You may set @@ -141,27 +176,10 @@ Then, you will find the binaries and their compressed packages generated under t Please follow this process for building any changes to translatable strings: - [How to generate the file i18n_resources.go for internationalization](https://github.com/apache/openwhisk-wskdeploy/blob/master/wski18n/README.md) ---- - -## Running ```wskdeploy``` - -After building the wskdeploy binary, you can run it as follows: - -### Running the Binary file - -Start by verifying the utility can display the command line help: -```sh -$ ./wskdeploy --help -``` - -then try deploying an OpenWhisk Manifest and Deployment file: -```sh -$ ./wskdeploy -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/triggerrule/deployment.yml -``` - ### Running as a Go program -Since ```wskdeploy``` is a GoLang program, you may choose to run it using the Go utility: +Since ```wskdeploy``` is a GoLang program, you may choose to run it using the Go utility. After building the wskdeploy binary, you can run it as follows: + ```sh $ go run main.go --help ``` @@ -173,19 +191,42 @@ $ go run main.go -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/tr --- -## Downloading released binaries +## Contributing to the project -Binaries of `wskdeploy` are available for download on the project's GitHub release page: -- [https://github.com/apache/openwhisk-wskdeploy/releases](https://github.com/apache/openwhisk-wskdeploy/releases). +### Git repository setup -For each release, we typically provide binaries built for Linux, Mac OS (Darwin) and Windows on the AMD64 architecture. However, we provide instructions on how to build your own binaries as well from source code with the Go tool. See [Building the project](#building-the-project). +1. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the Apache repository -_If you are a Developer or Contributor, **we recommend building from the latest source code** from the project's master branch._ + If you intend to contribute code, you will want to fork the `apache/openwhisk-wskdeploy` repository into your github account and use that as the source for your clone. -for end-users, please use versioned releases of binaries. -- [https://github.com/apache/openwhisk-wskdeploy/releases](https://github.com/apache/openwhisk-wskdeploy/releases) +1. Clone the repository from your fork: + + ```sh + git clone git@github.com:${GITHUB_ACCOUNT_USERNAME}/openwhisk-wskdeploy.git + ``` + +1. Add the Apache repository as a remote with the `upstream` alias: + + ```sh + git remote add upstream git@github.com:apache/openwhisk-wskdeploy + ``` + + You can now use `git push` to push local `commit` changes to your `origin` repository and submit pull requests to the `upstream` project repository. + + 1. Optionally, prevent accidental pushes to `upstream` using this command: + + ```sh + git remote set-url --push upstream no_push + ``` + +> Be sure to [Sync your fork](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) before starting any contributions to keep it up-to-date with the upstream repository. - +### Creating Tagged Releases + +Committers can find instructions on how to create tagged releases here: +- [creating_tagged_releases.md](https://github.com/apache/openwhisk-wskdeploy/tree/master/docs/creating_tagged_releases.md) + +--- ## Troubleshooting @@ -228,8 +269,3 @@ This is caused by newer `git` versions not forwarding requests anymore. One solu ``` $ git config --global http.https://gopkg.in.followRedirects true ``` - -## Creating Tagged Releases - -Committers can find instructions on how to create tagged releases here: -- [creating_tagged_releases.md](https://github.com/apache/openwhisk-wskdeploy/tree/master/docs/creating_tagged_releases.md) diff --git a/build.gradle b/build.gradle index a6f115b52..6b4a2040d 100644 --- a/build.gradle +++ b/build.gradle @@ -87,7 +87,6 @@ dependencies { rat { excludes += [ - 'Godeps/*', '.gradletasknamecache', 'gradle/wrapper/**', 'gradlew*', 'build/**', // Gradle '.gitignore', '.rat-excludes', 'i18n_resources.go', diff --git a/docs/creating_tagged_releases.md b/docs/creating_tagged_releases.md index 82675acd1..4314b9560 100644 --- a/docs/creating_tagged_releases.md +++ b/docs/creating_tagged_releases.md @@ -24,23 +24,24 @@ The most convenient way to create a tagged release for wskdeploy is to build the 1. Add a tag to a commit id: ```git tag -a ``` -for example, using the (7 min.) leading characters on commit hash: +for example, using the leading characters on commit hash (minimum of 7 characters): + ``` -$ git tag -a 0.8.9 c08b0f +$ git tag -a 1.0.9 c08b0f3 ``` 2. Push the tag upstream: ```git push -f upstream ``` for example: ``` -$ git push -f upstream 0.8.9 +$ git push -f upstream 1.0.9 ``` -Travis will start the build of 0.8.9 automatically by the event of tag creation. +will start a Travis build of 1.0.9 automatically from seeing the tag creation event. If the travis build passed, binaries will be pushed into releases page. -If we modify the tag by pointing to a different commit, use ```git push -f upstream 0.8.9``` to overwrite the old tag. New binaries from travis build will overwrite the old binaries as well. +If we modify the tag by pointing to a different commit, use ```git push -f upstream 1.0.9``` to overwrite the old tag. New binaries from travis build will overwrite the old binaries as well. You can download the binaries, and delete them from the releases page in GitHub if we do not want them to be public. From 131022caefd47b89abf07b1a63211f8763f6d26a Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Wed, 17 Feb 2021 13:20:56 -0600 Subject: [PATCH 6/8] Update README to include dependency mgmt using go get --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/README.md b/README.md index a831e170d..0e985fbca 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,54 @@ $ go run main.go -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/tr > Be sure to [Sync your fork](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) before starting any contributions to keep it up-to-date with the upstream repository. +### Adding new dependencies + +Please use `go get` to add new dependencies to the `go.mod` file: + +```sh +go get github.com/project/libname@v1.2.0 +``` + +> Please avoid using commit hashes for referencing non-OpenWhisk libraries. + +### Removing unused dependencies + +Please us `go tidy` to remove any unused dependencies after any significant code changes: + +```sh +go mod tidy +``` + +### Updating dependency versions + +Although you might be tempted to edit the go.mod file directly, please use the recommended method of using the `go get` command: + +Using "latest" version: + +```sh +go get github.com/project/libname +``` + +Using a release tag: + +```sah +go get github.com/project/libname +``` + +Using a commit hash: + +```sh +go get github.com/project/libname@aee5cab1c +``` + +### Updating Go version + +Although you could edit the version directly in the go.mod file, it is better to use the `go edit` command: + +```sh +go mod edit -go=1.14 +``` + ### Creating Tagged Releases Committers can find instructions on how to create tagged releases here: From 36dfabf68922a7c3865e7315a561e733db398813 Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Wed, 17 Feb 2021 14:14:27 -0600 Subject: [PATCH 7/8] Clean up Dockerfile from godeps commands --- Dockerfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 13d4549a0..f3dd5c7c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,16 +23,8 @@ RUN apt-get -y update && \ ENV GOPATH=/ -# Download and install tools -# RUN echo "Installing the godep tool" -# RUN go get github.com/tools/godep - ADD . /src/github.com/apache/openwhisk-wskdeploy -# 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/openwhisk-wskdeploy && /bin/godep restore -v - # All of the Go CLI binaries will be placed under a build folder RUN rm -rf /src/github.com/apache/openwhisk-wskdeploy/build RUN mkdir /src/github.com/apache/openwhisk-wskdeploy/build From 602b347522e7c36941f266ca095c2022f69537c5 Mon Sep 17 00:00:00 2001 From: Matt Rutkowski Date: Wed, 17 Feb 2021 15:02:30 -0600 Subject: [PATCH 8/8] Remove godep from travis config --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3444ab771..79555d24a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,6 @@ install: - export DEPLOY_BUILD_READY=false - go get -u golang.org/x/lint/golint - go get -u github.com/stretchr/testify - - go get -u github.com/tools/godep before_script: - GO_FILES=$(find . -iname '*.go' -type f -not -path "./wski18n/i18n_resources.go") - export BAD_GO=$(gofmt -s -l $(echo $GO_FILES))