This is an automated email from the ASF dual-hosted git repository.
houshengbo 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 5b055f0 Initial commit to add the deployment configuration for
Jenkins (#4345)
5b055f0 is described below
commit 5b055f038d569f06e2041deac6c0359735895c17
Author: Vincent <[email protected]>
AuthorDate: Fri Mar 15 21:27:07 2019 -0400
Initial commit to add the deployment configuration for Jenkins (#4345)
Closes-Bug: #4335
---
ansible/environments/jenkins/ansible_jenkins.cfg | 13 +++++
ansible/environments/jenkins/group_vars/all | 36 ++++++++++++
ansible/environments/jenkins/hosts.j2.ini | 36 ++++++++++++
ansible/setup.yml | 4 ++
tools/jenkins/Jenkinsfile | 72 ++++++++++++++++++++++++
5 files changed, 161 insertions(+)
diff --git a/ansible/environments/jenkins/ansible_jenkins.cfg
b/ansible/environments/jenkins/ansible_jenkins.cfg
new file mode 100644
index 0000000..55fd45b
--- /dev/null
+++ b/ansible/environments/jenkins/ansible_jenkins.cfg
@@ -0,0 +1,13 @@
+[defaults]
+
+callback_whitelist = profile_tasks
+retry_files_enabled = False
+host_key_checking = False
+inventory = environments/jenkins
+callback_plugins = callbacks
+hash_behaviour = merge
+remote_user = openwhisk
+private_key_file=/home/jenkins/secret/openwhisk_key
+
+[ssh_connection]
+scp_if_ssh = True
diff --git a/ansible/environments/jenkins/group_vars/all
b/ansible/environments/jenkins/group_vars/all
new file mode 100755
index 0000000..9377a7d
--- /dev/null
+++ b/ansible/environments/jenkins/group_vars/all
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
contributor
+# license agreements; and to You under the Apache License, Version 2.0.
+
+openwhisk_tmp_dir: "{{ lookup('env', 'OPENWHISK_TMP_DIR')|default('/tmp',
true) }}"
+config_root_dir: "{{ openwhisk_tmp_dir }}/wskconf"
+whisk_logs_dir: "{{ openwhisk_tmp_dir }}/wsklogs"
+coverage_enabled: "{{ lookup('env', 'GRADLE_COVERAGE') | default('false',
true) | bool}}"
+coverage_logs_dir: "{{ openwhisk_tmp_dir }}/wskcov"
+docker_registry: ""
+docker_dns: ""
+runtimes_bypass_pull_for_local_images: true
+invoker_use_runc: "{{ ansible_distribution != 'MacOSX' }}"
+
+db_prefix: whisk_local_
+
+# API GW connection configuration
+apigw_auth_user: ""
+apigw_auth_pwd: ""
+apigw_host_v2: "http://{{ groups['apigateway']|first
}}:{{apigateway.port.api}}/v2"
+
+invoker_allow_multiple_instances: true
+
+# Set kafka configuration
+kafka_heap: '512m'
+kafka_topics_completed_retentionBytes: 104857600
+kafka_topics_completed_retentionMS: 300000
+kafka_topics_health_retentionBytes: 104857600
+kafka_topics_health_retentionMS: 300000
+kafka_topics_invoker_retentionBytes: 104857600
+kafka_topics_invoker_retentionMS: 300000
+
+env_hosts_dir: "{{ playbook_dir }}/environments/jenkins"
+
+container_pool_akka_client: true
+runtimes_enable_concurrency: true
+limit_action_concurrency_max: 500
diff --git a/ansible/environments/jenkins/hosts.j2.ini
b/ansible/environments/jenkins/hosts.j2.ini
new file mode 100644
index 0000000..a6c6cb7
--- /dev/null
+++ b/ansible/environments/jenkins/hosts.j2.ini
@@ -0,0 +1,36 @@
+; the first parameter in a host is the inventory_hostname
+
+; used for local actions only
+ansible ansible_connection=local
+
+[edge]
+144.76.63.94 ansible_host=144.76.63.94 ansible_connection=local
+
+[controllers]
+controller0 ansible_host=144.76.63.94 ansible_connection=local
+;{% if mode is defined and 'HA' in mode %}
+;controller1 ansible_host=144.76.63.94 ansible_connection=local
+;{% endif %}
+
+[kafkas]
+kafka0 ansible_host=144.76.63.94 ansible_connection=local
+{% if mode is defined and 'HA' in mode %}
+kafka1 ansible_host=144.76.63.94 ansible_connection=local
+{% endif %}
+
+[zookeepers:children]
+kafkas
+
+[invokers]
+invoker0 ansible_host=5.9.20.92 ansible_connection=ssh
+invoker1 ansible_host=144.76.27.183 ansible_connection=ssh
+
+; db group is only used if db.provider is CouchDB
+[db]
+144.76.63.94 ansible_host=144.76.63.94 ansible_connection=local
+
+[redis]
+144.76.63.94 ansible_host=144.76.63.94 ansible_connection=local
+
+[apigateway]
+144.76.63.94 ansible_host=144.76.63.94 ansible_connection=local
diff --git a/ansible/setup.yml b/ansible/setup.yml
index f6cef2e..3f02004 100644
--- a/ansible/setup.yml
+++ b/ansible/setup.yml
@@ -24,6 +24,10 @@
local_action: template
src="{{playbook_dir}}/environments/docker-machine/hosts.j2.ini" dest="{{
playbook_dir }}/environments/docker-machine/hosts"
when: "'environments/docker-machine' in hosts_dir"
+ - name: gen hosts for Jenkins
+ local_action: template
src="{{playbook_dir}}/environments/jenkins/hosts.j2.ini" dest="{{ playbook_dir
}}/environments/jenkins/hosts"
+ when: "'environments/jenkins' in hosts_dir"
+
- name: Refresh inventory to ensure generated hosts files are used
meta: refresh_inventory
diff --git a/tools/jenkins/Jenkinsfile b/tools/jenkins/Jenkinsfile
new file mode 100644
index 0000000..6565d8d
--- /dev/null
+++ b/tools/jenkins/Jenkinsfile
@@ -0,0 +1,72 @@
+#!groovy
+/*
+ * 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.
+ */
+
+timeout(time: 4, unit: 'HOURS') {
+
+ node("openwhisk2") {
+ deleteDir()
+ stage ('Checkout and build on OpenWhisk2') {
+ checkout([$class: 'GitSCM', branches: [[name: '${Branch}']],
doGenerateSubmoduleConfigurations: false,
+ extensions: [], submoduleCfg: [],
+ userRemoteConfigs: [[credentialsId: '', url:
'https://github.com/${Fork}/${RepoName}']]])
+ sh './gradlew :core:invoker:distDocker'
+ }
+ }
+
+ node("openwhisk3") {
+ deleteDir()
+ stage ('Checkout and build on OpenWhisk3') {
+ checkout([$class: 'GitSCM', branches: [[name: '${Branch}']],
doGenerateSubmoduleConfigurations: false,
+ extensions: [], submoduleCfg: [],
+ userRemoteConfigs: [[credentialsId: '', url:
'https://github.com/${Fork}/${RepoName}']]])
+ sh './gradlew :core:invoker:distDocker'
+ }
+ }
+
+ node("openwhisk1") {
+ deleteDir()
+ stage ('Checkout and build on OpenWhisk1') {
+ checkout([$class: 'GitSCM', branches: [[name: '${Branch}']],
doGenerateSubmoduleConfigurations: false,
+ extensions: [], submoduleCfg: [],
+ userRemoteConfigs: [[credentialsId: '', url:
'https://github.com/${Fork}/${RepoName}']]])
+ sh './gradlew distDocker'
+ }
+
+ stage('Deploy') {
+ dir("ansible") {
+ sh '[ -f "environments/jenkins/ansible_jenkins.cfg" ] && cp
environments/jenkins/ansible_jenkins.cfg ansible.cfg'
+ sh 'ansible-playbook -i environments/jenkins setup.yml'
+ sh 'ansible-playbook -i environments/jenkins openwhisk.yml -e
mode=clean'
+ sh 'ansible-playbook -i environments/jenkins apigateway.yml -e
mode=clean'
+ sh 'ansible-playbook -i environments/jenkins couchdb.yml -e
mode=clean'
+ sh 'ansible-playbook -i environments/jenkins couchdb.yml'
+ sh 'ansible-playbook -i environments/jenkins initdb.yml'
+ sh 'ansible-playbook -i environments/jenkins wipe.yml'
+ sh 'ansible-playbook -i environments/jenkins apigateway.yml'
+ sh 'ansible-playbook -i environments/jenkins openwhisk.yml'
+ sh 'ansible-playbook -i environments/jenkins properties.yml'
+ sh 'ansible-playbook -i environments/jenkins routemgmt.yml'
+ sh 'ansible-playbook -i environments/jenkins postdeploy.yml'
+ }
+ }
+
+ stage('Test') {
+ sh './gradlew :tests:test'
+ }
+ }
+}