Merge pull request #4678 from turbot/v2.3.x

Release Steampipe v2.3.0
This commit is contained in:
Puskar Basu
2025-10-30 15:42:07 +05:30
committed by GitHub
17 changed files with 407 additions and 102 deletions

View File

@@ -51,7 +51,7 @@ jobs:
- name: Checkout
if: steps.semver_parser.outputs.prerelease == ''
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: turbot/homebrew-tap
token: ${{ secrets.GH_ACCESS_TOKEN }}
@@ -77,13 +77,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: steampipe
ref: ${{ github.event.ref }}
- name: Checkout Pipe Fittings Components repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: turbot/pipe-fittings
path: pipe-fittings
@@ -109,7 +109,7 @@ jobs:
git push origin $VERSION
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: 1.24
@@ -146,7 +146,7 @@ jobs:
- name: Checkout
if: steps.semver_parser.outputs.prerelease == ''
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: turbot/homebrew-tap
token: ${{ secrets.GH_ACCESS_TOKEN }}
@@ -192,7 +192,7 @@ jobs:
- name: Checkout
if: steps.semver_parser.outputs.prerelease == ''
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: turbot/homebrew-tap
token: ${{ secrets.GH_ACCESS_TOKEN }}
@@ -227,7 +227,7 @@ jobs:
- name: Checkout
if: steps.semver_parser.outputs.prerelease == ''
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: turbot/homebrew-tap
token: ${{ secrets.GH_ACCESS_TOKEN }}

View File

@@ -9,12 +9,12 @@ on:
Version number for the OCI image for this release - usually the same as the
postgres version
required: true
default: 14.17.0
default: 14.19.0
postgres_version:
description: "Postgres Version to package (eg 14.2.0)"
required: true
default: 14.17.0
default: 14.19.0
env:
PROJECT_ID: steampipe
@@ -63,13 +63,13 @@ jobs:
fi
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.event.inputs.branch }}
# Login to GHCR
- name: Log in to the Container registry
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@@ -78,32 +78,32 @@ jobs:
- name: Pull & Extract - darwin amd64
run: |-
EXTRACT_DIR=extracted-darwin-amd64
# new link (darwin-amd64.txz) - https://drive.google.com/file/d/12fxd_jZxdP4Ilwd0BnefbVCLZV957TNJ/view?usp=drive_link
curl -L -o darwin-amd64.txz "https://drive.google.com/uc?export=download&id=12fxd_jZxdP4Ilwd0BnefbVCLZV957TNJ"
# new link (darwin-amd64.txz) - https://drive.google.com/file/d/14t83HKLJ-ckLwgqRnkVPMTeaw5wMoPu2/view?usp=drive_link
curl -L -o darwin-amd64.txz "https://drive.google.com/uc?export=download&id=14t83HKLJ-ckLwgqRnkVPMTeaw5wMoPu2"
mkdir $EXTRACT_DIR
tar -xf darwin-amd64.txz --directory $EXTRACT_DIR
- name: Pull & Extract - darwin arm64
run: |-
EXTRACT_DIR=extracted-darwin-arm64
# new link (darwin-arm64.txz) - https://drive.google.com/file/d/1lG6eNYM5JaywbRxQBubzMDmbCtGVilQh/view?usp=drive_link
curl -L -o darwin-arm64.txz "https://drive.google.com/uc?export=download&id=1lG6eNYM5JaywbRxQBubzMDmbCtGVilQh"
# new link (darwin-arm64.txz) - https://drive.google.com/file/d/1UXdLn9aNDY_5OVLjgwF_cAPKiAsxHHB-/view?usp=drive_link
curl -L -o darwin-arm64.txz "https://drive.google.com/uc?export=download&id=1UXdLn9aNDY_5OVLjgwF_cAPKiAsxHHB-"
mkdir $EXTRACT_DIR
tar -xf darwin-arm64.txz --directory $EXTRACT_DIR
- name: Pull & Extract - linux amd64
run: |-
EXTRACT_DIR=extracted-linux-amd64
# new link (linux-amd64.txz) - https://drive.google.com/file/d/11pqDcTtlD7RF5LPj-X4gRVfl4mk00fuy/view?usp=drive_link
curl -L -o linux-amd64.txz "https://drive.google.com/uc?export=download&id=11pqDcTtlD7RF5LPj-X4gRVfl4mk00fuy"
# new link (linux-amd64.txz) - https://drive.google.com/file/d/1CetXFMZZRAtkVr4gCTlcJcOfIm0wyyYn/view?usp=drive_link
curl -L -o linux-amd64.txz "https://drive.google.com/uc?export=download&id=1CetXFMZZRAtkVr4gCTlcJcOfIm0wyyYn"
mkdir $EXTRACT_DIR
tar -xf linux-amd64.txz --directory $EXTRACT_DIR
- name: Pull & Extract - linux arm64
run: |-
EXTRACT_DIR=extracted-linux-arm64
# new link (linux-arm64.txz) - https://drive.google.com/file/d/1lpjyHegwd_8574uVWgaPB31yR7vRB8Zh/view?usp=drive_link
curl -L -o linux-arm64.txz "https://drive.google.com/uc?export=download&id=1lpjyHegwd_8574uVWgaPB31yR7vRB8Zh"
# new link (linux-arm64.txz) - https://drive.google.com/file/d/1ce43gJu8HPAufcsZEk87uFPyT6fGEair/view?usp=drive_link
curl -L -o linux-arm64.txz "https://drive.google.com/uc?export=download&id=1ce43gJu8HPAufcsZEk87uFPyT6fGEair"
mkdir $EXTRACT_DIR
tar -xf linux-arm64.txz --directory $EXTRACT_DIR
@@ -160,10 +160,10 @@ jobs:
extracted-linux-amd64:application/vnd.turbot.steampipe.db.linux-amd64.layer.v1+tar \
extracted-linux-arm64:application/vnd.turbot.steampipe.db.linux-arm64.layer.v1+tar
# check if the version is NOT an rc version before tagging as latest
# check if the version is NOT an pre-release version before tagging as latest
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tagging as latest: $LATEST_REF"
oras tag $REF latest
else
echo "Skipping latest tag for rc version: $VERSION"
echo "Skipping latest tag for pre-release version: $VERSION"
fi

View File

@@ -15,19 +15,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: steampipe
- name: Checkout Pipe Fittings Components repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: turbot/pipe-fittings
path: pipe-fittings
ref: v1.6.x
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: 1.24

View File

@@ -15,19 +15,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: steampipe
- name: Checkout Pipe Fittings Components repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: turbot/pipe-fittings
path: pipe-fittings
ref: v1.6.x
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: 1.24
@@ -40,7 +40,7 @@ jobs:
# used to speedup go test
- name: Go Build Cache
id: build-cache
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
@@ -67,7 +67,9 @@ jobs:
run: |
mkdir ~/artifacts
mv $GITHUB_WORKSPACE/steampipe/dist/steampipe_linux_amd64.tar.gz ~/artifacts/linux.tar.gz
mv $GITHUB_WORKSPACE/steampipe/dist/steampipe_linux_arm64.tar.gz ~/artifacts/linux-arm64.tar.gz
mv $GITHUB_WORKSPACE/steampipe/dist/steampipe_darwin_arm64.zip ~/artifacts/darwin.zip
mv $GITHUB_WORKSPACE/steampipe/dist/steampipe_darwin_amd64.zip ~/artifacts/darwin-amd64.zip
- name: List Build Artifacts
run: ls -l ~/artifacts
@@ -80,14 +82,6 @@ jobs:
if-no-files-found: error
overwrite: true
- name: Save MacOS Build Artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-artifact-darwin
path: ~/artifacts/darwin.zip
if-no-files-found: error
overwrite: true
acceptance_test:
name: Test
needs: goreleaser
@@ -125,12 +119,12 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: 1.24
@@ -146,20 +140,7 @@ jobs:
name: build-artifact-linux
path: ~/artifacts
- name: Download Darwin Build Artifacts
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
if: ${{ matrix.platform == 'macos-latest' }}
with:
name: build-artifact-darwin
path: ~/artifacts
- name: Extract Darwin Artifacts and Install Binary
if: ${{ matrix.platform == 'macos-latest' }}
run: |
mkdir ~/build
unzip ~/artifacts/darwin.zip -d ~/build
- name: Extract Ubuntu Artifacts and Install Binary
- name: Extract Linux Artifacts and Install Binary
if: ${{ matrix.platform == 'ubuntu-latest' }}
run: |
mkdir ~/build
@@ -167,20 +148,21 @@ jobs:
- name: Set PATH
run: |
echo "PATH=$PATH:$HOME/build:$GTIHUB_WORKSPACE/tests/acceptance/lib/bats-core/libexec" >> $GITHUB_ENV
echo "PATH=$PATH:$HOME/build:$GITHUB_WORKSPACE/tests/acceptance/lib/bats-core/libexec" >> $GITHUB_ENV
- name: Go install jd
run: |
run: |-
go install github.com/josephburnett/jd@latest
- name: Install DB
id: install-db
continue-on-error: false
run: |
steampipe query "select 1"
STEAMPIPE_LOG_LEVEL=trace steampipe query "select 1"
steampipe plugin install chaos chaosdynamic --progress=false
- name: Save Install DB Logs
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: install-db-logs-${{ matrix.test_block }}-${{ matrix.platform }}

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Download Linux Release Artifact
run: |
@@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Download Linux Release Artifact
run: |
@@ -114,7 +114,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Download Linux Release Artifact
run: |
@@ -160,7 +160,7 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Download Linux Release Artifact
run: |

View File

@@ -16,7 +16,7 @@ jobs:
steps:
- name: Stale issues and PRs
id: stale-issues-and-prs
uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
with:
close-issue-message: |
This issue was closed because it has been stalled for 90 days with no activity.

View File

@@ -1,3 +1,11 @@
## v2.3.0 [2025-10-30]
_Whats new_
- Update database version to PostgreSQL 14.19. ([#4644](https://github.com/turbot/steampipe/issues/4644))
_Bug fixes_
- Fix issue where the truncation message was not showing in batch queries for table output format. ([#4674](https://github.com/turbot/steampipe/issues/4674))
- Improve truncation message for datasets exceeding 10k rows in table output format. ([#4674](https://github.com/turbot/steampipe/issues/4674))
## v2.2.0 [2025-09-24]
_Whats new_
- Add support for using context functions in steampipe connection config. ([#4433](https://github.com/turbot/steampipe/issues/4433))

View File

@@ -0,0 +1,241 @@
# PostgreSQL Source Build Instructions
This document provides step-by-step instructions for building the embedded PostgreSQL binaries required by Steampipe for a specific PostgreSQL version. It covers both macOS and Linux environments, including prerequisites, build steps, and packaging guidelines to ensure the resulting binaries are relocatable and suitable for Steampipe's use.
1. **Source Code:**
[https://www.postgresql.org/ftp/source/](https://www.postgresql.org/ftp/source/)
2. **Build Documentation:**
[https://www.postgresql.org/docs/current/install-make.html](https://www.postgresql.org/docs/current/install-make.html)
---
## 3. Download Source Code and Run
### For MacOS
#### 3.1. Pre-requisites
* `openssl`
---
#### 3.2. Steps to Build
1. Change to the PostgreSQL source directory:
```bash
cd /postgres/source/dir
```
2. Set environment variables:
```bash
export MACOSX_DEPLOYMENT_TARGET=11.0
export CFLAGS="-mmacosx-version-min=11.0"
export LDFLAGS="-mmacosx-version-min=11.0 -Wl,-rpath,@loader_path/../lib/postgresql"
```
*(Rebuild with an older deployment target)*
3. Configure the build:
```bash
./configure --prefix=location/where/you/want/the/files \
--libdir=/location/where/you/want/the/files/lib/postgresql \
--datadir=/location/where/you/want/the/files/share/postgresql \
--with-openssl \
--with-includes=$(brew --prefix openssl)/include \
--with-libraries=$(brew --prefix openssl)/lib
```
*(Make sure the `libdir` and `datadir` args are passed correctly and point to the `postgresql` dir inside `lib` and `share` — this is needed for Steampipe.)*
4. Build PostgreSQL:
```bash
make -j$(sysctl -n hw.ncpu)
```
5. Install binaries:
```bash
make install
```
6. Verify that all binaries are built in the specified location.
7. Build contrib modules:
```bash
make -C contrib
```
8. Install contrib modules:
```bash
make -C contrib install
```
9. *(This builds extensions in the contrib directory — needed since we load `ltree` and `tablefunc`.)*
10. Verify installation structure:
```bash
ls -al location/where/you/want/the/files
```
You should see `lib`, `share`, `bin`, and `include` directories under that path.
11. Remove the `include` directory.
12. Remove unneeded binaries from `bin`.
13. Check that all extensions exist.
---
#### 3.3. Fix RPATHs
Run the `fix_rpath.sh` script to fix the rpaths of the binaries (`initdb`, `pg_restore`, `pg_dump`):
```bash
#!/bin/bash
set -euo pipefail
# --- CONFIGURE ---
# Adjust if your libpq lives in lib/ not lib/postgresql
LIB_SUBDIR="lib/postgresql"
BUNDLE_ROOT="$(pwd)"
LIBPQ_PATH="$BUNDLE_ROOT/$LIB_SUBDIR/libpq.5.dylib"
echo "🔧 Fixing libpq install name..."
install_name_tool -id "@rpath/libpq.5.dylib" "$LIBPQ_PATH"
echo "🔍 Processing binaries in bin/..."
for binfile in "$BUNDLE_ROOT"/bin/*; do
[[ -x "$binfile" && ! -d "$binfile" ]] || continue
echo "➡️ Patching $(basename "$binfile")"
# Ensure an rpath to ../lib/postgresql exists
install_name_tool -add_rpath "@loader_path/../$LIB_SUBDIR" "$binfile" 2>/dev/null || true
# Rewrite any absolute reference to libpq
install_name_tool -change "$BUNDLE_ROOT/$LIB_SUBDIR/libpq.5.dylib" "@rpath/libpq.5.dylib" "$binfile" 2>/dev/null || true
done
echo "✅ Verification:"
for binfile in "$BUNDLE_ROOT"/bin/*; do
[[ -x "$binfile" && ! -d "$binfile" ]] || continue
echo "--- $(basename "$binfile") ---"
otool -L "$binfile" | grep libpq || echo "⚠️ No libpq linkage"
otool -l "$binfile" | grep -A2 LC_RPATH | grep path || echo "⚠️ No RPATH"
done
```
---
#### 3.4. Pack the Built Binaries
Create a `.txz` archive:
```bash
tar --disable-copyfile --exclude='._*' -cJf darwin-arm64.txz -C darwin-arm64 bin lib share
```
---
### For Linux (Ubuntu 24 / amd64 or arm64)
#### 3.5. Pre-requisites
```bash
apt update
apt install -y build-essential wget ca-certificates \
libreadline-dev zlib1g-dev flex bison \
libssl-dev patchelf file
```
---
#### 3.6. Steps to Build
1. Change to the PostgreSQL source directory:
```bash
cd /postgres/source/dir
```
2. Set installation prefix and linker flags:
```bash
export PREFIX=/postgres-binaries-14.19/linux-$(uname -m)
mkdir -p "$PREFIX"
export LDFLAGS='-Wl,-rpath,$ORIGIN/../lib/postgresql -Wl,--enable-new-dtags'
```
3. Configure:
```bash
./configure \
--prefix="$PREFIX" \
--libdir="$PREFIX/lib/postgresql" \
--datadir="$PREFIX/share/postgresql" \
--with-openssl \
--with-includes=/usr/include \
--with-libraries=/usr/lib/$(uname -m)-linux-gnu
```
4. Build and install:
```bash
make -j2
make install
```
5. Build contrib extensions:
```bash
make -C contrib -j2
make -C contrib install
```
6. Patch RPATHs for relocatability:
```bash
cd "$PREFIX"
for f in bin/*; do
if [ -x "$f" ] && file "$f" | grep -q ELF; then
patchelf --set-rpath '$ORIGIN/../lib/postgresql' "$f"
fi
done
```
7. Verify RPATH:
```bash
readelf -d bin/initdb | grep -i rpath
# → RUNPATH [$ORIGIN/../lib/postgresql]
```
8. Verify linkage:
```bash
ldd bin/initdb | grep libpq
# → libpq.so.5 => .../bin/../lib/postgresql/libpq.so.5
```
9. Remove `include` directory and unnecessary binaries:
```bash
rm -rf "$PREFIX/include"
```
10. Pack into `.txz`:
```bash
cd $(dirname "$PREFIX")
tar -cJf postgres-14.19-$(uname -m).txz $(basename "$PREFIX")
```
**Done.**

12
go.mod
View File

@@ -20,12 +20,12 @@ require (
github.com/go-git/go-git/v5 v5.16.2
github.com/google/uuid v1.6.0
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-plugin v1.6.3
github.com/hashicorp/go-plugin v1.7.0
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/hcl/v2 v2.24.0
github.com/jackc/pgconn v1.14.3
github.com/jackc/pgx/v5 v5.7.3
github.com/jedib0t/go-pretty/v6 v6.6.7
github.com/jackc/pgx/v5 v5.7.6
github.com/jedib0t/go-pretty/v6 v6.6.9
github.com/karrick/gows v0.3.0
github.com/mattn/go-isatty v0.0.20
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
@@ -35,12 +35,12 @@ require (
github.com/sethvargo/go-retry v0.3.0
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.6
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.9
github.com/spf13/viper v1.20.1
github.com/thediveo/enumflag/v2 v2.0.7
github.com/turbot/go-kit v1.3.0
github.com/turbot/pipe-fittings/v2 v2.7.0
github.com/turbot/pipe-fittings/v2 v2.7.2
github.com/turbot/steampipe-plugin-sdk/v5 v5.13.0
github.com/turbot/terraform-components v0.0.0-20250114051614-04b806a9cbed
github.com/zclconf/go-cty v1.16.3 // indirect

32
go.sum
View File

@@ -703,8 +703,8 @@ github.com/briandowns/spinner v1.23.2 h1:Zc6ecUnI+YzLmJniCfDNaMbW0Wid1d5+qcTq4L2
github.com/briandowns/spinner v1.23.2/go.mod h1:LaZeM4wm2Ywy6vO571mvhQNRcWfRUnXOs0RcKV0wYKM=
github.com/btubbs/datetime v0.1.1 h1:KuV+F9tyq/hEnezmKZNGk8dzqMVsId6EpFVrQCfA3To=
github.com/btubbs/datetime v0.1.1/go.mod h1:n2BZ/2ltnRzNiz27aE3wUb2onNttQdC+WFxAoks5jJM=
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw=
github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -1004,8 +1004,8 @@ github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB1
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-plugin v1.6.3 h1:xgHB+ZUSYeuJi96WtxEjzi23uh7YQpznjGh0U0UUrwg=
github.com/hashicorp/go-plugin v1.6.3/go.mod h1:MRobyh+Wc/nYy1V4KAXUiYfzxoYhs7V1mlH1Z7iY2h0=
github.com/hashicorp/go-plugin v1.7.0 h1:YghfQH/0QmPNc/AZMTFE3ac8fipZyZECHdDPshfk+mA=
github.com/hashicorp/go-plugin v1.7.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8=
github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
@@ -1047,16 +1047,16 @@ github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUO
github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.3 h1:PO1wNKj/bTAwxSJnO1Z4Ai8j4magtqg2SLNjEDzcXQo=
github.com/jackc/pgx/v5 v5.7.3/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
github.com/jackc/pgx/v5 v5.7.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk=
github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jedib0t/go-pretty/v6 v6.6.7 h1:m+LbHpm0aIAPLzLbMfn8dc3Ht8MW7lsSO4MPItz/Uuo=
github.com/jedib0t/go-pretty/v6 v6.6.7/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU=
github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c=
github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo=
github.com/jedib0t/go-pretty/v6 v6.6.9 h1:PQecJLK3L8ODuVyMe2223b61oRJjrKnmXAncbWTv9MY=
github.com/jedib0t/go-pretty/v6 v6.6.9/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU=
github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94=
github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
@@ -1216,10 +1216,10 @@ github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4=
github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE=
@@ -1258,8 +1258,8 @@ github.com/turbot/go-kit v1.3.0 h1:6cIYPAO5hO9fG7Zd5UBC4Ch3+C6AiiyYS0UQnrUlTV0=
github.com/turbot/go-kit v1.3.0/go.mod h1:piKJMYCF8EYmKf+D2B78Csy7kOHGmnQVOWingtLKWWQ=
github.com/turbot/go-prompt v0.2.6-steampipe.0.0.20221028122246-eb118ec58d50 h1:zs87uA6QZsYLk4RRxDOIxt8ro/B2V6HzoMWm05Lo7ao=
github.com/turbot/go-prompt v0.2.6-steampipe.0.0.20221028122246-eb118ec58d50/go.mod h1:vFnjEGDIIA/Lib7giyE4E9c50Lvl8j0S+7FVlAwDAVw=
github.com/turbot/pipe-fittings/v2 v2.7.0 h1:eCmpMNlVtV3AxOzsn8njE3O6aoHc74WVAHOntia2hqY=
github.com/turbot/pipe-fittings/v2 v2.7.0/go.mod h1:V619+tgfLaqoEXFDNzA2p24TBZVf4IkDL9FDLQecMnE=
github.com/turbot/pipe-fittings/v2 v2.7.2 h1:fwyzK8tlQJK0SNGLxlZORT7pUI6ghkZwM+wIpf+LMW8=
github.com/turbot/pipe-fittings/v2 v2.7.2/go.mod h1:V619+tgfLaqoEXFDNzA2p24TBZVf4IkDL9FDLQecMnE=
github.com/turbot/pipes-sdk-go v0.12.1 h1:mF9Z9Mr6F0uqlWjd1mQn+jqT24GPvWDFDrFTvmkazHc=
github.com/turbot/pipes-sdk-go v0.12.1/go.mod h1:iQE0ebN74yqiCRrfv7izxVMRcNlZftPWWDPsMFwejt4=
github.com/turbot/steampipe-plugin-sdk/v5 v5.13.0 h1:6GSmiKsPdMd2X1ULK17Q/8UQvNOpyub4F2a5nmMGkis=

View File

@@ -27,12 +27,12 @@ const (
// constants for installing db and fdw images
const (
DatabaseVersion = "14.17.0"
DatabaseVersion = "14.19.0"
FdwVersion = "2.1.3"
// PostgresImageRef is the OCI Image ref for the database binaries
PostgresImageRef = "ghcr.io/turbot/steampipe/db:14.17.0"
PostgresImageDigest = "sha256:4d66131a30139b2b912abe17bcd93c6b4e6a89224874960fea0f141ca51168e7"
PostgresImageRef = "ghcr.io/turbot/steampipe/db:14.19.0"
PostgresImageDigest = "sha256:346d096caf87a6886fd404594ac6b72abee0b166236711fdc6c3d347c099e61f"
FdwImageRef = "ghcr.io/turbot/steampipe/fdw:" + FdwVersion
FdwBinaryFileName = "steampipe_postgres_fdw.so"

View File

@@ -332,7 +332,7 @@ func runRestoreUsingList(ctx context.Context, info *RunningDBInstanceInfo, listF
fmt.Sprintf("--username=%s", constants.DatabaseSuperUser),
)
log.Println("[TRACE]", cmd.String())
log.Println("[TRACE] pg_restore command:", cmd.String())
if output, err := cmd.CombinedOutput(); err != nil {
log.Println("[TRACE] runRestoreUsingList process:", string(output))

View File

@@ -27,7 +27,7 @@ import (
var ensureMux sync.Mutex
func noBackupWarning() string {
warningMessage := `Steampipe database has been upgraded from Postgres 14.2 to Postgres 14.17.
warningMessage := `Steampipe database has been upgraded from Postgres 14.17 to Postgres 14.19.
Unfortunately the data in your public schema failed migration using the standard pg_dump and pg_restore tools. Your data has been preserved in the ~/.steampipe/db directory.

View File

@@ -648,11 +648,13 @@ func FindAllSteampipePostgresInstances(ctx context.Context) ([]*psutils.Process,
var instances []*psutils.Process
allProcesses, err := psutils.ProcessesWithContext(ctx)
if err != nil {
log.Println("[TRACE] FindAllSteampipePostgresInstances - error retrieving process list: ", err.Error())
return nil, err
}
for _, p := range allProcesses {
cmdLine, err := p.CmdlineSliceWithContext(ctx)
if err != nil {
log.Printf("[TRACE] FindAllSteampipePostgresInstances - error retrieving cmdline for pid %d: %s", p.Pid, err.Error())
return nil, err
}
if isSteampipePostgresProcess(ctx, cmdLine) {

View File

@@ -9,7 +9,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
steampipe query "select 1" --install-dir $target_install_directory
# check postgres binary is present in correct location
run file $target_install_directory/db/14.17.0/postgres/bin/postgres
run file $target_install_directory/db/14.19.0/postgres/bin/postgres
if [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then
assert_output --partial 'Mach-O 64-bit executable x86_64'
elif [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then
@@ -21,7 +21,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
fi
# check initdb binary is present in the correct location
run file $target_install_directory/db/14.17.0/postgres/bin/initdb
run file $target_install_directory/db/14.19.0/postgres/bin/initdb
if [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then
assert_output --partial 'Mach-O 64-bit executable arm64'
elif [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then
@@ -33,7 +33,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
fi
# check fdw binary(steampipe_postgres_fdw.so) is present in the correct location
run file $target_install_directory/db/14.17.0/postgres/lib/postgresql/steampipe_postgres_fdw.so
run file $target_install_directory/db/14.19.0/postgres/lib/postgresql/steampipe_postgres_fdw.so
if [[ "$arch" == "arm64" && "$os" == "Darwin" ]]; then
assert_output --partial 'Mach-O 64-bit bundle arm64'
elif [[ "$arch" == "x86_64" && "$os" == "Darwin" ]]; then
@@ -45,7 +45,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
fi
# check fdw extension(steampipe_postgres_fdw.control) is present in the correct location
run file $target_install_directory/db/14.17.0/postgres/share/postgresql/extension/steampipe_postgres_fdw.control
run file $target_install_directory/db/14.19.0/postgres/share/postgresql/extension/steampipe_postgres_fdw.control
assert_output --partial 'ASCII text'
}

View File

@@ -75,6 +75,78 @@ load "$LIB_BATS_SUPPORT/load.bash"
rm -f verify*
}
@test "verify data is properly migrated when upgrading from v2.2.0" {
# setup sql statements
setup_sql[0]="create table sample(sample_col_1 char(10), sample_col_2 char(10))"
setup_sql[1]="insert into sample(sample_col_1,sample_col_2) values ('foo','bar')"
setup_sql[2]="insert into sample(sample_col_1,sample_col_2) values ('foo1','bar1')"
setup_sql[3]="create function sample_func() returns integer as 'select 1 as result;' language sql;"
# verify sql statements
verify_sql[0]="select * from sample"
verify_sql[1]="select * from sample_func()"
# create a temp directory to install steampipe(2.2.0)
tmpdir="$(mktemp -d)"
mkdir -p "${tmpdir}"
tmpdir="${tmpdir%/}"
# find the name of the zip file as per OS and arch
case $(uname -sm) in
"Darwin x86_64") target="darwin_amd64.zip" ;;
"Darwin arm64") target="darwin_arm64.zip" ;;
"Linux x86_64") target="linux_amd64.tar.gz" ;;
"Linux aarch64") target="linux_arm64.tar.gz" ;;
*) echo "Error: '$(uname -sm)' is not supported yet." 1>&2;exit 1 ;;
esac
# download the zip and extract
steampipe_uri="https://github.com/turbot/steampipe/releases/download/v2.2.0/steampipe_${target}"
case $(uname -s) in
"Darwin") zip_location="${tmpdir}/steampipe.zip" ;;
"Linux") zip_location="${tmpdir}/steampipe.tar.gz" ;;
*) echo "Error: steampipe is not supported on '$(uname -s)' yet." 1>&2;exit 1 ;;
esac
curl --fail --location --progress-bar --output "$zip_location" "$steampipe_uri"
tar -xf "$zip_location" -C "$tmpdir"
# start the service
$tmpdir/steampipe --install-dir $tmpdir service start
# execute the setup sql statements
for ((i = 0; i < ${#setup_sql[@]}; i++)); do
$tmpdir/steampipe --install-dir $tmpdir query "${setup_sql[$i]}"
done
# store the result of the verification statements(1.0.3)
for ((i = 0; i < ${#verify_sql[@]}; i++)); do
$tmpdir/steampipe --install-dir $tmpdir query "${verify_sql[$i]}" > verify$i.txt
done
# stop the service
$tmpdir/steampipe --install-dir $tmpdir service stop
# Now run this version - which should migrate the data
steampipe --install-dir $tmpdir service start
# store the result of the verification statements(0.14.*)
for ((i = 0; i < ${#verify_sql[@]}; i++)); do
echo "VerifySQL: ${verify_sql[$i]}"
steampipe --install-dir $tmpdir query "${verify_sql[$i]}" > verify$i$i.txt
done
# stop the service
steampipe --install-dir $tmpdir service stop
# verify data is migrated correctly
for ((i = 0; i < ${#verify_sql[@]}; i++)); do
assert_equal "$(cat verify$i.txt)" "$(cat verify$i$i.txt)"
done
rm -rf $tmpdir
rm -f verify*
}
function teardown_file() {
# list running processes
ps -ef | grep steampipe

View File

@@ -5,7 +5,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
current_year=$(date +"%Y")
steampipe service start
run openssl x509 -enddate -noout -in $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/root.crt
run openssl x509 -enddate -noout -in $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/root.crt
echo $output
# check enddate
assert_output --partial "notAfter=Dec 31 23:59:59 9999 GMT"
@@ -13,7 +13,7 @@ load "$LIB_BATS_SUPPORT/load.bash"
server_expiry=$((current_year + 3))
echo $server_expiry
run openssl x509 -enddate -noout -in $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
run openssl x509 -enddate -noout -in $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/server.crt
echo $output
# check enddate
assert_output --partial "$server_expiry"
@@ -23,25 +23,25 @@ load "$LIB_BATS_SUPPORT/load.bash"
steampipe service start
# save file hash
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/root.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/root.crt
id_root=$(echo $output | awk '{print $1}')
echo $id_root
# save file hash
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/server.crt
id_server=$(echo $output | awk '{print $1}')
echo $id_server
steampipe service restart
# check file hash after restart
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/root.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/root.crt
id_root_new=$(echo $output | awk '{print $1}')
echo $id_root_new
assert_equal $id_root $id_root_new
# check file hash after restart
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/server.crt
id_server_new=$(echo $output | awk '{print $1}')
echo $id_server_new
@@ -52,17 +52,17 @@ load "$LIB_BATS_SUPPORT/load.bash"
@test "deleting root certificate, service start should regenerate server and root certs" {
# save file hash
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/server.crt
id_server=$(echo $output | awk '{print $1}')
echo $id_server
# delete root certificate
rm -f $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/root.crt
rm -f $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/root.crt
steampipe service start
# save new file hash
run cksum $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt
run cksum $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/server.crt
id_server_new=$(echo $output | awk '{print $1}')
echo $id_server_new
@@ -78,9 +78,9 @@ load "$LIB_BATS_SUPPORT/load.bash"
@test "adding an encrypted private key should work fine and service should start successfully" {
skip "TODO update test and enable later"
run openssl genrsa -aes256 -out $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.key -passout pass:steampipe -traditional 2048
run openssl genrsa -aes256 -out $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/server.key -passout pass:steampipe -traditional 2048
run openssl req -key $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.key -passin pass:steampipe -new -x509 -out $STEAMPIPE_INSTALL_DIR/db/14.17.0/data/server.crt -subj "/CN=steampipe.io"
run openssl req -key $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/server.key -passin pass:steampipe -new -x509 -out $STEAMPIPE_INSTALL_DIR/db/14.19.0/data/server.crt -subj "/CN=steampipe.io"
steampipe service start --database-password steampipe
}