From 581a3aea1376b4170c8917a587027357c3bdb7da Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Thu, 14 Dec 2023 21:38:43 +0530 Subject: [PATCH 1/6] add script --- scripts/linux-arm.sh | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 scripts/linux-arm.sh diff --git a/scripts/linux-arm.sh b/scripts/linux-arm.sh new file mode 100755 index 00000000..51ca3ae7 --- /dev/null +++ b/scripts/linux-arm.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +set -e + +list=( +"steampipe-plugin-github" +) + +if [[ ! ${MY_PATH} ]]; +then + MY_PATH="`dirname \"$0\"`" # relative + MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +fi + +echo $MY_PATH + +mkdir $MY_PATH/go-cache || true +mkdir $MY_PATH/go-mod-cache || true + +GOCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder steampipe_fdw_builder:15 go env GOCACHE) +MODCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder steampipe_fdw_builder:15 go env GOMODCACHE) + +for item in "${list[@]}"; do + plugin_name=${item##*-} + + echo "Processing plugin: ${plugin_name}" + + # Step 1: Switch to steampipe-postgres-fdw directory + cd $GITHUB_WORKSPACE/steampipe-postgres-fdw || exit 1 + + # Step 2: Run Docker commands for Postgres FDW Builder v15 + echo "Building Postgres FDW 15 for plugin: ${plugin_name}" + docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder -v "$(pwd)":/tmp/ext steampipe_fdw_builder:15 make clean + docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder -v "$(pwd)":/tmp/ext steampipe_fdw_builder:15 make standalone plugin="${plugin_name}" + + # Step 3: Check if build-Linux directory is created + if [ ! -d "build-Linux" ] || [ ! -f "build-Linux/steampipe_postgres_${plugin_name}.so" ]; then + echo "Error: build-Linux directory or steampipe_postgres_${plugin_name}.so not found." + exit 1 + fi + + # Step 4: Move and tar for Postgres v15 + echo "Move and tar for Postgres v15 for plugin: ${plugin_name}" + mv build-Linux steampipe_postgres_${plugin_name}.pg15.linux_arm64 + tar -czvf steampipe_postgres_${plugin_name}.pg15.linux_arm64.tar.gz steampipe_postgres_${plugin_name}.pg15.linux_arm64 + + # Step 5: Check if tar.gz file is created for v15 + if [ ! -f "steampipe_postgres_${plugin_name}.pg15.linux_arm64.tar.gz" ]; then + echo "Error: Tar file for Postgres v15 not created." + exit 1 + fi + + # Step 6: Run Docker commands for Postgres FDW Builder v14 + echo "Building Postgres FDW 14 for plugin: ${plugin_name}" + docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder -v "$(pwd)":/tmp/ext steampipe_fdw_builder:14 make clean + docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder -v "$(pwd)":/tmp/ext steampipe_fdw_builder:14 make standalone plugin="${plugin_name}" + + # Step 7: Check if build-Linux directory is created for v14 + if [ ! -d "build-Linux" ] || [ ! -f "build-Linux/steampipe_postgres_${plugin_name}.so" ]; then + echo "Error: build-Linux directory or steampipe_postgres_${plugin_name}.so not found for Postgres v14." + exit 1 + fi + + # Step 8: Move and tar for Postgres v14 + echo "Move and tar for Postgres v14 for plugin: ${plugin_name}" + mv build-Linux steampipe_postgres_${plugin_name}.pg14.linux_arm64 + tar -czvf steampipe_postgres_${plugin_name}.pg14.linux_arm64.tar.gz steampipe_postgres_${plugin_name}.pg14.linux_arm64 + + # Step 9: Check if tar.gz file is created for v14 + if [ ! -f "steampipe_postgres_${plugin_name}.pg14.linux_arm64.tar.gz" ]; then + echo "Error: Tar file for Postgres v14 not created." + exit 1 + fi + + # Extra step + mv steampipe_postgres_${plugin_name}.pg15.linux_arm64.tar.gz $GITHUB_WORKSPACE + mv steampipe_postgres_${plugin_name}.pg14.linux_arm64.tar.gz $GITHUB_WORKSPACE + + echo "Processing completed for plugin: ${plugin_name}" +done + +echo "All plugins processed successfully." From 8524aefcd58cd398bf248d895b4236aa0aa2440c Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Thu, 14 Dec 2023 21:43:00 +0530 Subject: [PATCH 2/6] updates path --- scripts/linux-arm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/linux-arm.sh b/scripts/linux-arm.sh index 51ca3ae7..40bc3d5b 100755 --- a/scripts/linux-arm.sh +++ b/scripts/linux-arm.sh @@ -26,7 +26,7 @@ for item in "${list[@]}"; do echo "Processing plugin: ${plugin_name}" # Step 1: Switch to steampipe-postgres-fdw directory - cd $GITHUB_WORKSPACE/steampipe-postgres-fdw || exit 1 + cd $GITHUB_WORKSPACE || exit 1 # Step 2: Run Docker commands for Postgres FDW Builder v15 echo "Building Postgres FDW 15 for plugin: ${plugin_name}" From ed3a1d98a045927bc5a0199f943fd2a8476b3a42 Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Thu, 14 Dec 2023 23:15:47 +0530 Subject: [PATCH 3/6] no need to move files --- scripts/linux-arm.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/linux-arm.sh b/scripts/linux-arm.sh index 40bc3d5b..c1119fa2 100755 --- a/scripts/linux-arm.sh +++ b/scripts/linux-arm.sh @@ -72,10 +72,6 @@ for item in "${list[@]}"; do exit 1 fi - # Extra step - mv steampipe_postgres_${plugin_name}.pg15.linux_arm64.tar.gz $GITHUB_WORKSPACE - mv steampipe_postgres_${plugin_name}.pg14.linux_arm64.tar.gz $GITHUB_WORKSPACE - echo "Processing completed for plugin: ${plugin_name}" done From adac2e0d3d2d0e76b13f8fe1cb8aed9a80034056 Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Fri, 15 Dec 2023 11:59:40 +0530 Subject: [PATCH 4/6] seperate scripts for pg14 and pg15 --- scripts/build-linux-arm-pg14.sh | 56 +++++++++++++++++++ .../{linux-arm.sh => build-linux-arm-pg15.sh} | 24 +------- 2 files changed, 57 insertions(+), 23 deletions(-) create mode 100755 scripts/build-linux-arm-pg14.sh rename scripts/{linux-arm.sh => build-linux-arm-pg15.sh} (61%) diff --git a/scripts/build-linux-arm-pg14.sh b/scripts/build-linux-arm-pg14.sh new file mode 100755 index 00000000..a5f06486 --- /dev/null +++ b/scripts/build-linux-arm-pg14.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +set -e + +list=( +"steampipe-plugin-$1" +) + +if [[ ! ${MY_PATH} ]]; +then + MY_PATH="`dirname \"$0\"`" # relative + MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +fi + +echo $MY_PATH + +mkdir $MY_PATH/go-cache || true +mkdir $MY_PATH/go-mod-cache || true + +GOCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder steampipe_fdw_builder:14 go env GOCACHE) +MODCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder steampipe_fdw_builder:14 go env GOMODCACHE) + +for item in "${list[@]}"; do + plugin_name=${item##*-} + + echo "Processing plugin: ${plugin_name}" + + # Step 1: Switch to steampipe-postgres-fdw directory + cd $GITHUB_WORKSPACE || exit 1 + + # Step 2: Run Docker commands for Postgres FDW Builder v14 + echo "Building Postgres FDW 14 for plugin: ${plugin_name}" + docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder -v "$(pwd)":/tmp/ext steampipe_fdw_builder:14 make clean + docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder -v "$(pwd)":/tmp/ext steampipe_fdw_builder:14 make standalone plugin="${plugin_name}" + + # Step 3: Check if build-Linux directory is created + if [ ! -d "build-Linux" ] || [ ! -f "build-Linux/steampipe_postgres_${plugin_name}.so" ]; then + echo "Error: build-Linux directory or steampipe_postgres_${plugin_name}.so not found." + exit 1 + fi + + # Step 4: Move and tar for Postgres v14 + echo "Move and tar for Postgres v14 for plugin: ${plugin_name}" + mv build-Linux steampipe_postgres_${plugin_name}.pg14.linux_arm64 + tar -czvf steampipe_postgres_${plugin_name}.pg14.linux_arm64.tar.gz steampipe_postgres_${plugin_name}.pg14.linux_arm64 + + # Step 5: Check if tar.gz file is created for v14 + if [ ! -f "steampipe_postgres_${plugin_name}.pg14.linux_arm64.tar.gz" ]; then + echo "Error: Tar file for Postgres v14 not created." + exit 1 + fi + + echo "Processing completed for plugin: ${plugin_name}" +done + +echo "All plugins processed successfully." diff --git a/scripts/linux-arm.sh b/scripts/build-linux-arm-pg15.sh similarity index 61% rename from scripts/linux-arm.sh rename to scripts/build-linux-arm-pg15.sh index c1119fa2..2885f74e 100755 --- a/scripts/linux-arm.sh +++ b/scripts/build-linux-arm-pg15.sh @@ -3,7 +3,7 @@ set -e list=( -"steampipe-plugin-github" +"steampipe-plugin-$1" ) if [[ ! ${MY_PATH} ]]; @@ -50,28 +50,6 @@ for item in "${list[@]}"; do exit 1 fi - # Step 6: Run Docker commands for Postgres FDW Builder v14 - echo "Building Postgres FDW 14 for plugin: ${plugin_name}" - docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder -v "$(pwd)":/tmp/ext steampipe_fdw_builder:14 make clean - docker run --memory="10g" --memory-swap="16g" --rm --name sp_fdw_builder -v "$(pwd)":/tmp/ext steampipe_fdw_builder:14 make standalone plugin="${plugin_name}" - - # Step 7: Check if build-Linux directory is created for v14 - if [ ! -d "build-Linux" ] || [ ! -f "build-Linux/steampipe_postgres_${plugin_name}.so" ]; then - echo "Error: build-Linux directory or steampipe_postgres_${plugin_name}.so not found for Postgres v14." - exit 1 - fi - - # Step 8: Move and tar for Postgres v14 - echo "Move and tar for Postgres v14 for plugin: ${plugin_name}" - mv build-Linux steampipe_postgres_${plugin_name}.pg14.linux_arm64 - tar -czvf steampipe_postgres_${plugin_name}.pg14.linux_arm64.tar.gz steampipe_postgres_${plugin_name}.pg14.linux_arm64 - - # Step 9: Check if tar.gz file is created for v14 - if [ ! -f "steampipe_postgres_${plugin_name}.pg14.linux_arm64.tar.gz" ]; then - echo "Error: Tar file for Postgres v14 not created." - exit 1 - fi - echo "Processing completed for plugin: ${plugin_name}" done From ad9b42c97d9acfc6425d780ebef72e4d820b5123 Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Fri, 15 Dec 2023 16:38:47 +0530 Subject: [PATCH 5/6] add sqlite script --- scripts/build-linux-arm-sqlite.sh | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 scripts/build-linux-arm-sqlite.sh diff --git a/scripts/build-linux-arm-sqlite.sh b/scripts/build-linux-arm-sqlite.sh new file mode 100644 index 00000000..bf0207e2 --- /dev/null +++ b/scripts/build-linux-arm-sqlite.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +set -e + +list=( +"steampipe-plugin-$1" +) + +if [[ ! ${MY_PATH} ]]; +then + MY_PATH="`dirname \"$0\"`" # relative + MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +fi + +echo $MY_PATH + +mkdir $MY_PATH/go-cache || true +mkdir $MY_PATH/go-mod-cache || true + +GOCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder steampipe_qlite_builder:latest go env GOCACHE) +MODCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder steampipe_qlite_builder:latest go env GOMODCACHE) + +for item in "${list[@]}"; do + # Extract the plugin name (last word after the hyphen) + plugin_name=${item##*-} + + echo "Processing plugin: ${plugin_name}" + + # Step 1: Switch to steampipe-sqlite-extension directory + cd /Users/pskrbasu/turbot-delivery/Steampipe/steampipe-sqlite-extension || exit 1 + + # Step 2: Run Docker commands for SQLite Builder + docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder -v "$(pwd)":/tmp/ext steampipe_qlite_builder make build plugin="${plugin_name}" + + # Step 3: Tar the SQLite extension + tar -czvf steampipe_sqlite_${plugin_name}.linux_arm64.tar.gz steampipe_sqlite_${plugin_name}.so + + # Final Check: If SQLite tar.gz file is created + if [ ! -f "steampipe_sqlite_${plugin_name}.linux_arm64.tar.gz" ]; then + echo "Error: Tar file for SQLite not created." + exit 1 + fi + + echo "Processing completed for plugin: ${plugin_name}" +done + +echo "All plugins processed successfully." \ No newline at end of file From 9d9c1fe1878a51b9f4c3b89955464f5b3ceb23c4 Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Fri, 15 Dec 2023 18:34:29 +0530 Subject: [PATCH 6/6] remove sqlite script --- scripts/build-linux-arm-sqlite.sh | 47 ------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 scripts/build-linux-arm-sqlite.sh diff --git a/scripts/build-linux-arm-sqlite.sh b/scripts/build-linux-arm-sqlite.sh deleted file mode 100644 index bf0207e2..00000000 --- a/scripts/build-linux-arm-sqlite.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -set -e - -list=( -"steampipe-plugin-$1" -) - -if [[ ! ${MY_PATH} ]]; -then - MY_PATH="`dirname \"$0\"`" # relative - MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized -fi - -echo $MY_PATH - -mkdir $MY_PATH/go-cache || true -mkdir $MY_PATH/go-mod-cache || true - -GOCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder steampipe_qlite_builder:latest go env GOCACHE) -MODCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder steampipe_qlite_builder:latest go env GOMODCACHE) - -for item in "${list[@]}"; do - # Extract the plugin name (last word after the hyphen) - plugin_name=${item##*-} - - echo "Processing plugin: ${plugin_name}" - - # Step 1: Switch to steampipe-sqlite-extension directory - cd /Users/pskrbasu/turbot-delivery/Steampipe/steampipe-sqlite-extension || exit 1 - - # Step 2: Run Docker commands for SQLite Builder - docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder -v "$(pwd)":/tmp/ext steampipe_qlite_builder make build plugin="${plugin_name}" - - # Step 3: Tar the SQLite extension - tar -czvf steampipe_sqlite_${plugin_name}.linux_arm64.tar.gz steampipe_sqlite_${plugin_name}.so - - # Final Check: If SQLite tar.gz file is created - if [ ! -f "steampipe_sqlite_${plugin_name}.linux_arm64.tar.gz" ]; then - echo "Error: Tar file for SQLite not created." - exit 1 - fi - - echo "Processing completed for plugin: ${plugin_name}" -done - -echo "All plugins processed successfully." \ No newline at end of file