Skip to content

Commit 0c69103

Browse files
ci(go-feature-flag): Fix flaky maven generate-resources stage (#1541)
Signed-off-by: Thomas Poignant <[email protected]>
1 parent 921fdb1 commit 0c69103

File tree

4 files changed

+9
-82
lines changed

4 files changed

+9
-82
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
steps:
2525
- name: Checkout Repository
2626
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
27+
with:
28+
submodules: recursive
2729

2830
- name: Set up JDK ${{ matrix.build.java }}
2931
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
[submodule "providers/flagd/spec"]
99
path = providers/flagd/spec
1010
url = https://github.com/open-feature/spec.git
11+
[submodule "providers/go-feature-flag/wasm-releases"]
12+
path = providers/go-feature-flag/wasm-releases
13+
url = https://github.com/go-feature-flag/wasm-releases.git
Lines changed: 3 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,5 @@
11
#!/usr/bin/env bash
22

3-
# This script downloads the wasm file from the go-feature-flag repository and adds it to the build.
4-
5-
wasm_version="v1.45.0" # {{wasm_version}}
6-
7-
# Set the repository owner and name
8-
repo_owner="thomaspoignant"
9-
repo_name="go-feature-flag"
10-
file_suffix=".wasi"
11-
target_dir="./src/main/resources/wasm/"
12-
13-
# Function to find the download URL
14-
find_download_url() {
15-
local release_tag=$1
16-
local file_suffix=$2
17-
18-
# Get the assets for the specific release
19-
assets=$(curl -s "https://api.github.com/repos/$repo_owner/$repo_name/releases/tags/$wasm_version" | jq -r '.assets')
20-
21-
if [ -z "$assets" ]; then
22-
echo "Error: No assets found for release $wasm_version"
23-
return 1
24-
fi
25-
26-
# Find the asset that matches the file prefix
27-
download_url=$(echo "$assets" | jq -r ".[] | select(.name | endswith(\"$file_suffix\")) | .browser_download_url")
28-
29-
if [ -z "$download_url" ]; then
30-
echo "Error: No asset found with prefix '$file_suffix' in release $wasm_version"
31-
return 1
32-
fi
33-
echo "$download_url"
34-
}
35-
36-
# Function to download the file
37-
download_file() {
38-
local url=$1
39-
local target_dir=$2
40-
41-
if [ -z "$url" ]; then
42-
echo "Error: Download URL is empty."
43-
return 1
44-
fi
45-
46-
if [ -z "$target_dir" ]; then
47-
echo "Error: Target directory is empty."
48-
return 1
49-
fi
50-
51-
# Extract the filename from the URL
52-
local filename=$(basename "$url")
53-
54-
# Check if the directory exists
55-
if [ ! -d "$target_dir" ]; then
56-
mkdir -p "$target_dir" # Create the directory if it doesn't exist
57-
fi
58-
59-
# Use curl to download the file with progress
60-
echo "Downloading $filename to $target_dir..."
61-
curl -L -o "$target_dir/$filename" "$url"
62-
if [ $? -ne 0 ]; then
63-
echo "Error: Download failed."
64-
return 1
65-
fi
66-
echo "Download successful!"
67-
}
68-
69-
# Main script logic
70-
download_url=$(find_download_url "$latest_release" "$file_suffix")
71-
if [ $? -ne 0 ]; then
72-
echo "Error: Failed to find the download URL for release $latest_release."
73-
exit 1
74-
fi
75-
76-
download_file "$download_url" "$target_dir"
77-
if [ $? -ne 0 ]; then
78-
echo "Error: Failed to download the file. $download_url"
79-
exit 1
80-
fi
81-
82-
ls "$target_dir"
83-
84-
echo "Done."
3+
# This script copy the wasm module from the git submodule repository and adds it to the build.
4+
wasm_version="v1.45.4" # {{wasm_version}}
5+
mv ./wasm-releases/evaluation/gofeatureflag-evaluation_$wasm_version.wasi ./src/main/resources/wasm/gofeatureflag-evaluation_$wasm_version.wasi
Submodule wasm-releases added at a81f8c4

0 commit comments

Comments
 (0)