Skip to content

Commit 6c0e450

Browse files
Build tool scripts revisions (#302)
* update build-tools README requirements - Go 1.24 Signed-off-by: Michael Valdron <mvaldron@redhat.com> * offline image build and build_image.sh revisions Signed-off-by: Michael Valdron <mvaldron@redhat.com> --------- Signed-off-by: Michael Valdron <mvaldron@redhat.com>
2 parents 61a38bd + e50186a commit 6c0e450

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

build-tools/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This folder contains tools for building up a Devfile Registry Repository and pac
66

77
### Prerequisites
88

9-
- Golang 1.13.x or higher
9+
- Golang 1.24.x or higher
1010
- Docker 17.05 or higher
1111
- Git
1212
- [yq](https://github.com/mikefarah/yq) 4.x

build-tools/build_image.sh

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/bash
2+
13
#
24
# Copyright Red Hat
35
#
@@ -13,15 +15,34 @@
1315
# See the License for the specific language governing permissions and
1416
# limitations under the License.
1517

16-
#!/bin/bash
17-
1818
buildToolsFolder="$(dirname "$0")"
1919
registryFolder=$(mktemp -d)
2020

21+
# run setenv.sh script if invoking directly
22+
if [ "$0" == "$BASH_SOURCE" ]; then
23+
. $buildToolsFolder/../setenv.sh
24+
fi
25+
2126
display_usage() {
2227
echo "A devfile registry repository folder must be passed in as an argument"
23-
echo "usage: build_image.sh <path-to-registry-repository-folder>"
24-
}
28+
echo "usage: build_image.sh <path-to-registry-repository-folder> [offline: 0|1]"
29+
}
30+
31+
# Download all offline resources
32+
download_offline() {
33+
export STACKS_DIR=$1
34+
35+
# Download all the offline parent devfiles
36+
bash $buildToolsFolder/dl_parent_devfiles.sh
37+
38+
# Download all the offline starter projects
39+
bash $buildToolsFolder/dl_starter_projects.sh
40+
41+
# Update all devfiles to use offline starter projects
42+
bash $buildToolsFolder/update_devfiles_offline.sh
43+
44+
return $?
45+
}
2546

2647
# cleanup_and_exit removes the temp folder we created and exits with the exit code passed into it
2748
cleanup_and_exit() {
@@ -30,11 +51,19 @@ cleanup_and_exit() {
3051
}
3152

3253
# Check if a registry repository folder was passed in, if not, exit
33-
if [ $# -ne 1 ]; then
54+
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
3455
display_usage
3556
exit 1
3657
fi
3758

59+
if [ ! -z $2 ] && [ $2 -eq 1 ]; then
60+
download_offline $1/stacks
61+
62+
if [ $? -ne 0 ]; then
63+
exit $?
64+
fi
65+
fi
66+
3867
bash $buildToolsFolder/build.sh $1 $registryFolder
3968
if [ $? -ne 0 ]; then
4069
echo "Failed to build the devfile registry index"

build-tools/update_devfiles_offline.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# the location to the offline project in the stack root
2323

2424
# Path of stacks directory in the registry
25-
STACKS_DIR=/registry/stacks
25+
STACKS_DIR=${STACKS_DIR:-/registry/stacks}
2626
# Automated comment used to check whether the devfile has already been modified
2727
MODIFIED_MESSAGE="# AUTOMATED MODIFICATION -"
2828

0 commit comments

Comments
 (0)