Working on including manifest in image build

This commit is contained in:
notplants 2021-03-11 13:52:27 +01:00
parent 9ccd148a8e
commit 48393605bb
3 changed files with 24 additions and 8 deletions

View File

@ -9,4 +9,5 @@ RELEASE_DIR=/var/www/releases.peachcloud.org/html/peach-imgs/$TODAY
echo "++ successful image build, copying output to ${RELEASE_DIR}" echo "++ successful image build, copying output to ${RELEASE_DIR}"
mkdir -p $RELEASE_DIR mkdir -p $RELEASE_DIR
cp raspi_3.img $RELEASE_DIR/${TODAY}_peach_raspi3.img cp raspi_3.img $RELEASE_DIR/${TODAY}_peach_raspi3.img
cp peach-img-manifest.log $RELEASE_DIR/${TODAY}_img_manifest.log
cp raspi_3.log $RELEASE_DIR/${TODAY}_peach_raspi3.log cp raspi_3.log $RELEASE_DIR/${TODAY}_peach_raspi3.log

View File

@ -29,7 +29,6 @@ def render_template(src, dest, template_vars=None):
with open(dest, 'w') as f: with open(dest, 'w') as f:
f.write(output_text) f.write(output_text)
# remove old files # remove old files
os.remove(os.path.join(PROJECT_PATH, 'raspi_3.img')) os.remove(os.path.join(PROJECT_PATH, 'raspi_3.img'))
os.remove(os.path.join(PROJECT_PATH, 'raspi_3.log')) os.remove(os.path.join(PROJECT_PATH, 'raspi_3.log'))
@ -37,13 +36,14 @@ os.remove(os.path.join(PROJECT_PATH, 'raspi_3.log'))
# build img # build img
subprocess.check_call(['make', 'raspi_3.img']) subprocess.check_call(['make', 'raspi_3.img'])
# copy image and log to releases dir # create releases dir
today = date.today() today = date.today()
today_str = "{}{}{}".format(today.year, today.month, today.day) today_str = "{}{}{}".format(today.year, today.month, today.day)
release_dir = "/var/www/releases.peachcloud.org/html/peach-imgs/{}".format(today_str) release_dir = "/var/www/releases.peachcloud.org/html/peach-imgs/{}".format(today_str)
print("++ successful image build, copying output to {}", release_dir)
os.makedirs(release_dir) os.makedirs(release_dir)
# copy image and log to releases dir
print("++ successful image build, copying output to {}", release_dir)
img_path = os.path.join(PROJECT_PATH, 'raspi_3.img') img_path = os.path.join(PROJECT_PATH, 'raspi_3.img')
log_path = os.path.join(PROJECT_PATH, 'raspi_3.log') log_path = os.path.join(PROJECT_PATH, 'raspi_3.log')
release_img_name = "{}_peach_raspi3.img".format(today_str) release_img_name = "{}_peach_raspi3.img".format(today_str)
@ -53,7 +53,6 @@ log_release_path = os.path.join(release_dir, release_log_name)
subprocess.check_call(['cp', img_path, img_release_path]) subprocess.check_call(['cp', img_path, img_release_path])
subprocess.check_call(['cp', log_path, log_release_path]) subprocess.check_call(['cp', log_path, log_release_path])
# rebuild release index.html # rebuild release index.html
release_index_path = "/var/www/releases.peachcloud.org/html/index.html" release_index_path = "/var/www/releases.peachcloud.org/html/index.html"
release_img_url = img_release_path.replace('/var/www/releases.peachcloud.org/html/', '/') release_img_url = img_release_path.replace('/var/www/releases.peachcloud.org/html/', '/')

View File

@ -136,14 +136,30 @@ steps:
- apt: install - apt: install
packages: packages:
- git - git
- python - python3
- python3-pip
- wget - wget
- gnupg2
tag: / tag: /
- chroot: / - chroot: /
shell: | shell: |
git clone -b dev https://github.com/peachcloud/peach-config.git /srv/peach-config pip3 install setuptools
cd /srv/peach-config/ && python3 /srv/peach-config/scripts/setup_dev_env.py -i -n -d peach echo "deb http://apt.peachcloud.org/ buster main" > /etc/apt/sources.list.d/peach.list
wget -O /tmp/pubkey.gpg http://apt.peachcloud.org/pubkey.gpg
apt-key add /tmp/pubkey.gpg
apt-get update
apt-get install -y python3-peach-config
/usr/bin/peach-config -i -n -d peach
# lastly log which versions of microservices were installed and copy the provenance to the host machine
- chroot: /
shell: |
apt list --installed | grep peach > /srv/peach-img-manifest.log
- shell: |
cp "${ROOT?}/srv/peach-img-manifest.log" /srv/peachcloud/automation/peach-img-builder/peach-img-manifest.log
root-fs: /
# END OF PEACH CONFIG # END OF PEACH CONFIG