Skip to content

Commit

Permalink
Make OpenWhisk CLI available only via redirect
Browse files Browse the repository at this point in the history
As was already done with the iOS starter app and the blackbox SDK,
switch to making the cli binaries available via a redirect to the
openwhisk-cli release page instead of copying cli binaries into
the edge container.  As discussed in issue apache#2152 this eliminates
the need for a custom OpenWhisk edge image for downstream deployments.

Also update GoCLINginxTests to check for redirects instead of direct
downloads and remove the cli role and related variable definitions
from ansible.
  • Loading branch information
dgrove-oss committed Dec 12, 2017
1 parent 3337d8a commit 2960c74
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 339 deletions.
4 changes: 1 addition & 3 deletions ansible/edge.yml
@@ -1,10 +1,8 @@
---
# This playbook deploys Openwhisk Edge servers.
# The edge is usually populated with NGINX serving as proxy.
# The CLI also gets built and published for downloading from NGINX.
# SDKs for blackbox and iOS get published to NGINX also.
# The CLI and SDKs for blackbox and iOS are available via redirect

- hosts: edge
roles:
- nginx
- cli
32 changes: 3 additions & 29 deletions ansible/group_vars/all
Expand Up @@ -251,7 +251,6 @@ sdk:

cli:
path: "{{ openwhisk_home }}/bin/wsk"
nginxdir: "{{ nginx.confdir }}/cli/go/download"
dir:
become: "{{ cli_dir_become | default(false) }}"

Expand Down Expand Up @@ -292,41 +291,16 @@ catalog_repos:
version: "HEAD"
repo_update: "no"

# The version of the openwhisk cli to which we will redirect download requests
openwhisk_cli_tag: "{{ lookup('ini', 'git_tag section=openwhisk-cli file={{ openwhisk_home }}/ansible/files/package-versions.ini') }}"

# The openwhisk_cli is used to determine how to install the OpenWhisk CLI. The
# installation_mode can be specified into two modes: remote and local.
# The mode remote means to download the available binaries from the releases page
# of the official openwhisk cli repository. The mode local means to build the binaries
# locally in a directory and get them from the local directory. The default value
# for openwhisk is local.
#
# The name specifies the package name of the binaries in remote mode.
#
# The dest_name specifies the package name of the binaries in Nginx in remote mode.
#
# The location specifies the official website where Openwhisk CLI is hosted in
# remote mode or location to save the binaries of the OpenWhisk CLI in local mode.
#

openwhisk_cli:
installation_mode: "{{ cli_installation_mode | default('remote') }}"
local:
location: "{{ openwhisk_cli_home }}/bin"
remote:
name: OpenWhisk_CLI
dest_name: OpenWhisk_CLI
location: "https://github.com/apache/incubator-openwhisk-cli/releases/download/{{ openwhisk_cli_tag }}"

# The list of operating systems for which openwhisk cli binaries are downloaded,
# if the installation_mode is remote.
# The list of operating systems for which openwhisk cli binaries are available,
cli_os:
- linux
- mac
- windows

# The list of architectures for which openwhisk cli binaries are downloaded,
# if the installation_mode is remote.
# The list of architectures for which openwhisk cli binaries are available,
cli_arch:
- amd64
- 386
Expand Down
8 changes: 0 additions & 8 deletions ansible/publish.yml

This file was deleted.

70 changes: 0 additions & 70 deletions ansible/roles/cli/files/createContentJson.sh

This file was deleted.

7 changes: 0 additions & 7 deletions ansible/roles/cli/tasks/clean.yml

This file was deleted.

25 changes: 0 additions & 25 deletions ansible/roles/cli/tasks/cli_remote_mode.yml

This file was deleted.

17 changes: 0 additions & 17 deletions ansible/roles/cli/tasks/copy_local_openwhisk_cli.yml

This file was deleted.

28 changes: 0 additions & 28 deletions ansible/roles/cli/tasks/deploy.yml

This file was deleted.

23 changes: 0 additions & 23 deletions ansible/roles/cli/tasks/download_cli.yml

This file was deleted.

73 changes: 0 additions & 73 deletions ansible/roles/cli/tasks/download_openwhisk_cli.yml

This file was deleted.

10 changes: 0 additions & 10 deletions ansible/roles/cli/tasks/main.yml

This file was deleted.

13 changes: 11 additions & 2 deletions ansible/roles/nginx/templates/nginx.conf.j2
Expand Up @@ -90,9 +90,18 @@ http {
return 301 https://github.com/apache/incubator-openwhisk-client-swift/releases/download/0.2.3/starterapp-0.2.3.zip;
}

# redirect requests for specific binaries to the matching one from the {{ openwhisk_cli_tag }} openwhisk-cli release.
{% for os in cli_os %}
{% for arch in cli_arch %}
location /cli/go/download/{{ os }}/{{ arch }} {
return 301 https://github.com/apache/incubator-openwhisk-cli/releases/download/{{ openwhisk_cli_tag }}/OpenWhisk_CLI-{{ openwhisk_cli_tag }}-{{ os }}-{{ arch }}.{% if os == 'linux' %}tgz{% else %}zip{% endif %};
}
{% endfor %}
{% endfor %}

# redirect top-level cli downloads to the {{ openwhisk_cli_tag }} openwhisk-cli release.
location /cli/go/download {
autoindex on;
root /etc/nginx;
return 301 https://github.com/apache/incubator-openwhisk-cli/releases/{{ openwhisk_cli_tag }};
}
}
}

0 comments on commit 2960c74

Please sign in to comment.