summaryrefslogtreecommitdiff
path: root/contrib/cirrus/packer
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cirrus/packer')
-rw-r--r--contrib/cirrus/packer/README.md2
-rw-r--r--contrib/cirrus/packer/centos_setup.sh69
-rw-r--r--contrib/cirrus/packer/fedora_setup.sh72
-rw-r--r--contrib/cirrus/packer/libpod_images.json124
-rw-r--r--contrib/cirrus/packer/rhel_setup.sh111
-rw-r--r--contrib/cirrus/packer/ubuntu_setup.sh93
6 files changed, 471 insertions, 0 deletions
diff --git a/contrib/cirrus/packer/README.md b/contrib/cirrus/packer/README.md
new file mode 100644
index 000000000..8ff6947e9
--- /dev/null
+++ b/contrib/cirrus/packer/README.md
@@ -0,0 +1,2 @@
+These are definitions and scripts consumed by packer to produce the
+various distribution images used for CI testing.
diff --git a/contrib/cirrus/packer/centos_setup.sh b/contrib/cirrus/packer/centos_setup.sh
new file mode 100644
index 000000000..2253d7b35
--- /dev/null
+++ b/contrib/cirrus/packer/centos_setup.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+# This script is called by packer on the subject CentOS VM, to setup the podman
+# build/test environment. It's not intended to be used outside of this context.
+
+set -e
+
+# Load in library (copied by packer, before this script was run)
+source /tmp/libpod/$SCRIPT_BASE/lib.sh
+
+req_env_var "
+SCRIPT_BASE $SCRIPT_BASE
+CNI_COMMIT $CNI_COMMIT
+CRIO_COMMIT $CRIO_COMMIT
+"
+
+install_ooe
+
+export GOPATH="$(mktemp -d)"
+trap "sudo rm -rf $GOPATH" EXIT
+
+ooe.sh sudo yum -y update
+
+ooe.sh sudo yum -y install centos-release-scl epel-release
+
+ooe.sh sudo yum -y install \
+ atomic-registries \
+ btrfs-progs-devel \
+ bzip2 \
+ device-mapper-devel \
+ findutils \
+ glib2-devel \
+ glibc-static \
+ gnupg \
+ golang \
+ golang-github-cpuguy83-go-md2man \
+ golang-github-cpuguy83-go-md2man \
+ gpgme-devel \
+ iptables \
+ libassuan-devel \
+ libseccomp-devel \
+ libselinux-devel \
+ lsof \
+ make \
+ nmap-ncat \
+ ostree-devel \
+ python \
+ python3-dateutil \
+ python3-psutil \
+ python3-pytoml \
+ runc \
+ skopeo-containers \
+ unzip \
+ which \
+ xz
+
+install_scl_git
+
+install_cni_plugins
+
+install_buildah
+
+install_conmon
+
+install_packer_copied_files
+
+rh_finalize
+
+echo "SUCCESS!"
diff --git a/contrib/cirrus/packer/fedora_setup.sh b/contrib/cirrus/packer/fedora_setup.sh
new file mode 100644
index 000000000..53709fbdd
--- /dev/null
+++ b/contrib/cirrus/packer/fedora_setup.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+# This script is called by packer on the subject fedora VM, to setup the podman
+# build/test environment. It's not intended to be used outside of this context.
+
+set -e
+
+# Load in library (copied by packer, before this script was run)
+source /tmp/libpod/$SCRIPT_BASE/lib.sh
+
+req_env_var "
+SCRIPT_BASE $SCRIPT_BASE
+CNI_COMMIT $CNI_COMMIT
+CRIO_COMMIT $CRIO_COMMIT
+RUNC_COMMIT $RUNC_COMMIT
+"
+
+install_ooe
+
+export GOPATH="$(mktemp -d)"
+trap "sudo rm -rf $GOPATH" EXIT
+
+# breaks networking on f28/29 in GCE
+# ooe.sh sudo dnf update -y
+
+ooe.sh sudo dnf install -y \
+ atomic-registries \
+ btrfs-progs-devel \
+ bzip2 \
+ conmon \
+ device-mapper-devel \
+ findutils \
+ git \
+ glib2-devel \
+ glibc-static \
+ gnupg \
+ golang \
+ golang-github-cpuguy83-go-md2man \
+ golang-github-cpuguy83-go-md2man \
+ gpgme-devel \
+ iptables \
+ libassuan-devel \
+ libseccomp-devel \
+ libselinux-devel \
+ lsof \
+ make \
+ nmap-ncat \
+ ostree-devel \
+ procps-ng \
+ python \
+ python3-dateutil \
+ python3-psutil \
+ python3-pytoml \
+ runc \
+ skopeo-containers \
+ slirp4netns \
+ which\
+ xz
+
+install_varlink
+
+install_cni_plugins
+
+install_buildah
+
+install_conmon
+
+install_packer_copied_files
+
+rh_finalize # N/B: Halts system!
+
+echo "SUCCESS!"
diff --git a/contrib/cirrus/packer/libpod_images.json b/contrib/cirrus/packer/libpod_images.json
new file mode 100644
index 000000000..82a41ca25
--- /dev/null
+++ b/contrib/cirrus/packer/libpod_images.json
@@ -0,0 +1,124 @@
+{
+ "variables": {
+ "CNI_COMMIT": "{{env `CNI_COMMIT`}}",
+ "CRIO_COMMIT": "{{env `CRIO_COMMIT`}}",
+ "RUNC_COMMIT": "{{env `RUNC_COMMIT`}}",
+
+ "CENTOS_BASE_IMAGE": "{{env `CENTOS_BASE_IMAGE`}}" ,
+ "UBUNTU_BASE_IMAGE": "{{env `UBUNTU_BASE_IMAGE`}}",
+ "FEDORA_BASE_IMAGE": "{{env `FEDORA_BASE_IMAGE`}}",
+ "RHEL_BASE_IMAGE": "{{env `RHEL_BASE_IMAGE`}}",
+
+ "GOSRC": "{{env `GOSRC`}}",
+ "PACKER_BASE": "{{env `PACKER_BASE`}}",
+ "SCRIPT_BASE": "{{env `SCRIPT_BASE`}}",
+
+ "SERVICE_ACCOUNT": "{{env `SERVICE_ACCOUNT`}}",
+ "GCP_PROJECT_ID": "{{env `GCP_PROJECT_ID`}}",
+ "CIRRUS_BUILD_ID": "{{env `CIRRUS_BUILD_ID`}}",
+ "GCE_SSH_USERNAME": "{{env `GCE_SSH_USERNAME`}}",
+ "RHSM_COMMAND": "{{env `RHSM_COMMAND`}}"
+ },
+ "sensitive-variables": [
+ "GCP_PROJECT_ID", "SERVICE_ACCOUNT", "GCE_SSH_USERNAME", "RHSM_COMMAND"
+ ],
+ "builders": [
+ {
+ "name": "rhel-7",
+ "type": "googlecompute",
+ "project_id": "{{user `GCP_PROJECT_ID`}}",
+ "zone": "us-central1-a",
+ "source_image": "{{user `RHEL_BASE_IMAGE`}}",
+ "image_name": "{{user `RHEL_BASE_IMAGE`}}-libpod-{{user `CIRRUS_BUILD_ID`}}",
+ "image_family": "{{user `RHEL_BASE_IMAGE`}}-libpod",
+ "service_account_email": "{{user `SERVICE_ACCOUNT`}}",
+ "communicator": "ssh",
+ "ssh_username": "ec2-user",
+ "ssh_pty": "true"
+ },{
+ "name": "centos-7",
+ "type": "googlecompute",
+ "project_id": "{{user `GCP_PROJECT_ID`}}",
+ "zone": "us-central1-a",
+ "source_image": "{{user `CENTOS_BASE_IMAGE`}}",
+ "image_name": "{{user `CENTOS_BASE_IMAGE`}}-libpod-{{user `CIRRUS_BUILD_ID`}}",
+ "image_family": "{{user `CENTOS_BASE_IMAGE`}}-libpod",
+ "service_account_email": "{{user `SERVICE_ACCOUNT`}}",
+ "communicator": "ssh",
+ "ssh_username": "{{user `GCE_SSH_USERNAME`}}",
+ "ssh_pty": "true"
+ },{
+ "name": "fedora-28",
+ "type": "googlecompute",
+ "project_id": "{{user `GCP_PROJECT_ID`}}",
+ "zone": "us-central1-a",
+ "source_image": "{{user `FEDORA_BASE_IMAGE`}}",
+ "image_name": "{{user `FEDORA_BASE_IMAGE`}}-libpod-{{user `CIRRUS_BUILD_ID`}}",
+ "image_family": "{{user `FEDORA_BASE_IMAGE`}}-libpod",
+ "service_account_email": "{{user `SERVICE_ACCOUNT`}}",
+ "communicator": "ssh",
+ "ssh_username": "fedora",
+ "ssh_pty": "true"
+ },{
+ "name": "ubuntu-18",
+ "type": "googlecompute",
+ "project_id": "{{user `GCP_PROJECT_ID`}}",
+ "zone": "us-central1-a",
+ "source_image": "{{user `UBUNTU_BASE_IMAGE`}}",
+ "image_name": "{{user `UBUNTU_BASE_IMAGE`}}-libpod-{{user `CIRRUS_BUILD_ID`}}",
+ "image_family": "{{user `UBUNTU_BASE_IMAGE`}}-libpod",
+ "service_account_email": "{{user `SERVICE_ACCOUNT`}}",
+ "communicator": "ssh",
+ "ssh_username": "{{user `GCE_SSH_USERNAME`}}",
+ "ssh_pty": "true"
+ }
+ ],
+ "provisioners": [
+ {
+ "type": "file",
+ "source": "{{user `GOSRC`}}",
+ "destination": "/tmp/libpod"
+ },{
+ "type": "shell",
+ "only": ["rhel-7"],
+ "script": "{{user `GOSRC`}}/{{user `PACKER_BASE`}}/rhel_setup.sh",
+ "environment_vars": [
+ "SCRIPT_BASE={{user `SCRIPT_BASE`}}",
+ "CNI_COMMIT={{user `CNI_COMMIT`}}",
+ "CRIO_COMMIT={{user `CRIO_COMMIT`}}",
+ "RUNC_COMMIT={{user `RUNC_COMMIT`}}",
+ "RHSM_COMMAND={{user `RHSM_COMMAND`}}"
+ ]
+ },{
+ "type": "shell",
+ "only": ["centos-7"],
+ "script": "{{user `GOSRC`}}/{{user `PACKER_BASE`}}/centos_setup.sh",
+ "environment_vars": [
+ "SCRIPT_BASE={{user `SCRIPT_BASE`}}",
+ "CNI_COMMIT={{user `CNI_COMMIT`}}",
+ "CRIO_COMMIT={{user `CRIO_COMMIT`}}",
+ "RUNC_COMMIT={{user `RUNC_COMMIT`}}"
+ ]
+ },{
+ "type": "shell",
+ "only": ["fedora-28"],
+ "script": "{{user `GOSRC`}}/{{user `PACKER_BASE`}}/fedora_setup.sh",
+ "environment_vars": [
+ "SCRIPT_BASE={{user `SCRIPT_BASE`}}",
+ "CNI_COMMIT={{user `CNI_COMMIT`}}",
+ "CRIO_COMMIT={{user `CRIO_COMMIT`}}",
+ "RUNC_COMMIT={{user `RUNC_COMMIT`}}"
+ ]
+ },{
+ "type": "shell",
+ "only": ["ubuntu-18"],
+ "script": "{{user `GOSRC`}}/{{user `PACKER_BASE`}}/ubuntu_setup.sh",
+ "environment_vars": [
+ "SCRIPT_BASE={{user `SCRIPT_BASE`}}",
+ "CNI_COMMIT={{user `CNI_COMMIT`}}",
+ "CRIO_COMMIT={{user `CRIO_COMMIT`}}",
+ "RUNC_COMMIT={{user `RUNC_COMMIT`}}"
+ ]
+ }
+ ]
+}
diff --git a/contrib/cirrus/packer/rhel_setup.sh b/contrib/cirrus/packer/rhel_setup.sh
new file mode 100644
index 000000000..b776a0d97
--- /dev/null
+++ b/contrib/cirrus/packer/rhel_setup.sh
@@ -0,0 +1,111 @@
+#!/bin/bash
+
+# This script is called by packer on the subject CentOS VM, to setup the podman
+# build/test environment. It's not intended to be used outside of this context.
+
+set -e
+
+# Load in library (copied by packer, before this script was run)
+source /tmp/libpod/$SCRIPT_BASE/lib.sh
+
+req_env_var "
+SCRIPT_BASE $SCRIPT_BASE
+CNI_COMMIT $CNI_COMMIT
+CRIO_COMMIT $CRIO_COMMIT
+RHSM_COMMAND $RHSM_COMMAND
+"
+
+install_ooe
+
+export GOPATH="$(mktemp -d)"
+export RHSMCMD="$(mktemp)"
+
+exit_handler() {
+ set +ex
+ cd /
+ sudo rm -rf "$RHSMCMD"
+ sudo rm -rf "$GOPATH"
+ sudo subscription-manager remove --all
+ sudo subscription-manager unregister
+ sudo subscription-manager clean
+}
+trap "exit_handler" EXIT
+
+# Avoid logging sensitive details
+echo "$RHSM_COMMAND" > "$RHSMCMD"
+ooe.sh sudo bash "$RHSMCMD"
+sudo rm -rf "$RHSMCMD"
+
+ooe.sh sudo yum -y erase "rh-amazon-rhui-client*"
+ooe.sh sudo subscription-manager repos "--disable=*"
+ooe.sh sudo subscription-manager repos \
+ --enable=rhel-7-server-rpms \
+ --enable=rhel-7-server-optional-rpms \
+ --enable=rhel-7-server-extras-rpms \
+ --enable=rhel-server-rhscl-7-rpms
+
+ooe.sh sudo yum -y update
+
+# Frequently needed
+ooe.sh sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+
+# Required for google to manage ssh keys
+sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
+[google-cloud-compute]
+name=google-cloud-compute
+baseurl=https://packages.cloud.google.com/yum/repos/google-cloud-compute-el7-x86_64
+enabled=1
+gpgcheck=1
+repo_gpgcheck=1
+gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
+ https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
+EOM
+
+ooe.sh sudo yum -y install \
+ atomic-registries \
+ btrfs-progs-devel \
+ bzip2 \
+ device-mapper-devel \
+ findutils \
+ glib2-devel \
+ glibc-static \
+ gnupg \
+ golang \
+ golang-github-cpuguy83-go-md2man \
+ golang-github-cpuguy83-go-md2man \
+ google-compute-engine \
+ google-compute-engine-oslogin \
+ gpgme-devel \
+ iptables \
+ libassuan-devel \
+ libseccomp-devel \
+ libselinux-devel \
+ lsof \
+ make \
+ nmap-ncat \
+ ostree-devel \
+ python \
+ python34-dateutil \
+ python34-psutil \
+ python34-pytoml \
+ runc \
+ skopeo-containers \
+ unzip \
+ which \
+ xz
+
+install_scl_git
+
+install_cni_plugins
+
+install_buildah
+
+install_conmon
+
+install_packer_copied_files
+
+exit_handler # release subscription!
+
+rh_finalize
+
+echo "SUCCESS!"
diff --git a/contrib/cirrus/packer/ubuntu_setup.sh b/contrib/cirrus/packer/ubuntu_setup.sh
new file mode 100644
index 000000000..96b3a573f
--- /dev/null
+++ b/contrib/cirrus/packer/ubuntu_setup.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+# This script is called by packer on the subject Ubuntu VM, to setup the podman
+# build/test environment. It's not intended to be used outside of this context.
+
+set -e
+
+# Load in library (copied by packer, before this script was run)
+source /tmp/libpod/$SCRIPT_BASE/lib.sh
+
+req_env_var "
+SCRIPT_BASE $SCRIPT_BASE
+CNI_COMMIT $CNI_COMMIT
+CRIO_COMMIT $CRIO_COMMIT
+RUNC_COMMIT $RUNC_COMMIT
+"
+
+install_ooe
+
+export GOPATH="$(mktemp -d)"
+trap "sudo rm -rf $GOPATH" EXIT
+
+ooe.sh sudo apt-get -qq update
+ooe.sh sudo apt-get -qq update # sometimes it needs to get it twice :S
+ooe.sh sudo apt-get -qq upgrade
+ooe.sh sudo apt-get -qq install --no-install-recommends \
+ apparmor \
+ autoconf \
+ automake \
+ bison \
+ btrfs-tools \
+ build-essential \
+ curl \
+ e2fslibs-dev \
+ gawk \
+ gettext \
+ golang \
+ go-md2man \
+ iptables \
+ libaio-dev \
+ libapparmor-dev \
+ libcap-dev \
+ libdevmapper-dev \
+ libdevmapper1.02.1 \
+ libfuse-dev \
+ libglib2.0-dev \
+ libgpgme11-dev \
+ liblzma-dev \
+ libostree-dev \
+ libprotobuf-c0-dev \
+ libprotobuf-dev \
+ libtool \
+ libtool \
+ libudev-dev \
+ lsof \
+ netcat \
+ pkg-config \
+ protobuf-c-compiler \
+ protobuf-compiler \
+ python-minimal \
+ python3-dateutil \
+ python3-pip \
+ python3-psutil \
+ python3-pytoml \
+ python3-setuptools \
+ socat \
+ unzip \
+ xz-utils
+
+echo "Fixing Ubuntu kernel not enabling swap accounting by default"
+SEDCMD='s/^GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="\1 cgroup_enable=memory swapaccount=1"/g'
+ooe.sh sudo sed -re "$SEDCMD" -i /etc/default/grub.d/*
+ooe.sh sudo sed -re "$SEDCMD" -i /etc/default/grub
+ooe.sh sudo update-grub
+
+install_runc
+
+install_conmon
+
+install_cni_plugins
+
+install_buildah
+
+install_packer_copied_files
+
+install_varlink
+
+sudo curl https://raw.githubusercontent.com/projectatomic/registries/master/registries.fedora\
+ -o /etc/containers/registries.conf
+
+ubuntu_finalize
+
+echo "SUCCESS!"