Skip to content

Commit 699a601

Browse files
Fix docker-compose up error when switching between osie and hook:
This makes switching between osie and hook via the .env file not cause the docker-compose up to error out. Creates a nicer experience when switching. Signed-off-by: Jacob Weinstock <[email protected]>
1 parent 55af335 commit 699a601

File tree

3 files changed

+16
-38
lines changed

3 files changed

+16
-38
lines changed

deploy/compose/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ services:
3535
"/source",
3636
"/source",
3737
"/destination",
38-
"${TINKERBELL_USE_HOOK}",
38+
"${TINKERBELL_USE_HOOK:-true}",
3939
]
4040
volumes:
4141
- ${REPO_TOP_LEVEL:-.}/osie:/scripts

deploy/compose/osie/lastmile.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ set -xo pipefail
88
osie_download() {
99
local url="$1"
1010
local directory="$2"
11-
wget "${url}" -O "${directory}"/osie.tar.gz
11+
local filename="$3"
12+
wget "${url}" -O "${directory}"/"${filename}".tar.gz
1213
}
1314

1415
# osie_extract from tarball and save it to directory
1516
osie_extract() {
1617
local source_dir="$1"
1718
local dest_dir="$2"
18-
tar -zxvf "${source_dir}"/osie.tar.gz -C "${dest_dir}" --strip-components 1
19+
local filename="$3"
20+
tar -zxvf "${source_dir}"/"${filename}".tar.gz -C "${dest_dir}" --strip-components 1
1921
}
2022

2123
# osie_move_helper_scripts moves workflow helper scripts to the workflow directory
@@ -45,25 +47,32 @@ main() {
4547
local dest_dir="$4"
4648
local use_hook="$5"
4749

48-
if [ ! -f "${extract_dir}"/osie.tar.gz ]; then
50+
local filename
51+
if [ "${use_hook}" == "true" ]; then
52+
filename="osie-hook"
53+
else
54+
filename="osie"
55+
fi
56+
57+
if [ ! -f "${extract_dir}"/"${filename}".tar.gz ]; then
4958
echo "downloading osie..."
50-
osie_download "${url}" "${extract_dir}"
59+
osie_download "${url}" "${extract_dir}" "${filename}"
5160
else
5261
echo "osie already downloaded"
5362
fi
5463

5564
if [ "${use_hook}" == "true" ]; then
5665
if [ ! -f "${source_dir}"/hook-x86_64-kernel ] && [ ! -f "${source_dir}"/hook-x86_64-initrd.img ]; then
5766
echo "extracting hook..."
58-
osie_extract "${extract_dir}" "${source_dir}"
67+
osie_extract "${extract_dir}" "${source_dir}" "${filename}"
5968
else
6069
echo "hook files already exist, not extracting"
6170
fi
6271
hook_rename_files "${source_dir}"/hook-x86_64-kernel "${source_dir}"/hook-x86_64-initrd.img "${source_dir}"
6372
else
6473
if [ ! -f "${source_dir}"/workflow-helper.sh ] && [ ! -f "${source_dir}"/workflow-helper-rc ]; then
6574
echo "extracting osie..."
66-
osie_extract "${extract_dir}" "${source_dir}"
75+
osie_extract "${extract_dir}" "${source_dir}" "${filename}"
6776
else
6877
echo "osie files already exist, not extracting"
6978
fi

notes.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)