bottlerocket-os / twoliter

A build tool for customizing Bottlerocket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bottlerocket-license-tool and Licencese.toml need to be considered

webern opened this issue · comments

Description

We need to understand how all of this works and figure out what the best interface is for OOTB builders.

[tasks.fetch-licenses]
dependencies = ["fetch"]
script = [
'''
if [ "${BUILDSYS_UPSTREAM_LICENSE_FETCH}" = "false" ]; then
echo "Skipping fetching licenses"
exit 0
fi
# Attempt copy Licenses.toml
cp "${BUILDSYS_LICENSES_CONFIG_PATH}" "${BUILDSYS_ROOT_DIR}/Licenses.toml" 2>/dev/null \
|| echo "Skipping copying file from ${BUILDSYS_LICENSES_CONFIG_PATH}"
if [ ! -s "${BUILDSYS_ROOT_DIR}"/Licenses.toml ] ; then
echo "Not fetching licenses since 'Licenses.toml' doesn't exist"
exit 0
fi
mkdir -p "${BUILDSYS_ROOT_DIR}"/licenses
run_fetch_licenses="
bottlerocket-license-tool -l /tmp/Licenses.toml fetch /tmp/licenses
"
set +e
docker run --rm \
--user "$(id -u):$(id -g)" \
--security-opt="label=disable" \
-e CARGO_HOME="/tmp/.cargo" \
-v "${CARGO_HOME}":/tmp/.cargo \
-v "${BUILDSYS_ROOT_DIR}/licenses:/tmp/licenses" \
-v "${BUILDSYS_ROOT_DIR}/Licenses.toml:/tmp/Licenses.toml" \
"${TLPRIVATE_SDK_IMAGE}" \
bash -c "${run_fetch_licenses}"
'''
]

https://github.com/bottlerocket-os/bottlerocket-sdk/blob/7db4d167e07eccf3cf18a77aa21bb51b4d4aa607/license-tool/src/main.rs#L135-L177

https://github.com/bottlerocket-os/bottlerocket-sdk/blob/7db4d167e07eccf3cf18a77aa21bb51b4d4aa607/license-tool/tests/data/test-packages-licenses.toml#L1-L7

Definition of Done

A design exists for how OOTB builders will use Twoliter and/or bottlerocket-license-tool to embed their own license sources in their variants.