Skip to content

Commit

Permalink
fix: cd back to the original running dir after building boot assets
Browse files Browse the repository at this point in the history
The bash script changes the working directory - if it doesn't go back to the original directory after it terminates, it breaks some GH actions steps later.

Signed-off-by: Utku Ozdemir <[email protected]>
  • Loading branch information
utkuozdemir committed Nov 5, 2024
1 parent 681e769 commit db39e41
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions hack/boot-assets/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

PROJECT_DIR=$(pwd)
RUN_DIR=$(pwd)

TEMP_USERNAME=siderolabs

Expand All @@ -18,6 +18,13 @@ make image-talos-metal-agent PUSH=true REGISTRY="$TEMP_REGISTRY" USERNAME="$TEMP

TEMP_DIR=$(mktemp -d -t agent-boot-assets-XXXXX)

function cleanup() {
cd "${RUN_DIR}"
rm -rf "$TEMP_DIR"
}

trap cleanup EXIT SIGINT

echo "Building in $TEMP_DIR"

cd "$TEMP_DIR"
Expand Down Expand Up @@ -68,7 +75,7 @@ ASSETS_DIR="$TEMP_DIR/assets"

mkdir -p "$ASSETS_DIR"

SCRIPT_DIR="$PROJECT_DIR/hack/boot-assets"
SCRIPT_DIR="$RUN_DIR/hack/boot-assets"

function build_artifacts() {
local arch=$1
Expand All @@ -91,6 +98,4 @@ cp "$SCRIPT_DIR/Dockerfile" .

docker build -t "$FINAL_IMAGE" .

rm -rf "$TEMP_DIR"

echo "Built image: $FINAL_IMAGE"

0 comments on commit db39e41

Please sign in to comment.