UDS build server packer files 95/5295/2
authormatthew-mcneilly <matthew.mcneilly@est.tech>
Mon, 6 Jul 2020 16:12:48 +0000 (17:12 +0100)
committermatthew-mcneilly <matthew.mcneilly@est.tech>
Mon, 6 Jul 2020 17:11:43 +0000 (18:11 +0100)
Signed-off-by: matthew-mcneilly <matthew.mcneilly@est.tech>
Change-Id: Ib573b0b9de313fa7662711016e0b7d2a9970d772

infra/jenkins/slave-setup/uds-build-server/README.md [new file with mode: 0644]
infra/jenkins/slave-setup/uds-build-server/install-packages.sh [new file with mode: 0644]
infra/jenkins/slave-setup/uds-build-server/onap-uds-build-ubuntu1804.json [new file with mode: 0644]

diff --git a/infra/jenkins/slave-setup/uds-build-server/README.md b/infra/jenkins/slave-setup/uds-build-server/README.md
new file mode 100644 (file)
index 0000000..de3457d
--- /dev/null
@@ -0,0 +1,10 @@
+## Description
+Packer files for creating virtual machine image used for UDS jenkins build server.
+Based on Ubuntu 18.04 image with Java & Docker installed ontop.
+
+## Steps To Run
+ 1. Source OpenStack RC file `source <openstack-rc-file.sh>`to set environment variables used by packer e.g. OS_USERNAME, OS_PASSWORD and OS_AUTH_URL
+ 2. Run `packer build <packerfile.json>`
+
+
+This will create the image specified (image_name) onto the OpenStack Server (identity_endpoint). Modify packer parameters as required and add packages to be installed into the shell script. For more info see [Packer docs](https://www.packer.io/docs/builders/openstack)
diff --git a/infra/jenkins/slave-setup/uds-build-server/install-packages.sh b/infra/jenkins/slave-setup/uds-build-server/install-packages.sh
new file mode 100644 (file)
index 0000000..858fe24
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -ex
+
+sudo apt-get update
+sudo apt-get install -y unzip
+
+# INSTALL JAVA
+sudo apt-get install -y openjdk-11-jdk
+java -version
+
+# INSTALL DOCKER
+sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
+    apt-transport-https \
+    ca-certificates \
+    curl \
+    gnupg-agent \
+    software-properties-common
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+sudo add-apt-repository \
+   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
+   $(lsb_release -cs) \
+   stable"
+sudo apt-get update
+sudo apt-get install -y docker-ce=5:19.03.12~3-0~ubuntu-bionic docker-ce-cli=5:19.03.12~3-0~ubuntu-bionic containerd.io
+sudo usermod -aG docker $USER
+newgrp docker
+docker --version
diff --git a/infra/jenkins/slave-setup/uds-build-server/onap-uds-build-ubuntu1804.json b/infra/jenkins/slave-setup/uds-build-server/onap-uds-build-ubuntu1804.json
new file mode 100644 (file)
index 0000000..810c9ae
--- /dev/null
@@ -0,0 +1,22 @@
+{
+    "builders": [
+        {
+            "type": "openstack",
+            "identity_endpoint": "https://fra1.citycloud.com:5000",
+            "image_name": "onap-uds-build-ubuntu1804",
+            "ssh_username": "ubuntu",
+            "source_image_name": "Ubuntu 18.04 Bionic Beaver",
+            "flavor": "2C-4GB-10GB",
+            "networks": [
+                "3703a0fe-b900-4553-92ae-2913bba32ae1"
+            ],
+            "floating_ip_network": "ext-net"
+        }
+    ],
+    "provisioners": [
+        {
+            "script": "install-packages.sh",
+            "type": "shell"
+        }
+    ]
+}