-
Notifications
You must be signed in to change notification settings - Fork 62
ci(go-feature-flag): Fix flaky maven generate-resources stage #1541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6ca856f
Adding git submodule
thomaspoignant 61c567c
Change script to copy file instead of downloading it
thomaspoignant f4cdae7
upgrade version wasm
thomaspoignant 300b7b6
add git submodule
thomaspoignant a081c46
Adding wasm-releases submodule
thomaspoignant f76a668
remove top level wasm-release
thomaspoignant 6dab1a7
add submodule to checkout
thomaspoignant 88500c1
Merge branch 'main' into fix-flaky-maven-goff
thomaspoignant 115b12e
remove unused part of the script
thomaspoignant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,84 +1,5 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # This script downloads the wasm file from the go-feature-flag repository and adds it to the build. | ||
|
|
||
| wasm_version="v1.45.0" # {{wasm_version}} | ||
|
|
||
| # Set the repository owner and name | ||
| repo_owner="thomaspoignant" | ||
| repo_name="go-feature-flag" | ||
| file_suffix=".wasi" | ||
| target_dir="./src/main/resources/wasm/" | ||
|
|
||
| # Function to find the download URL | ||
| find_download_url() { | ||
| local release_tag=$1 | ||
| local file_suffix=$2 | ||
|
|
||
| # Get the assets for the specific release | ||
| assets=$(curl -s "https://api.github.com/repos/$repo_owner/$repo_name/releases/tags/$wasm_version" | jq -r '.assets') | ||
|
|
||
| if [ -z "$assets" ]; then | ||
| echo "Error: No assets found for release $wasm_version" | ||
| return 1 | ||
| fi | ||
|
|
||
| # Find the asset that matches the file prefix | ||
| download_url=$(echo "$assets" | jq -r ".[] | select(.name | endswith(\"$file_suffix\")) | .browser_download_url") | ||
|
|
||
| if [ -z "$download_url" ]; then | ||
| echo "Error: No asset found with prefix '$file_suffix' in release $wasm_version" | ||
| return 1 | ||
| fi | ||
| echo "$download_url" | ||
| } | ||
|
|
||
| # Function to download the file | ||
| download_file() { | ||
| local url=$1 | ||
| local target_dir=$2 | ||
|
|
||
| if [ -z "$url" ]; then | ||
| echo "Error: Download URL is empty." | ||
| return 1 | ||
| fi | ||
|
|
||
| if [ -z "$target_dir" ]; then | ||
| echo "Error: Target directory is empty." | ||
| return 1 | ||
| fi | ||
|
|
||
| # Extract the filename from the URL | ||
| local filename=$(basename "$url") | ||
|
|
||
| # Check if the directory exists | ||
| if [ ! -d "$target_dir" ]; then | ||
| mkdir -p "$target_dir" # Create the directory if it doesn't exist | ||
| fi | ||
|
|
||
| # Use curl to download the file with progress | ||
| echo "Downloading $filename to $target_dir..." | ||
| curl -L -o "$target_dir/$filename" "$url" | ||
| if [ $? -ne 0 ]; then | ||
| echo "Error: Download failed." | ||
| return 1 | ||
| fi | ||
| echo "Download successful!" | ||
| } | ||
|
|
||
| # Main script logic | ||
| download_url=$(find_download_url "$latest_release" "$file_suffix") | ||
| if [ $? -ne 0 ]; then | ||
| echo "Error: Failed to find the download URL for release $latest_release." | ||
| exit 1 | ||
| fi | ||
|
|
||
| download_file "$download_url" "$target_dir" | ||
| if [ $? -ne 0 ]; then | ||
| echo "Error: Failed to download the file. $download_url" | ||
| exit 1 | ||
| fi | ||
|
|
||
| ls "$target_dir" | ||
|
|
||
| echo "Done." | ||
| # This script copy the wasm module from the git submodule repository and adds it to the build. | ||
| wasm_version="v1.45.4" # {{wasm_version}} | ||
| mv ./wasm-releases/evaluation/gofeatureflag-evaluation_$wasm_version.wasi ./src/main/resources/wasm/gofeatureflag-evaluation_$wasm_version.wasi |
Submodule wasm-releases
added at
a81f8c
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.