Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion .github/workflows/01-steampipe-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ jobs:
with:
repository: turbot/homebrew-tap
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: ${{ github.event.inputs.version }}

- name: Update live version
if: steps.semver_parser.outputs.prerelease == ''
Expand Down Expand Up @@ -263,3 +262,60 @@ jobs:
git fetch --all
gh pr merge $VERSION --squash --delete-branch
git push origin --delete bump-brew

trigger_smoke_tests:
name: Trigger Smoke Tests
if: ${{ github.event.inputs.environment == 'Final (RC and final release)' }}
needs: update_homebrew_tap
runs-on: ubuntu-latest
steps:
- name: Calculate version
id: calculate_version
run: |
echo "VERSION=v${{ github.event.inputs.version }}" >> $GITHUB_ENV

- name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@7784200024d6b3fc01253e617ec0168daf603de3 # v1.4.7
with:
input_string: ${{ github.event.inputs.version }}

- name: Trigger smoke test workflow
if: steps.semver_parser.outputs.prerelease == ''
run: |
gh workflow run "12-test-post-release-linux-distros.yaml" \
--ref ${{ github.ref }} \
--field version=$VERSION \
--repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Get smoke test workflow run URL
if: steps.semver_parser.outputs.prerelease == ''
run: |
echo "Waiting for smoke test workflow to start..."
sleep 10

# Get the most recent run of the smoke test workflow
RUN_ID=$(gh run list \
--workflow="12-test-post-release-linux-distros.yaml" \
--repo ${{ github.repository }} \
--limit 1 \
--json databaseId \
--jq '.[0].databaseId')

if [ -n "$RUN_ID" ]; then
WORKFLOW_URL="https://github.com/${{ github.repository }}/actions/runs/$RUN_ID"
echo "✅ Smoke test workflow triggered successfully!"
echo "🔗 Monitor progress at: $WORKFLOW_URL"
echo ""
echo "Workflow details:"
echo " - Version: $VERSION"
echo " - Workflow: 12-test-post-release-linux-distros.yaml"
echo " - Run ID: $RUN_ID"
else
echo "⚠️ Could not retrieve workflow run ID. Check manually at:"
echo "https://github.com/${{ github.repository }}/actions/workflows/12-test-post-release-linux-distros.yaml"
fi
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
9 changes: 9 additions & 0 deletions .github/workflows/02-steampipe-db-image-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
- name: Push to Registry
run: |-
REF="$CORE_REPO/$IMAGE_NAME:$VERSION"
LATEST_REF="$CORE_REPO/$IMAGE_NAME:latest"

oras push $REF \
--config config.json:application/vnd.turbot.steampipe.config.v1+json \
Expand All @@ -158,3 +159,11 @@ jobs:
extracted-darwin-arm64:application/vnd.turbot.steampipe.db.darwin-arm64.layer.v1+tar \
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
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"
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "02 - Steampipe: Smoke Tests"
name: "12 - Test: Linux Distros (Post-release)"

on:
workflow_dispatch:
Expand All @@ -13,6 +13,8 @@ env:
VERSION: ${{ github.event.inputs.version }}
# Disable update checks during smoke tests
STEAMPIPE_UPDATE_CHECK: false
# Slack webhook URL for notifications
SLACK_WEBHOOK_URL: ${{ secrets.PIPELING_RELEASE_BOT_WEBHOOK_URL }}

jobs:
smoke_test_ubuntu_24:
Expand Down Expand Up @@ -153,40 +155,81 @@ jobs:
docker stop amazonlinux-2023-test
docker rm amazonlinux-2023-test

smoke_test_darwin_arm64:
name: Smoke test (macOS 14, ARM64)
runs-on: macos-latest
smoke_test_linux_arm64:
name: Smoke test (Ubuntu 24, ARM64)
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Download Darwin Release Artifact
- name: Download Linux Release Artifact
run: |
mkdir -p ./artifacts
gh release download ${{ env.VERSION }} \
--pattern "*darwin_arm64.zip" \
--pattern "*linux_arm64.tar.gz" \
--dir ./artifacts \
--repo ${{ github.repository }}
# Rename to expected format
mv ./artifacts/*darwin_arm64.zip ./artifacts/darwin.zip
mv ./artifacts/*linux_arm64.tar.gz ./artifacts/linux.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Darwin Artifacts and Install Binary
- name: Extract Linux Artifacts and Install Binary
run: |
sudo unzip ./artifacts/darwin.zip -d /usr/local/bin
sudo tar -xzf ./artifacts/linux.tar.gz -C /usr/local/bin
sudo chmod +x /usr/local/bin/steampipe

- name: Install jq
run: |
brew install jq
sudo apt-get update
sudo apt-get install -y jq

- name: Create steampipe user and setup environment
run: |
sudo useradd -m steampipe
sudo mkdir -p /home/steampipe/.steampipe/logs
sudo chown -R steampipe:steampipe /home/steampipe

- name: Get runner/container info
run: |
uname -a
sw_vers
cat /etc/os-release

- name: Run smoke tests
run: |
chmod +x $GITHUB_WORKSPACE/scripts/smoke_test.sh
$GITHUB_WORKSPACE/scripts/smoke_test.sh
sudo cp $GITHUB_WORKSPACE/scripts/smoke_test.sh /home/steampipe/smoke_test.sh
sudo chown steampipe:steampipe /home/steampipe/smoke_test.sh
sudo -u steampipe /home/steampipe/smoke_test.sh

notify_completion:
name: Notify completion
runs-on: ubuntu-latest
needs:
[
smoke_test_ubuntu_24,
smoke_test_centos_9,
smoke_test_amazonlinux,
smoke_test_linux_arm64,
]
if: always()
steps:
- name: Check results and notify
run: |
# Check if all jobs succeeded
UBUNTU_24_RESULT="${{ needs.smoke_test_ubuntu_24.result }}"
CENTOS_9_RESULT="${{ needs.smoke_test_centos_9.result }}"
AMAZONLINUX_RESULT="${{ needs.smoke_test_amazonlinux.result }}"
ARM64_RESULT="${{ needs.smoke_test_linux_arm64.result }}"

WORKFLOW_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

if [ "$UBUNTU_24_RESULT" = "success" ] && [ "$CENTOS_9_RESULT" = "success" ] && [ "$AMAZONLINUX_RESULT" = "success" ] && [ "$ARM64_RESULT" = "success" ]; then
MESSAGE="✅ Steampipe ${{ env.VERSION }} smoke tests passed!\n\n🔗 View details: $WORKFLOW_URL"
else
MESSAGE="❌ Steampipe ${{ env.VERSION }} smoke tests failed!\n\n🔗 View details: $WORKFLOW_URL"
fi

curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"$MESSAGE\"}" \
${{ env.SLACK_WEBHOOK_URL }}
16 changes: 5 additions & 11 deletions pkg/cmdconfig/cmd_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"strings"
"time"

pfilepaths "github.com/turbot/pipe-fittings/v2/filepaths"

"github.com/fatih/color"
"github.com/hashicorp/go-hclog"
"github.com/mattn/go-isatty"
Expand All @@ -24,6 +22,7 @@ import (
"github.com/turbot/pipe-fittings/v2/app_specific"
pconstants "github.com/turbot/pipe-fittings/v2/constants"
perror_helpers "github.com/turbot/pipe-fittings/v2/error_helpers"
pfilepaths "github.com/turbot/pipe-fittings/v2/filepaths"
"github.com/turbot/pipe-fittings/v2/parse"
"github.com/turbot/pipe-fittings/v2/pipes"
"github.com/turbot/pipe-fittings/v2/utils"
Expand Down Expand Up @@ -243,6 +242,9 @@ func initGlobalConfig() perror_helpers.ErrorAndWarnings {
SetDefaultsFromConfig(loader.ConfiguredProfile.ConfigMap(cmd))
}

// now env vars have been processed, set PipesInstallDir
pfilepaths.PipesInstallDir = viper.GetString(pconstants.ArgPipesInstallDir)

// NOTE: we need to resolve the token separately
// - that is because we need the resolved value of ArgPipesHost in order to load any saved token
// and we cannot get this until the other config has been resolved
Expand Down Expand Up @@ -392,7 +394,6 @@ func createLogger(logBuffer *bytes.Buffer, cmd *cobra.Command) {
}

func ensureInstallDir() {
pipesInstallDir := viper.GetString(pconstants.ArgPipesInstallDir)
installDir := viper.GetString(pconstants.ArgInstallDir)

log.Printf("[TRACE] ensureInstallDir %s", installDir)
Expand All @@ -402,15 +403,8 @@ func ensureInstallDir() {
error_helpers.FailOnErrorWithMessage(err, fmt.Sprintf("could not create installation directory: %s", installDir))
}

if _, err := os.Stat(pipesInstallDir); os.IsNotExist(err) {
log.Printf("[TRACE] creating install dir")
err = os.MkdirAll(pipesInstallDir, 0755)
error_helpers.FailOnErrorWithMessage(err, fmt.Sprintf("could not create pipes installation directory: %s", pipesInstallDir))
}

// store as app_specific.InstallDir and PipesInstallDir
// store as app_specific.InstallDir
app_specific.InstallDir = installDir
pfilepaths.PipesInstallDir = pipesInstallDir
}

// displayDeprecationWarnings shows the deprecated warnings in a formatted way
Expand Down
1 change: 1 addition & 0 deletions pkg/cmdconfig/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func setDefaultsFromEnv() {
constants.EnvUpdateCheck: {[]string{pconstants.ArgUpdateCheck}, Bool},
constants.EnvPipesHost: {[]string{pconstants.ArgPipesHost}, String},
constants.EnvPipesToken: {[]string{pconstants.ArgPipesToken}, String},
constants.EnvPipesInstallDir: {[]string{pconstants.ArgPipesInstallDir}, String},
constants.EnvSnapshotLocation: {[]string{pconstants.ArgSnapshotLocation}, String},
constants.EnvWorkspaceDatabase: {[]string{pconstants.ArgWorkspaceDatabase}, String},
constants.EnvServicePassword: {[]string{pconstants.ArgServicePassword}, String},
Expand Down
5 changes: 3 additions & 2 deletions pkg/constants/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ const (
EnvWorkspaceDatabase = "STEAMPIPE_WORKSPACE_DATABASE"
EnvWorkspaceProfile = "STEAMPIPE_WORKSPACE"

EnvPipesHost = "PIPES_HOST"
EnvPipesToken = "PIPES_TOKEN"
EnvPipesHost = "PIPES_HOST"
EnvPipesToken = "PIPES_TOKEN"
EnvPipesInstallDir = "PIPES_INSTALL_DIR"

EnvDisplayWidth = "STEAMPIPE_DISPLAY_WIDTH"
EnvCacheEnabled = "STEAMPIPE_CACHE"
Expand Down
3 changes: 1 addition & 2 deletions pkg/db/db_local/stop_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/turbot/steampipe/v2/pkg/filepaths"
"github.com/turbot/steampipe/v2/pkg/pluginmanager"
"github.com/turbot/steampipe/v2/pkg/statushooks"
"github.com/turbot/steampipe/v2/pkg/utils"
)

// StopStatus is a pseudoEnum for service stop result
Expand Down Expand Up @@ -304,7 +303,7 @@ func waitForProcessExit(process *psutils.Process, waitFor time.Duration) bool {
for {
select {
case <-checkTimer.C:
pEx, _ := utils.PidExists(int(process.Pid))
pEx, _ := putils.PidExists(int(process.Pid))
if pEx {
continue
}
Expand Down