diff --git a/settings.gradle b/settings.gradle index ca9b7c089c9..39ab2700ecb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -24,8 +24,7 @@ include 'tests' include 'tests:performance:gatling_tests' include 'tools:actionProxy' -include 'tools:ansibleRunner' -include 'tools:scriptRunner' +include 'tools:ow-utils' include 'tools:dev' include 'tools:admin' diff --git a/tools/ansibleRunner/Dockerfile b/tools/ansibleRunner/Dockerfile deleted file mode 100644 index 6731f24e510..00000000000 --- a/tools/ansibleRunner/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more contributor -# license agreements; and to You under the Apache License, Version 2.0. - -from debian:jessie-slim - -ENV DOCKER_VERSION 1.12.0 - -RUN apt-get update && apt-get install -y \ - curl \ - git \ - libffi-dev \ - python \ - python-pip \ - wget \ - zip - -# Install docker client -RUN wget --no-verbose https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz && \ -tar --strip-components 1 -xvzf docker-${DOCKER_VERSION}.tgz -C /usr/bin docker/docker && \ -rm -f docker-${DOCKER_VERSION}.tgz && \ -chmod +x /usr/bin/docker - -RUN pip install --upgrade pip -RUN pip install --upgrade setuptools -RUN pip install ansible==2.5.2 -RUN pip install jinja2==2.9.6 - -CMD ["/usr/local/bin/ansible-playbook", "/task/playbook.yml"] diff --git a/tools/ansibleRunner/build.gradle b/tools/ansibleRunner/build.gradle deleted file mode 100644 index d6c32a23203..00000000000 --- a/tools/ansibleRunner/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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. - */ - -ext.dockerImageName = 'ansible-runner' -apply from: '../../gradle/docker.gradle' diff --git a/tools/jenkins/apache/dockerhub.groovy b/tools/jenkins/apache/dockerhub.groovy index d2f73b429b2..3032fb6cb38 100644 --- a/tools/jenkins/apache/dockerhub.groovy +++ b/tools/jenkins/apache/dockerhub.groovy @@ -29,7 +29,7 @@ node('xenial&&!H21&&!H22&&!H11&&!ubuntu-eu3') { withCredentials([usernamePassword(credentialsId: 'openwhisk_dockerhub', passwordVariable: 'DOCKER_PASSWORD', usernameVariable: 'DOCKER_USER')]) { sh 'docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD}' } - def PUSH_CMD = "./gradlew :core:controller:distDocker :core:invoker:distDocker :tools:scriptRunner:distDocker :tools:ansibleRunner:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk" + def PUSH_CMD = "./gradlew :core:controller:distDocker :core:invoker:distDocker :tools:ow-utils:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk" def gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim() def shortCommit = gitCommit.take(7) sh "${PUSH_CMD} -PdockerImageTag=latest" diff --git a/tools/ow-utils/Dockerfile b/tools/ow-utils/Dockerfile new file mode 100644 index 00000000000..5953d864ff7 --- /dev/null +++ b/tools/ow-utils/Dockerfile @@ -0,0 +1,41 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements; and to You under the Apache License, Version 2.0. + +FROM adoptopenjdk/openjdk8:jdk8u191-b12 + +ENV DOCKER_VERSION 1.12.0 +ENV WHISK_CLI_VERSION latest +ENV WHISKDEPLOY_CLI_VERSION latest + +RUN apt-get update && apt-get install -y \ + git \ + libffi-dev \ + nodejs \ + npm \ + python \ + python-pip \ + wget \ + zip \ +&& rm -rf /var/lib/apt/lists/* + +# Python packages +RUN pip install --upgrade pip +RUN pip install --upgrade setuptools +RUN pip install ansible==2.5.2 +RUN pip install jinja2==2.9.6 + +# Install docker client +RUN wget --no-verbose https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz && \ + tar --strip-components 1 -xvzf docker-${DOCKER_VERSION}.tgz -C /usr/bin docker/docker && \ + rm -f docker-${DOCKER_VERSION}.tgz && \ + chmod +x /usr/bin/docker + +# # Install `wsk` cli in /usr/local/bin +RUN wget -q https://github.com/apache/incubator-openwhisk-cli/releases/download/$WHISK_CLI_VERSION/OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz && \ + tar xzf OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz -C /usr/local/bin wsk && \ + rm OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz + +# # Install `wskdeploy` cli in /usr/local/bin +RUN wget -q https://github.com/apache/incubator-openwhisk-wskdeploy/releases/download/$WHISKDEPLOY_CLI_VERSION/openwhisk_wskdeploy-$WHISKDEPLOY_CLI_VERSION-linux-amd64.tgz && \ + tar xzf openwhisk_wskdeploy-$WHISK_CLI_VERSION-linux-amd64.tgz -C /usr/local/bin wskdeploy && \ + rm openwhisk_wskdeploy-$WHISK_CLI_VERSION-linux-amd64.tgz diff --git a/tools/ansibleRunner/README.md b/tools/ow-utils/README.md similarity index 71% rename from tools/ansibleRunner/README.md rename to tools/ow-utils/README.md index 13afef93d77..0a06963afe9 100644 --- a/tools/ansibleRunner/README.md +++ b/tools/ow-utils/README.md @@ -17,11 +17,12 @@ # --> -Utility image for executing ansible playbooks +Utility image for executing tasks ================ -The `ansible-runner` base image is intended to be used to execute -utility tasks defined as ansible playbooks. The playbook to be -executed should be mounted in the container as /task/playbook.yml by -Kubernetes/Docker/Mesos. +This `ow-utils` image can be used to execute various utility tasks +for OpenWhisk using most of the tools that are used in the project. +It includes a JDK8, python/ansible, nodejs, and standard packages +such as bash, git, wget, curl, and docker. +It also includes the `wsk` and `wskdeploy` CLIs. diff --git a/tools/scriptRunner/build.gradle b/tools/ow-utils/build.gradle similarity index 95% rename from tools/scriptRunner/build.gradle rename to tools/ow-utils/build.gradle index fe536e80521..c4e79324fd7 100644 --- a/tools/scriptRunner/build.gradle +++ b/tools/ow-utils/build.gradle @@ -15,5 +15,5 @@ * limitations under the License. */ -ext.dockerImageName = 'script-runner' +ext.dockerImageName = 'ow-utils' apply from: '../../gradle/docker.gradle' diff --git a/tools/scriptRunner/Dockerfile b/tools/scriptRunner/Dockerfile deleted file mode 100644 index 868a4d55624..00000000000 --- a/tools/scriptRunner/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more contributor -# license agreements; and to You under the Apache License, Version 2.0. - -FROM node:slim - -RUN apt-get update && apt-get install -y \ - git \ - wget \ - zip - -# Install `wsk` cli in /usr/local/bin -ENV WHISK_CLI_VERSION latest -RUN wget -q https://github.com/apache/incubator-openwhisk-cli/releases/download/$WHISK_CLI_VERSION/OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz && \ - tar xzf OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz -C /usr/local/bin wsk && \ - rm OpenWhisk_CLI-$WHISK_CLI_VERSION-linux-amd64.tgz - -# Install `wskdeploy` cli in /usr/local/bin -ENV WHISKDEPLOY_CLI_VERSION latest -RUN wget -q https://github.com/apache/incubator-openwhisk-wskdeploy/releases/download/$WHISKDEPLOY_CLI_VERSION/openwhisk_wskdeploy-$WHISKDEPLOY_CLI_VERSION-linux-amd64.tgz && \ - tar xzf openwhisk_wskdeploy-$WHISK_CLI_VERSION-linux-amd64.tgz -C /usr/local/bin wskdeploy && \ - rm openwhisk_wskdeploy-$WHISK_CLI_VERSION-linux-amd64.tgz - -COPY init.sh /init.sh -RUN chmod +x /init.sh - -CMD ["/init.sh"] diff --git a/tools/scriptRunner/README.md b/tools/scriptRunner/README.md deleted file mode 100644 index 06b9d19736e..00000000000 --- a/tools/scriptRunner/README.md +++ /dev/null @@ -1,28 +0,0 @@ - - -Utility image for executing bash scripts -================ - -The `script-runner` base image is intended to be used to execute -utility tasks defined as bash scripts. The script to be executed -should be mounted in the container as /task/myTask.sh by -Kubernetes/Docker/Mesos. The `wsk` cli is installed in /usr/local/bin -to make it easily available to the scripts. - diff --git a/tools/scriptRunner/init.sh b/tools/scriptRunner/init.sh deleted file mode 100755 index e76c2caa27d..00000000000 --- a/tools/scriptRunner/init.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one or more contributor -# license agreements; and to You under the Apache License, Version 2.0. - -set -ex - -# Run the custom task mounted into /task by kube/docker -if [ -f /task/myTask.sh ]; then - . /task/myTask.sh -else - echo "I was not given a task to execute. Exiting with error" - exit 1 -fi