sdk-container: address feedback from @krnowak review

Signed-off-by: flatcar-ci <infra+ci@flatcar-linux.org>
This commit is contained in:
flatcar-ci 2021-11-05 09:17:30 +01:00
parent 90af105e9f
commit 7f874e491e
6 changed files with 14 additions and 14 deletions

1
.gitignore vendored
View File

@ -20,4 +20,3 @@ sdk_container/.sdkenv
__build__/ __build__/
sdk_container/.cache sdk_container/.cache
sdk_container/.config sdk_container/.config
sdk_container/.lock

View File

@ -92,11 +92,11 @@ The wrapper scripts will re-use existing containers instead of creating new ones
To clone the scripts repo and pick a version: To clone the scripts repo and pick a version:
* Clone the scripts repo: `git clone https://github.com/flatcar-linux/scripts.git` * Clone the scripts repo: `git clone https://github.com/flatcar-linux/scripts.git`
* Make sure to initialise and fetch git submodules - Flatcar's ebuilds are in 2 separate repositories, connected to `scripts` via submodules.
* `git submodule init; git submodule update`
* Optionally, check out a release tag to base your work on * Optionally, check out a release tag to base your work on
* list releases (e.g. all Alpha releases): `git tag -l alpha-*` * list releases (e.g. all Alpha releases): `git tag -l alpha-*`
* check out the release version, e.g. `3033.0.0`: `git checkout 3033.0.0` * check out the release version, e.g. `3033.0.0`: `git checkout 3033.0.0`
* Make sure to initialise and fetch git submodules - Flatcar's ebuilds are in 2 separate repositories, connected to `scripts` via submodules.
* `git submodule init; git submodule update`
To use the SDK container: To use the SDK container:
* Fetch image and start the SDK container: `./run_sdk_container -t` * Fetch image and start the SDK container: `./run_sdk_container -t`

View File

@ -17,7 +17,9 @@ if is_official "$vernum" ; then
else else
official="false" official="false"
fi fi
cleanup=""
declare -a cleanup
# -- # --
usage() { usage() {
@ -42,7 +44,7 @@ usage() {
while [ 0 -lt $# ] ; do while [ 0 -lt $# ] ; do
case "$1" in case "$1" in
-h) usage; exit 0;; -h) usage; exit 0;;
-x) cleanup="-x $2"; shift; shift;; -x) cleanup=("-x" "$2"); shift; shift;;
*) if [ -z "$seed_version" ] ; then *) if [ -z "$seed_version" ] ; then
seed_version="$1" seed_version="$1"
elif [ -z "$target_version" ] ; then elif [ -z "$target_version" ] ; then
@ -69,7 +71,7 @@ if $official; then
fi fi
# bootstrap_sdk needs FLATCAR_SDK_VERSION set to the seed version # bootstrap_sdk needs FLATCAR_SDK_VERSION set to the seed version
./run_sdk_container $cleanup -V "$seed_version" -v "$target_version" \ ./run_sdk_container "${cleanup[@]}" -V "$seed_version" -v "$target_version" \
sudo -E ./bootstrap_sdk sudo -E ./bootstrap_sdk
# Update versionfile to the actual SDK version # Update versionfile to the actual SDK version

View File

@ -1,6 +1,7 @@
ARG VERSION ARG VERSION
FROM flatcar-sdk-tarball:${VERSION} FROM flatcar-sdk-tarball:${VERSION}
# Make build scripts believe we're in the SDK chroot (which technically, we are)
RUN touch /etc/debian_chroot RUN touch /etc/debian_chroot
RUN chmod 644 /etc/passwd RUN chmod 644 /etc/passwd
RUN chmod 644 /etc/group RUN chmod 644 /etc/group

View File

@ -40,7 +40,7 @@ function get_sdk_version_from_versionfile() {
function is_official() { function is_official() {
local vernum="$1" local vernum="$1"
official="$(echo "$vernum" | sed -n 's/^[0-9]\+\.[0-9]\+\.[0-9]\+$/true/p')" local official="$(echo "$vernum" | sed -n 's/^[0-9]\+\.[0-9]\+\.[0-9]\+$/true/p')"
test -n "$official" test -n "$official"
} }
@ -67,7 +67,8 @@ function vernum_from_version() {
# -- # --
# Strip prefix from version string if present ("alpha-3233.0.0[-...]" => "3233.0.0[-...]") # Strip prefix from version string if present ("alpha-3233.0.0[-...]" => "3233.0.0[-...]")
# # and add a "+[build suffix]" if this is a non-official build. The "+" matches the version
# string generation in the build scripts.
function strip_version_prefix() { function strip_version_prefix() {
local version="$1" local version="$1"

View File

@ -19,12 +19,9 @@ function clone_version() {
local version="$3" local version="$3"
git clone https://github.com/flatcar-linux/$repo "$dest" git clone https://github.com/flatcar-linux/$repo "$dest"
( git -C "${dest}" fetch --all
cd "$dest" local tag=$(git -C "${dest}" tag -l | grep "${version}")
git fetch --all git -C "${dest}" checkout "$tag"
local tag=$(git tag -l | grep "${version}")
git checkout "$tag"
)
} }
# -- # --