Browse Source

containers: clean-up build code

The containers code use a code path for installing things which
can all be done using existing CI tooling, let's use that rather
than build our stuff from scratch.

Change-Id: I1bcf5dfaac62666f48f7cce70d53244814b0b7db
changes/96/625996/3
Mohammed Naser 3 years ago
parent
commit
b6ad606bd2
  1. 52
      playbooks/container-builder-setup-gate.yaml
  2. 26
      tools/install_docker_UBUNTU.sh

52
playbooks/container-builder-setup-gate.yaml

@ -1,37 +1,25 @@
---
- hosts: all
roles:
- configure-swap
- install-docker
tasks:
- name: Create logging folders
file:
path: "/tmp/logs/{{ item }}"
state: directory
with_items:
- ansible
- build
- name: setup swap
block:
- command: fallocate -l20g /swap
- file:
path: /swap
mode: 0600
- command: mkswap /swap
- command: swapon /swap
become: True
- name: setup logging
shell:
cmd: |
mkdir logs
ln -s $(pwd)/logs /tmp/logs
mkdir -p /tmp/logs/{ansible,build}
executable: /bin/bash
chdir: "{{ zuul.project.src_dir }}"
- name: copy setup script
copy:
src: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tools/install_docker_UBUNTU.sh"
dest: /tmp/setup.sh
mode: 0755
- name: run node setup script
shell: /tmp/setup.sh
become: true
- name: changing permission of Docker socket to 666
- name: Link logs output folder
file:
path: /run/docker.sock
mode: 666
src: /tmp/logs
dest: "{{ zuul.project.src_dir }}/logs"
state: link
- name: Install dependencies
become: true
pip:
name: docker
state: present

26
tools/install_docker_UBUNTU.sh

@ -1,26 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit
# Setup Docker repo and add signing key
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
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 -y install --no-install-recommends docker-ce
sudo systemctl start docker --now
sudo docker info
sudo apt-get install python-pip
sudo pip install docker
echo "Completed $0."
Loading…
Cancel
Save