From a8df886e0decd9f07fd413985d206c5f87983c84 Mon Sep 17 00:00:00 2001 From: matthew-mcneilly Date: Mon, 6 Jul 2020 17:12:48 +0100 Subject: [PATCH] UDS build server packer files Signed-off-by: matthew-mcneilly Change-Id: Ib573b0b9de313fa7662711016e0b7d2a9970d772 --- .../slave-setup/uds-build-server/README.md | 10 +++++ .../uds-build-server/install-packages.sh | 45 +++++++++++++++++++ .../onap-uds-build-ubuntu1804.json | 22 +++++++++ 3 files changed, 77 insertions(+) create mode 100644 infra/jenkins/slave-setup/uds-build-server/README.md create mode 100644 infra/jenkins/slave-setup/uds-build-server/install-packages.sh create mode 100644 infra/jenkins/slave-setup/uds-build-server/onap-uds-build-ubuntu1804.json 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 index 0000000..de3457d --- /dev/null +++ b/infra/jenkins/slave-setup/uds-build-server/README.md @@ -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 `to set environment variables used by packer e.g. OS_USERNAME, OS_PASSWORD and OS_AUTH_URL + 2. Run `packer build ` + + +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 index 0000000..858fe24 --- /dev/null +++ b/infra/jenkins/slave-setup/uds-build-server/install-packages.sh @@ -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 index 0000000..810c9ae --- /dev/null +++ b/infra/jenkins/slave-setup/uds-build-server/onap-uds-build-ubuntu1804.json @@ -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" + } + ] +} -- 2.25.1