You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2017/06/14 13:28:37 UTC

[incubator-openwhisk] branch master updated: Revert "Add the support to install the binaries from the new repo (#2345)" (#2371)

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 381e804  Revert "Add the support to install the binaries from the new repo (#2345)" (#2371)
381e804 is described below

commit 381e8048518e2e944bfdf06c5b66368808f85b06
Author: Carlos Santana <cs...@gmail.com>
AuthorDate: Wed Jun 14 09:28:34 2017 -0400

    Revert "Add the support to install the binaries from the new repo (#2345)" (#2371)
    
    This reverts commit be6682a9df3bbf871b29ef51b3944f1a9c3d67a3.
---
 ansible/files/package-versions.ini                 |  2 -
 ansible/group_vars/all                             | 44 --------------
 ansible/roles/cli/files/createContentJson.sh       | 69 ---------------------
 ansible/roles/cli/tasks/cli_remote_mode.yml        | 18 ------
 ansible/roles/cli/tasks/deploy.yml                 | 24 +++++---
 ansible/roles/cli/tasks/download_cli.yml           |  2 -
 ansible/roles/cli/tasks/download_openwhisk_cli.yml | 70 ----------------------
 tools/vagrant/Vagrantfile                          |  1 +
 8 files changed, 16 insertions(+), 214 deletions(-)

diff --git a/ansible/files/package-versions.ini b/ansible/files/package-versions.ini
deleted file mode 100644
index 2464ea7..0000000
--- a/ansible/files/package-versions.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[openwhisk-cli]
-git_tag=latest
diff --git a/ansible/group_vars/all b/ansible/group_vars/all
index b0540f8..59ef946 100644
--- a/ansible/group_vars/all
+++ b/ansible/group_vars/all
@@ -1,7 +1,6 @@
 mode: deploy
 prompt_user: true
 openwhisk_home: "{{ lookup('env', 'OPENWHISK_HOME')|default(playbook_dir + '/..', true) }}"
-openwhisk_cli_home: "{{ lookup('env', 'OPENWHISK_CLI')|default(playbook_dir + '/../../incubator-openwhisk-cli', true) }}"
 exclude_logs_from: []
 
 # This whisk_api_localhost_name_default is used to configure nginx to permit vanity URLs for web actions
@@ -229,46 +228,3 @@ catalog_repos:
     location: "{{ openwhisk_home }}/../openwhisk-catalog"
     version: "HEAD"
     repo_update: "no"
-
-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 get the binaries
-# from a local directory. The default value for openwhisk is remote.
-#
-# 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: remote
-  name: OpenWhisk_CLI
-  dest_name: OpenWhisk_CLI
-  location: "https://github.com/apache/incubator-openwhisk-cli/releases/download/{{ openwhisk_cli_tag }}"
-
-# If you would like to use the binaries available locally, e.g. the binaries generated in the development
-# environment, you can uncomment the following section to use the local mode. Please be advised that the
-# binaries are generated and the location is set correctly before running the ansible scripts.
-#
-#openwhisk_cli:
-#  installation_mode: local
-#  location: "{{ openwhisk_cli_home }}/bin"
-
-# The list of operating systems for which openwhisk cli binaries are downloaded,
-# if the installation_mode is remote.
-cli_os:
-  - linux
-  - mac
-  - windows
-
-# The list of architectures for which openwhisk cli binaries are downloaded,
-# if the installation_mode is remote.
-cli_arc:
-  - amd64
-  - 386
diff --git a/ansible/roles/cli/files/createContentJson.sh b/ansible/roles/cli/files/createContentJson.sh
deleted file mode 100755
index 6171568..0000000
--- a/ansible/roles/cli/files/createContentJson.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-
-set +x
-set -e
-
-get_compressed_name() {
-  local os=$1
-  local arch=$2
-  local product_name=$3
-
-  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;
-};
-
-get_binary_path() {
-    local comp_name=$1
-    local os=$2
-    local arch=$3
-
-    if [ $os = "linux" ]; then
-        comp_name="$comp_name.tgz"
-    else
-    		comp_name="$comp_name.zip"
-    fi
-    echo $os/$arch/$comp_name;
-};
-
-create_cli_packages() {
-  local dirIndex="{\"cli\":{"
-
-  for platform in $platforms; do
-    dirIndex="$dirIndex\"$platform\":{"
-
-    for arch in $archs; do
-      comp_name=$(get_compressed_name $platform $arch $zip_name)
-      comp_path=$(get_binary_path $comp_name $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 > $PATH_CONTENT_JSON/content.json
-};
-
-archs="386 amd64";
-default_arch="amd64"
-
-PATH_CONTENT_JSON=$1
-BINARY_TAG=$2
-platforms=$3
-zip_name=$4
-create_cli_packages
diff --git a/ansible/roles/cli/tasks/cli_remote_mode.yml b/ansible/roles/cli/tasks/cli_remote_mode.yml
deleted file mode 100644
index ddacdf5..0000000
--- a/ansible/roles/cli/tasks/cli_remote_mode.yml
+++ /dev/null
@@ -1,18 +0,0 @@
----
-
-# Download the cli for the remote mode and generate the content.json file
-
-- name: "download the binaries from the release page of OpenWhisk CLI"
-  include: download_openwhisk_cli.yml
-  with_nested:
-    - "{{ cli_os }}"
-    - "{{ cli_arc }}"
-
-- name: "generate content.json locally for Nginx CLI directory"
-  local_action: shell "./createContentJson.sh" "{{ config_root_dir }}" "{{ openwhisk_cli_tag }}" "{{ cli_os | join(" ") }}" "{{ openwhisk_cli.dest_name }}" chdir="{{ openwhisk_home }}/ansible/roles/cli/files"
-
-- name: "copy the local content.json to the remote node"
-  copy: src={{ config_root_dir }}/content.json dest={{ cli.nginxdir }}/
-
-- name: "delete the local content.json"
-  local_action: file path={{ config_root_dir }}/content.json state=absent
diff --git a/ansible/roles/cli/tasks/deploy.yml b/ansible/roles/cli/tasks/deploy.yml
index 58e000d..1bf872d 100644
--- a/ansible/roles/cli/tasks/deploy.yml
+++ b/ansible/roles/cli/tasks/deploy.yml
@@ -6,17 +6,23 @@
     path: "{{ cli.nginxdir  }}"
     state: directory
 
-- set_fact:
-    cli_installation_mode="{{ openwhisk_cli.installation_mode }}"
-
 - include: docker_login.yml
 
-- name: "download the binaries for the remote mode"
-  include: cli_remote_mode.yml
-  when: cli_installation_mode == "remote"
+- name: "pull the {{ docker_image_tag }} image of cli"
+  shell: "docker pull {{ docker_registry }}{{ docker_image_prefix }}/cli:{{ docker_image_tag }}"
+  when: docker_registry != ""
+
+- name: "run Docker"
+  shell: "docker run --name cli {{ docker_registry }}{{ docker_image_prefix }}/cli:{{ docker_image_tag }}"
+
+- name: "copy all the cli binaries into nginx"
+  shell: "docker cp cli:/src/github.com/go-whisk-cli/build/. '{{ cli.nginxdir }}'"
+  ignore_errors: yes
+
+- name: "stop Docker"
+  shell: "docker stop cli"
 
-- name: "copy the binaries from a local directory to Nginx directory"
-  copy: src={{ openwhisk_cli.location }}/ dest={{ cli.nginxdir }}/
-  when: cli_installation_mode == "local"
+- name: "remove cli container after publishing"
+  shell: "docker rm cli"
 
 - include: download_cli.yml
diff --git a/ansible/roles/cli/tasks/download_cli.yml b/ansible/roles/cli/tasks/download_cli.yml
index 27a2735..df18b3d 100644
--- a/ansible/roles/cli/tasks/download_cli.yml
+++ b/ansible/roles/cli/tasks/download_cli.yml
@@ -9,7 +9,6 @@
     dest="{{ openwhisk_home }}/bin/wsk"
     mode=0755
     validate_certs=False
-    force=True
   when: "'environments/mac' not in inventory_dir"
 
 - name: "download cli (mac) to openwhisk home at {{ openwhisk_home }}"
@@ -19,5 +18,4 @@
     dest="{{ openwhisk_home }}/bin/wsk"
     mode=0755
     validate_certs=False
-    force=True
   when: "'environments/mac' in inventory_dir"
diff --git a/ansible/roles/cli/tasks/download_openwhisk_cli.yml b/ansible/roles/cli/tasks/download_openwhisk_cli.yml
deleted file mode 100644
index 9b53e89..0000000
--- a/ansible/roles/cli/tasks/download_openwhisk_cli.yml
+++ /dev/null
@@ -1,70 +0,0 @@
----
-
-# Download the cli to Nginx CLI directory and unzip them
-
-- name: "set the basic variables os, arc and suffix"
-  set_fact:
-    os="{{ item[0] }}"
-    arc="{{ item[1] }}"
-    suffix="zip"
-
-- name: "change the suffix to tgz if the operating system is Linux"
-  set_fact:
-    suffix="tgz"
-  when: os == "linux"
-
-- name: "set the file name to download"
-  set_fact:
-    source_name="{{ openwhisk_cli.name }}-{{ openwhisk_cli_tag }}-{{ os }}-{{ arc }}.{{ suffix }}"
-
-- name: "set the destination file name locally after download for 32 bit"
-  set_fact:
-    dest_name="{{ openwhisk_cli.dest_name }}-{{ os }}-32bit.{{ suffix }}"
-  when: arc == "386"
-
-- name: "set the destination file name locally after download for 64 bit"
-  set_fact:
-    dest_name="{{ openwhisk_cli.dest_name }}-{{ os }}.{{ suffix }}"
-  when: arc == "amd64"
-
-- name: "set the http header used to download the binary packages"
-  set_fact:
-    headers="{{ openwhisk_cli.headers }}"
-  when: openwhisk_cli.headers is defined
-
-- name: "set the http header to empty"
-  set_fact:
-    headers=""
-  when: openwhisk_cli.headers is not defined
-
-- name: "set the instance volume_dir"
-  set_fact:
-    instance: "{{instances | selectattr('name', 'equalto', 'db') | list | first}}"
-    volume_dir: "{{ instance.volume.fsmount | default( '/mnt/' + group_names|first, true ) }}:/usr/local/var/lib/couchdb"
-  when: (block_device is defined) and (block_device in disk_status.stdout)
-
-- name: "ensure Nginx cli directory for ({{ os }}) {{ arc }} exists"
-  file:
-    path: "{{ cli.nginxdir }}/{{ os }}/{{ arc }}"
-    state: directory
-
-- name: "download cli ({{ os }}) {{ arc }} to Nginx directory"
-  get_url:
-    url: "{{ openwhisk_cli.location }}/{{ source_name }}"
-    dest: "{{ cli.nginxdir }}/{{ os }}/{{ arc }}/{{ dest_name }}"
-    headers: "{{ headers }}"
-    mode: 0755
-
-- name: "unarchive cli for Mac and Windows"
-  unarchive:
-    src: "{{ cli.nginxdir }}/{{ os }}/{{ arc }}/{{ dest_name }}"
-    dest: "{{ cli.nginxdir }}/{{ os }}/{{ arc }}/"
-    remote_src: True
-  when: os != "linux"
-
-- name: "unarchive cli for Linux"
-  command: tar -zxvf {{ dest_name }}
-  args:
-    chdir: "{{ cli.nginxdir }}/{{ os }}/{{ arc }}/"
-  when: os == "linux"
-
diff --git a/tools/vagrant/Vagrantfile b/tools/vagrant/Vagrantfile
index 33bd5a7..3ab2bba 100644
--- a/tools/vagrant/Vagrantfile
+++ b/tools/vagrant/Vagrantfile
@@ -137,6 +137,7 @@ $script_end = <<SCRIPT
   source /etc/environment
   # Build OpenWhisk using gradle
   cd ${OPENWHISK_HOME}
+  su vagrant -c './gradlew  tools:cli:distDocker -PdockerImagePrefix=openwhisk'
 
   echo "`date`: deploy-start" >> /tmp/vagrant-times.txt
   # Deploy OpenWhisk using ansible

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].