Merge "Added BMH e2e test and enabled kud plugins"
authorKuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Wed, 13 Nov 2019 04:09:04 +0000 (04:09 +0000)
committerGerrit Code Review <gerrit@akraino.org>
Wed, 13 Nov 2019 04:09:04 +0000 (04:09 +0000)
14 files changed:
Makefile
ci/README.md
ci/jjb/akraino-icn-templates.yaml
ci/jjb/project.yaml
ci/jjb/shell/bm-verify.sh [new file with mode: 0644]
ci/jjb/shell/org-logs-deploy.sh
ci/jjb/shell/vagrant-verify.sh [moved from ci/jjb/shell/verify.sh with 93% similarity]
deploy/metal3/scripts/01_metal3.sh
env/lib/common.sh
env/metal3/01_install_package.sh
env/metal3/02_configure.sh
env/metal3/03_launch_prereq.sh
env/metal3/06_host_cleanup.sh
user_config.sh

index 6c24bdf..972fa22 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,7 @@ help:
 install: bmh_all
 
 bmh_preinstall:
+       source user_config.sh && env && \
        pushd $(BMDIR) && ./01_install_package.sh && ./02_configure.sh && \
        ./03_launch_prereq.sh && popd
 
@@ -30,6 +31,7 @@ bmh_clean_host:
        pushd $(BMDIR) && ./06_host_cleanup.sh && popd
 
 bmh_install:
+       source user_config.sh && env && \
        pushd $(METAL3DIR) && ./01_metal3.sh launch && \
         ./01_metal3.sh provision && ./02_verify.sh && popd
 
index 5e3e444..d3a4200 100644 (file)
@@ -25,17 +25,33 @@ Once the playbook is successful, we can visite the jenkins server at http://<lis
 ## What to do next
 
 1. Add the gerrit ssh key as jenkins credential, so that our jobs can pull code from the gerrit.
-The credential ID field must be `jenkins-ssh`. As this is hard coded in the jobs.
+The credential ID field must be `jenkins-ssh`, as this is hard coded in the jobs. The type should
+be private key. The user name is the gerrit account name.
 2. To push the logs to Akraino Nexus server, we need to create the authentication file for lftools.
-The file path is `/var/lib/jenkins/.netrc` and the content should be one line
-`machine nexus.akraino.org login the_name password the_pass`
+The file should be owned by jenkins user. The file path is `/var/lib/jenkins/.netrc` and
+the content should be one line `machine nexus.akraino.org login the_name password the_pass`
 3. The last step is to deploy our CD jobs by jenkins-job-builder tool.
 
 ```
-git clone "https://gerrit.akraino.org/r/ci-management"
+git clone --recursive "https://gerrit.akraino.org/r/ci-management"
 git clone "https://gerrit.akraino.org/r/icn"
 # create the jjb config file before moving on
 # https://docs.releng.linuxfoundation.org/en/latest/jenkins-sandbox.html
 jenkins-jobs test ci-management/jjb:icn/ci/jjb icn-master-verify
 jenkins-jobs update ci-management/jjb:icn/ci/jjb icn-master-verify
 ```
+
+A sample of jjb config file
+```
+[job_builder]
+ignore_cache=True
+keep_descriptions=False
+recursive=True
+retain_anchors=True
+update=jobs
+
+[jenkins]
+user=admin
+password=admin
+url=http://localhost:8080
+```
index b2367ef..3bab6ac 100644 (file)
@@ -1,7 +1,7 @@
 ---
 - job-template:
-    id: icn-stream-verify-target
-    name: 'icn-{stream}-verify-{target}'
+    id: icn-stream-vagrant-verify-target
+    name: 'icn-{stream}-vagrant-verify-{target}'
     defaults: icn
     archive-artifacts: >
       **/*.log
 
     builders:
       - shell: !include-raw:
-          - shell/verify.sh
+          - shell/vagrant-verify.sh
+
+    publishers:
+      - icn-infra-publish
+#      - email:
+#          recipients: icn.jenkins@intel.com
+
+- job-template:
+    id: icn-stream-bm-verify-target
+    name: 'icn-{stream}-bm-verify-{target}'
+    defaults: icn
+    archive-artifacts: >
+      **/*.log
+    build-days-to-keep: 30
+    build-timeout: 60
+    stream: master
+    target: verifier
+    project-type: freestyle
+    submodule-recursive: true
+    #node: '{build-node}'
+
+    properties:
+      - lf-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    parameters:
+      - lf-infra-parameters:
+          project: '{project}'
+          stream: '{stream}'
+          branch: '{branch}'
+          lftools-version: '{lftools-version}'
+
+      - string:
+          name: ARCHIVE_ARTIFACTS
+          default: '{archive-artifacts}'
+          description: Artifacts to archive to the logs server.
+
+      - string:
+          name: NEXUS_LOG_SUBDIR
+          default: '{nexus_log_subdir}'
+          description: Organization sub dir on Akraino Nexus server.
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+          git-url: '{git-url}/{project}.git'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-recursive: '{submodule-recursive}'
+          submodule-timeout: '{submodule-timeout}'
+          submodule-disable: false
+          choosing-strategy: 'gerrit'
+
+    triggers:
+      - timed: "@midnight"
+
+    builders:
+      - shell: !include-raw:
+          - shell/bm-verify.sh
 
     publishers:
       - icn-infra-publish
index eb0415f..e3800c4 100644 (file)
@@ -1,6 +1,6 @@
 ---
 - project:
-    name: icn-private
+    name: icn-vagrant
     project: icn
     project-name: icn
     nexus_log_subdir: intel/ICN_CD_logs
       - master:
           branch: master
     jobs:
-      - icn-stream-verify-target
+      - icn-stream-vagrant-verify-target
+
+- project:
+    name: icn-bm
+    project: icn
+    project-name: icn
+    nexus_log_subdir: intel/ICN_CD_logs
+    target:
+      - bm_verifer
+    stream:
+      - master:
+          branch: master
+    jobs:
+      - icn-stream-bm-verify-target
diff --git a/ci/jjb/shell/bm-verify.sh b/ci/jjb/shell/bm-verify.sh
new file mode 100644 (file)
index 0000000..c9308fa
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash -l
+echo "---> bm-verify.sh"
+
+# Ensure we fail the job if any steps fail
+# Disable 'globbing'
+set -exuf -o pipefail
+
+sudo apt update
+sudo apt install -y make
+sudo su -c 'make {target}'
index ca828cb..4919a4f 100644 (file)
@@ -14,7 +14,7 @@ echo "---> logs-deploy.sh"
 # Disable 'globbing'
 set -euf -o pipefail
 
-JENKINS_HOSTNAME=pod14-node2
+JENKINS_HOSTNAME=`hostname`
 NEXUS_URL=https://nexus.akraino.org
 LOGS_SERVER=https://logs.akraino.org
 
similarity index 93%
rename from ci/jjb/shell/verify.sh
rename to ci/jjb/shell/vagrant-verify.sh
index a5e68fa..65148aa 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash -l
-echo "---> verify.sh"
+echo "---> vagrant-verify.sh"
 
 # Ensure we fail the job if any steps fail
 # Disable 'globbing'
index 0cc7ba0..6e6a1e9 100755 (executable)
@@ -116,8 +116,21 @@ write_files:
         sudo ifconfig `basename $intf` up
         sudo dhclient -nw `basename $intf`
     done
+EOF
+cat << EOF
+- path: /opt/user_net.sh
+  owner: root:root
+  permissions: '0777'
+  content: |
+    #!/usr/bin/env bash
+    set -xe
+    route add default gw $PROVIDER_NETWORK_GATEWAY
+    sed -i -e 's/^#DNS=.*/DNS=$PROVIDER_NETWORK_DNS/g' /etc/systemd/resolved.conf
+    systemctl daemon-reload
+    systemctl restart systemd-resolved
 runcmd:
  - [ /opt/ironic_net.sh ]
+ - [ /opt/user_net.sh ]
 EOF
 }
 
index 09b548e..52d4f61 100755 (executable)
@@ -1,9 +1,5 @@
 #!/bin/bash
 
-ICNDIR="$(dirname "$(dirname "$PWD")")"
-echo $ICNDIR
-source $ICNDIR/user_config.sh
-
 #supported OS version
 UBUNTU_BIONIC=${UBUNTU_BIONIC:-Ubuntu 18.04.2 LTS}
 
@@ -25,6 +21,10 @@ BS_DHCP_INTERFACE=${BS_DHCP_INTERFACE:-}
 BS_DHCP_INTERFACE_IP=${BS_DHCP_INTERFACE_IP:-}
 BS_DHCP_DIR=${BS_DHCP_DIR:-$DOWNLOAD_PATH/dhcp}
 
+#User Provider Network configuration
+PROVIDER_NETWORK_GATEWAY=${PROVIDER_NETWORK_GATEWAY:-}
+PROVIDER_NETWORK_DNS=${PROVIDER_NETWORK_DNS:-}
+
 #Ironic variables
 IRONIC_IMAGE=${IRONIC_IMAGE:-"quay.io/metal3-io/ironic:master"}
 IRONIC_INSPECTOR_IMAGE=${IRONIC_INSPECTOR_IMAGE:-"quay.io/metal3-io/ironic-inspector"}
index 8aa458f..ef82f46 100755 (executable)
@@ -106,9 +106,10 @@ EOF'
 install() {
     install_essential_packages
     install_ironic_packages $1
-    install_docker_packages $1
-    install_podman_packages $1
-    install_kubernetes_packages $1
+
+    #install_docker_packages $1
+    #install_podman_packages $1
+    #install_kubernetes_packages $1
 }
 
 if ["$1" == "-o"]; then
index eabf780..490c438 100755 (executable)
@@ -131,8 +131,11 @@ function configure_ironic {
        return
     fi
 
-    podman pull $IRONIC_IMAGE
-    podman pull $IRONIC_INSPECTOR_IMAGE
+    #Podman usage is deprecated for v1.0.0 release
+    #podman pull $IRONIC_IMAGE
+    docker pull $IRONIC_IMAGE
+    #podman pull $IRONIC_INSPECTOR_IMAGE
+    docker pull $IRONIC_INSPECTOR_IMAGE
 
     mkdir -p "$IRONIC_DATA_DIR/html/images"
     pushd $IRONIC_DATA_DIR/html/images
@@ -149,8 +152,9 @@ function configure_ironic {
 }
 
 function configure {
-    configure_kubeadm $1
-    configure_kubelet
+    #Kubeadm usage deprecated for v1.0.0 release
+    #configure_kubeadm $1
+    #configure_kubelet
     configure_ironic $1
     configure_dhcp_bridge
     configure_ironic_bridge
index 771c765..ae42c50 100755 (executable)
@@ -76,31 +76,28 @@ function check_k8s_node_status {
     fi
 }
 
-function install_podman {
+function install_ironic_container {
     # set password for mariadb
     mariadb_password=$(echo $(date;hostname)|sha256sum |cut -c-20)
 
-    # Create pod
-    podman pod create -n ironic-pod
-
     # Start dnsmasq, http, mariadb, and ironic containers using same image
-    podman run -d --net host --privileged --name dnsmasq  --pod ironic-pod \
+    docker run -d --net host --privileged --name dnsmasq \
         -v $IRONIC_DATA_DIR:/shared --entrypoint /bin/rundnsmasq ${IRONIC_IMAGE}
 
-    podman run -d --net host --privileged --name httpd --pod ironic-pod \
+    docker run -d --net host --privileged --name httpd \
         -v $IRONIC_DATA_DIR:/shared --entrypoint /bin/runhttpd ${IRONIC_IMAGE}
 
-    podman run -d --net host --privileged --name mariadb --pod ironic-pod \
+    docker run -d --net host --privileged --name mariadb \
         -v $IRONIC_DATA_DIR:/shared --entrypoint /bin/runmariadb \
         --env MARIADB_PASSWORD=$mariadb_password ${IRONIC_IMAGE}
 
-    podman run -d --net host --privileged --name ironic --pod ironic-pod \
+    docker run -d --net host --privileged --name ironic \
         --env MARIADB_PASSWORD=$mariadb_password \
         -v $IRONIC_DATA_DIR:/shared ${IRONIC_IMAGE}
 
     # Start Ironic Inspector
-    podman run -d --net host --privileged --name ironic-inspector \
-        --pod ironic-pod "${IRONIC_INSPECTOR_IMAGE}"
+    docker run -d --net host --privileged --name ironic-inspector \
+        "${IRONIC_INSPECTOR_IMAGE}"
 }
 
 function remove_k8s_noschedule_taint {
@@ -135,16 +132,17 @@ function install_dhcp {
 }
 
 function install {
+    #Kubeadm usage is deprecated in v1,0,0 version
     #install_kubernetes
-    install_k8s_single_node
-    check_cni_network $1
-    create_k8s_regular_user
-    check_k8s_node_status
-    remove_k8s_noschedule_taint
+    #install_k8s_single_node
+    #check_cni_network $1
+    #create_k8s_regular_user
+    #check_k8s_node_status
+    #remove_k8s_noschedule_taint
 
     #install_podman
     #Todo - error handling mechanism
-    install_podman
+    install_ironic_container
     install_dhcp
 }
 
index 9e8fbde..15792b2 100755 (executable)
@@ -6,15 +6,10 @@ source $LIBDIR/lib/common.sh
 
 # Kill and remove the running ironic containers
 for name in ironic ironic-inspector dnsmasq httpd mariadb; do
-    sudo podman ps | grep -w "$name$" && sudo podman kill $name
-    sudo podman ps --all | grep -w "$name$" && sudo podman rm $name -f
+    sudo docker ps | grep -w "$name$" && sudo docker kill $name
+    sudo docker ps --all | grep -w "$name$" && sudo docker rm $name -f
 done
 
-# Remove existing pod
-if  sudo podman  pod exists ironic-pod ; then
-    sudo podman  pod rm ironic-pod -f
-fi
-
 ip link set provisioning down
 brctl delbr provisioning
 
@@ -24,7 +19,8 @@ brctl delbr dhcp0
 rm -rf ${BS_DHCP_DIR}
 rm -rf ${IRONIC_DATA_DIR}
 
-kubeadm reset -f
-iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X
-rm -rf $HOME/.kube/config
-rm -rf /var/lib/etcd
+#Kubeadm usage is deprecated in v1.0.0
+#kubeadm reset -f
+#iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X
+#rm -rf $HOME/.kube/config
+#rm -rf /var/lib/etcd
index 2b53a51..f0ed1f7 100644 (file)
@@ -1,12 +1,16 @@
 #!/bin/bash
 
 #Local controller - Bootstrap cluster DHCP connection
-BS_DHCP_INTERFACE=${BS_DHCP_INTERFACE:-"ens513f0"}
-BS_DHCP_INTERFACE_IP=${BS_DHCP_INTERFACE_IP:-"172.31.1.1/24"}
+export BS_DHCP_INTERFACE="ens513f0"
+export BS_DHCP_INTERFACE_IP="172.31.1.1/24"
 
 #Ironic Metal3 settings for provisioning network
-IRONIC_INTERFACE=${IRONIC_INTERFACE:-"enp4s0f1"}
+export IRONIC_INTERFACE="enp4s0f1"
 
 #Ironic Metal3 setting for IPMI LAN Network
-IRONIC_IPMI_INTERFACE=${IRONIC_IPMI_INTERFACE:-"enp4s0f0"}
-IRONIC_IPMI_INTERFACE_IP=${IRONIC_IPMI_INTERFACE_IP:-"10.10.110.20"}
+export IRONIC_IPMI_INTERFACE="enp4s0f0"
+export IRONIC_IPMI_INTERFACE_IP="10.10.110.20"
+
+#User Network configuration
+export PROVIDER_NETWORK_GATEWAY="10.10.110.1"
+export PROVIDER_NETWORK_DNS="8.8.8.8"