#!/bin/bash # Runs INSIDE the newly created disposable container, never on the host. set -euo pipefail [ "${SSW590_DISPOSABLE_TEST:-}" = 1 ] && [ -f /.dockerenv ] && [ -d /opt/ssw590-input ] || { echo 'Refusing: this bootstrap runs only inside the disposable test container.' >&2 exit 1 } umask 022 mkdir -p /tmp/ssw590 chmod 755 /tmp/ssw590 echo tools > /tmp/ssw590/phase { export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install --no-install-recommends -y python3 git util-linux apt-get clean rm -rf /var/lib/apt/lists/* python3 --version git --version echo plugins > /tmp/ssw590/phase mkdir -p /usr/share/jenkins/ref/plugins /usr/share/jenkins/ref/init.groovy.d chown jenkins:jenkins /usr/share/jenkins/ref/plugins # Catalog resolution is prepared on the laptop, outside the runtime limits. # The host verifies this bundle's hashes before mounting it read-only. cp /opt/ssw590-plugins/*.jpi /usr/share/jenkins/ref/plugins/ chown -R jenkins:jenkins /usr/share/jenkins/ref/plugins python3 /opt/ssw590-input/inventory.py /usr/share/jenkins/ref/plugins \ /opt/ssw590-input/plugins.txt > /tmp/ssw590/plugins-resolved.json python3 - <<'PY' > /tmp/ssw590/plugins-resolved.lock import json for p in json.load(open('/tmp/ssw590/plugins-resolved.json')): print(p['id'] + ':' + p['version']) PY cp /opt/ssw590-input/init.groovy /usr/share/jenkins/ref/init.groovy.d/90-capacity.groovy chown -R jenkins:jenkins /tmp/ssw590 } > /tmp/ssw590/install.txt 2>&1 echo startup > /tmp/ssw590/phase # Replace the preparer with the normal official Jenkins launcher, as non-root. exec runuser -u jenkins -- /usr/bin/tini -- /usr/local/bin/jenkins.sh