Upgrade to common-packer 77/36877/1
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Mon, 19 Mar 2018 20:41:33 +0000 (13:41 -0700)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Tue, 20 Mar 2018 01:08:09 +0000 (01:08 +0000)
- Enable builder.json
- Relove unused provision scripts
- Update ci-management-packer-jobs
- Update builder.yaml

Change-Id: I0c9abcd33fd3acb84690863dca966a01731dc64c
Issue-ID: CIMAN-33
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
13 files changed:
jjb/ci-management/ci-management-packer-jobs.yaml [new file with mode: 0644]
jjb/ci-management/ci-management.yaml
jjb/global-defaults.yaml
packer/README.markdown
packer/provision/docker.sh [deleted file]
packer/provision/local-builder.yaml [new file with mode: 0644]
packer/provision/local-docker.yaml [new file with mode: 0644]
packer/templates/basebuild.json [deleted file]
packer/templates/builder.json [new symlink]
packer/templates/docker.json [changed from file to symlink]
packer/vars/cloud-env.json.example
packer/vars/ubuntu-14.04.json
packer/vars/ubuntu-16.04.json

diff --git a/jjb/ci-management/ci-management-packer-jobs.yaml b/jjb/ci-management/ci-management-packer-jobs.yaml
new file mode 100644 (file)
index 0000000..41a3853
--- /dev/null
@@ -0,0 +1,71 @@
+---
+- project:
+    name: packer-builder-jobs
+    jobs:
+      - gerrit-packer-merge
+
+    project: ci-management
+    project-name: ci-management
+    branch: master
+    archive-artifacts: '**/*.log'
+
+    build-node: ubuntu1604-builder-2c-1g
+    build-timeout: 90
+
+    platforms:
+      - centos-7
+      - ubuntu-16.04
+    templates: builder
+
+- project:
+    name: packer-docker-jobs
+    jobs:
+      - gerrit-packer-merge
+
+    project: ci-management
+    project-name: ci-management
+    branch: master
+    archive-artifacts: '**/*.log'
+
+    build-node: ubuntu1604-builder-2c-1g
+    build-timeout: 60
+
+    platforms:
+      - centos-7
+      - ubuntu-16.04
+    templates: docker
+
+- project:
+    name: packer-memcached-jobs
+    jobs:
+      - gerrit-packer-merge
+
+    project: ci-management
+    project-name: ci-management
+    branch: master
+    archive-artifacts: '**/*.log'
+
+    build-node: ubuntu1604-builder-2c-1g
+    build-timeout: 90
+
+    platforms:
+      - centos-7
+      - ubuntu-16.04
+    templates: memcached
+
+- project:
+    name: packer-redis-jobs
+    jobs:
+      - gerrit-packer-merge
+
+    project: ci-management
+    project-name: ci-management
+    branch: master
+    archive-artifacts: '**/*.log'
+
+    build-node: ubuntu1604-builder-2c-1g
+
+    platforms:
+      - centos-7
+      - ubuntu-16.04
+    templates: redis
index 528639e..184bf89 100644 (file)
     build-node: 'centos7-builder-2c-1g'
     jjb-version: 2.0.0
 
-- project:
-    name: packer-jobs
-    # packer jobs templates are defined in global-jjb
-    jobs:
-      - '{project-name}-packer-jobs'
-    project: 'ci-management'
-    project-name: 'ci-management'
-    branch: master
-    archive-artifacts: '**/*.log'
-    build-node: 'centos7-builder-2c-1g'
-    platforms:
-      - centos
-      - ubuntu-16.04
-    templates:
-      - builder
-      - docker
-      - memcached
-      - redis
-    exclude:
-      # only build the docker image on ubuntu at present
-      - platforms: centos
-        templates: docker
-
 - job-template:
     name: '{project}-verify-jjb'
 
index 64f6a74..51cf6c6 100644 (file)
@@ -14,6 +14,9 @@
     # lf-infra defaults
     lftools-version: <1.0.0
 
+    # packer_version
+    packer-version: 1.1.3
+
     # default gerrit server definition
     server-name: 'Primary'
     gerrit-server-name: 'Primary'
index 4972aff..1ef176a 100644 (file)
@@ -12,10 +12,10 @@ You'll need to [install Packer][2], of course.
 Open-O's Packer configuration is divided into build-specific variables,
 output-specific templates and a set of shared provisioning scripts. To do a
 specific build, combine the template for the desired output artifact type with
-a variable file. To build a new basebuild instance the following would be done:
+a variable file. To build a new builder instance the following would be done:
 
 ```
-packer build -var-file=vars/cloud-env.json -var-file=vars/centos.json templates/basebuild.json
+packer build -var-file=vars/cloud-env.json -var-file=vars/centos.json templates/builder.json
 ```
 
 **NOTE:** vars/cloud-env.json is a gitignored file as it contains private
diff --git a/packer/provision/docker.sh b/packer/provision/docker.sh
deleted file mode 100644 (file)
index 9d34eb0..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/bash
-
-# vim: ts=4 sw=4 sts=4 et tw=72 :
-
-# force any errors to cause the script and job to end in failure
-set -xeu -o pipefail
-
-rh_systems() {
-    # Assumes that python is already installed by basebuild
-
-    # Install dependencies for robotframework and robotframework-sshlibrary
-    yum install -y yum-utils unzip sshuttle nc libffi-devel openssl-devel
-
-    # Install docker
-    yum install -y docker supervisor bridge-utils
-    systemctl enable docker
-
-    # configure docker networking so that it does not conflict with LF
-    # internal networks
-    cat <<EOL > /etc/sysconfig/docker-network
-# /etc/sysconfig/docker-network
-DOCKER_NETWORK_OPTIONS='--bip=10.250.0.254/24'
-EOL
-    # configure docker daemon to listen on port 5555 enabling remote
-    # managment
-    sed -i -e "s#='--selinux-enabled'#='--selinux-enabled -H unix:///var/run/docker.sock -H tcp://0.0.0.0:5555'#g" /etc/sysconfig/docker
-
-    # docker group doesn't get created by default for some reason
-    groupadd docker
-}
-
-ubuntu_docker_mtu_fix(){
-    echo "---> Fixing docker's mtu settings"
-    systemctl stop docker
-    cat <<'EOL' > /etc/systemd/system/docker.service
-[Unit]
-Description=Docker Application Container Engine
-Documentation=https://docs.docker.com
-After=network.target docker.socket
-Requires=docker.socket
-
-[Service]
-Type=notify
-# the default is not to use systemd for cgroups because the delegate issues still
-# exists and systemd currently does not support the cgroup feature set required
-# for containers run by docker
-ExecStart=
-ExecStart=/usr/bin/dockerd --mtu 1454 -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
-ExecReload=/bin/kill -s HUP $MAINPID
-# Having non-zero Limit*s causes performance problems due to accounting overhead
-# in the kernel. We recommend using cgroups to do container-local accounting.
-LimitNOFILE=infinity
-LimitNPROC=infinity
-LimitCORE=infinity
-# Uncomment TasksMax if your systemd version supports it.
-# Only systemd 226 and above support this version.
-TasksMax=infinity
-TimeoutStartSec=0
-# set delegate yes so that systemd does not reset the cgroups of docker containers
-Delegate=yes
-# kill only the docker process, not all processes in the cgroup
-KillMode=process
-
-[Install]
-WantedBy=multi-user.target
-EOL
-    systemctl start docker
-    echo "---> Checking MTU"
-    docker network inspect bridge
-    echo "---> MTU set to 1454"
-}
-
-ubuntu_systems() {
-    # Assumes that python is already installed by basebuild
-
-    # Install Python3.6
-    sudo add-apt-repository -y ppa:jonathonf/python-3.6
-    sudo apt-get update
-    sudo apt-get install -y python3.6 python3.6-dev
-
-    # Install dependencies for robotframework and robotframework-sshlibrary
-    apt install -y unzip sshuttle netcat libffi-dev libssl-dev
-    wget https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz
-    tar xvzf geckodriver-v0.18.0-linux64.tar.gz -C /usr/local/bin
-    export PATH=$PATH:/usr/local/bin
-
-    # Install docker
-    apt install -y docker.io
-
-    # Fixing Docker MTU settings
-    ubuntu_docker_mtu_fix
-}
-
-all_systems() {
-    # Install docker-compose
-    curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"
-    chmod +x /usr/local/bin/docker-compose
-    docker-compose -v
-}
-
-echo "---> Detecting OS"
-ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
-
-case "${ORIGIN}" in
-    fedora|centos|redhat)
-        echo "---> RH type system detected"
-        rh_systems
-    ;;
-    ubuntu)
-        echo "---> Ubuntu system detected"
-        ubuntu_systems
-    ;;
-    *)
-        echo "---> Unknown operating system"
-    ;;
-esac
-
-# execute steps for all systems
-all_systems
diff --git a/packer/provision/local-builder.yaml b/packer/provision/local-builder.yaml
new file mode 100644 (file)
index 0000000..a54fc02
--- /dev/null
@@ -0,0 +1,17 @@
+---
+- import_playbook: ../common-packer/provision/baseline.yaml
+
+- hosts: all
+  become_user: root
+  become_method: sudo
+
+  pre_tasks:
+    - include_role: name=system-update
+
+  roles:
+    - protobuf-install
+
+  post_tasks:
+    - name: System Reseal
+      script: ../common-packer/provision/system-reseal.sh
+      become: true
diff --git a/packer/provision/local-docker.yaml b/packer/provision/local-docker.yaml
new file mode 100644 (file)
index 0000000..fce32a4
--- /dev/null
@@ -0,0 +1,17 @@
+---
+- import_playbook: ../common-packer/provision/docker.yaml
+
+- hosts: all
+  become_user: root
+  become_method: sudo
+
+  pre_tasks:
+    - include_role: name=system-update
+
+  roles:
+    - protobuf-install
+
+  post_tasks:
+    - name: System Reseal
+      script: ../common-packer/provision/system-reseal.sh
+      become: true
diff --git a/packer/templates/basebuild.json b/packer/templates/basebuild.json
deleted file mode 100644 (file)
index ff84a72..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-  "variables": {
-    "stack_tenant": null,
-    "stack_user": null,
-    "stack_pass": null,
-    "stack_network": null,
-    "base_image": null,
-    "cloud_user": null,
-    "distro": null,
-    "cloud_user_data": null
-  },
-  "builders": [
-    {
-      "type": "openstack",
-      "identity_endpoint": "https://auth.vexxhost.net/v2.0/",
-      "tenant_name": "{{user `stack_tenant`}}",
-      "username": "{{user `stack_user`}}",
-      "password": "{{user `stack_pass`}}",
-      "region": "ca-ymq-1",
-      "ssh_username": "{{user `cloud_user`}}",
-      "image_name": "{{user `distro`}} - basebuild - {{isotime \"20060102-1504\"}}",
-      "source_image_name": "{{user `base_image`}}",
-      "flavor": "v1-standard-1",
-      "availability_zone": "ca-ymq-2",
-      "networks": [
-        "{{user `stack_network`}}"
-      ],
-      "user_data_file": "{{user `cloud_user_data`}}"
-    }
-  ],
-  "provisioners": [
-    {
-      "type": "shell",
-      "inline": [
-        "mkdir -p /tmp/packer"
-      ]
-    },
-    {
-      "type": "file",
-      "source": "provision/basebuild/",
-      "destination": "/tmp/packer"
-    },
-    {
-      "type": "shell",
-      "scripts": [
-        "provision/baseline.sh",
-        "provision/basebuild.sh",
-        "provision/system_reseal.sh"
-      ],
-      "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
-    }
-  ]
-}
diff --git a/packer/templates/builder.json b/packer/templates/builder.json
new file mode 120000 (symlink)
index 0000000..bd227be
--- /dev/null
@@ -0,0 +1 @@
+../common-packer/templates/builder.json
\ No newline at end of file
deleted file mode 100644 (file)
index 1c8d3ec5692af50c0e16c70837f25eb9a38ef516..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,54 +0,0 @@
-{
-  "variables": {
-    "stack_tenant": null,
-    "stack_user": null,
-    "stack_pass": null,
-    "stack_network": null,
-    "base_image": null,
-    "cloud_user": null,
-    "distro": null,
-    "cloud_user_data": null
-  },
-  "builders": [
-    {
-      "type": "openstack",
-      "identity_endpoint": "https://auth.vexxhost.net/v2.0/",
-      "tenant_name": "{{user `stack_tenant`}}",
-      "username": "{{user `stack_user`}}",
-      "password": "{{user `stack_pass`}}",
-      "region": "ca-ymq-1",
-      "ssh_username": "{{user `cloud_user`}}",
-      "image_name": "{{user `distro`}} - docker - {{isotime \"20060102-1504\"}}",
-      "source_image_name": "{{user `base_image`}}",
-      "flavor": "v1-standard-1",
-      "availability_zone": "ca-ymq-2",
-      "networks": [
-        "{{user `stack_network`}}"
-      ],
-      "user_data_file": "{{user `cloud_user_data`}}"
-    }
-  ],
-  "provisioners": [
-    {
-      "type": "shell",
-      "inline": [
-        "mkdir -p /tmp/packer"
-      ]
-    },
-    {
-      "type": "file",
-      "source": "provision/basebuild/",
-      "destination": "/tmp/packer"
-    },
-    {
-      "type": "shell",
-      "scripts": [
-        "provision/baseline.sh",
-        "provision/basebuild.sh",
-        "provision/docker.sh",
-        "provision/system_reseal.sh"
-      ],
-      "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
-    }
-  ]
-}
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..edea6d28521d3bd753054f0a7c636efb53f7aa0e
--- /dev/null
@@ -0,0 +1 @@
+../common-packer/templates/docker.json
\ No newline at end of file
index 3a2ea9d..451c5da 100644 (file)
@@ -3,4 +3,5 @@
   "stack_user": "USERID",
   "stack_pass": "PASSWD",
   "stack_network": "NETID",
+  "ssh_proxy_host": ""
 }
index dd81e25..882d959 100644 (file)
@@ -1,6 +1,6 @@
 {
-  "base_image": "Ubuntu 14.04 (2017-02-01) - LF upload",
-  "cloud_user": "ubuntu",
+  "base_image": "LF - Ubuntu 14.04 LTS (2017-12-01)",
   "distro": "Ubuntu 14.04",
+  "ssh_user": "ubuntu",
   "cloud_user_data": "provision/null_data.sh"
 }
index 12f9430..b55f96b 100644 (file)
@@ -1,6 +1,6 @@
 {
-  "base_image": "Ubuntu 16.04 (2017-02-01) - LF upload",
-  "cloud_user": "ubuntu",
+  "base_image": "LF - Ubuntu 16.04 LTS (2017-12-01)",
   "distro": "Ubuntu 16.04",
+  "ssh_user": "ubuntu",
   "cloud_user_data": "provision/null_data.sh"
 }