Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This folder contains tools for building up a Devfile Registry Repository and pac

### Prerequisites

- Golang 1.13.x or higher
- Golang 1.24.x or higher
- Docker 17.05 or higher
- Git
- [yq](https://github.com/mikefarah/yq) 4.x
Expand Down
39 changes: 34 additions & 5 deletions build-tools/build_image.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

#
# Copyright Red Hat
#
Expand All @@ -13,15 +15,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

buildToolsFolder="$(dirname "$0")"
registryFolder=$(mktemp -d)

# run setenv.sh script if invoking directly
if [ "$0" == "$BASH_SOURCE" ]; then
. $buildToolsFolder/../setenv.sh
fi

display_usage() {
echo "A devfile registry repository folder must be passed in as an argument"
echo "usage: build_image.sh <path-to-registry-repository-folder>"
}
echo "usage: build_image.sh <path-to-registry-repository-folder> [offline: 0|1]"
}

# Download all offline resources
download_offline() {
export STACKS_DIR=$1

# Download all the offline parent devfiles
bash $buildToolsFolder/dl_parent_devfiles.sh

# Download all the offline starter projects
bash $buildToolsFolder/dl_starter_projects.sh

# Update all devfiles to use offline starter projects
bash $buildToolsFolder/update_devfiles_offline.sh

return $?
}

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

# Check if a registry repository folder was passed in, if not, exit
if [ $# -ne 1 ]; then
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
display_usage
exit 1
fi

if [ ! -z $2 ] && [ $2 -eq 1 ]; then
download_offline $1/stacks

if [ $? -ne 0 ]; then
exit $?
fi
fi

bash $buildToolsFolder/build.sh $1 $registryFolder
if [ $? -ne 0 ]; then
echo "Failed to build the devfile registry index"
Expand Down
2 changes: 1 addition & 1 deletion build-tools/update_devfiles_offline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# the location to the offline project in the stack root

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

Expand Down
Loading