Skip to content

Instantly share code, notes, and snippets.

@sydrawat01
Created May 5, 2024 06:44
Show Gist options
  • Select an option

  • Save sydrawat01/4765bbc12d4650388357a02bcb023e7f to your computer and use it in GitHub Desktop.

Select an option

Save sydrawat01/4765bbc12d4650388357a02bcb023e7f to your computer and use it in GitHub Desktop.
Download tarball from github releases + smoke test script w/ siege
#!/bin/bash
# Download tarball from github organization releases page
# pre-req: You need to have a GitHub PAT with appropriate permissions on the organization for private repositories
# usage: ./download-latest-tarball.sh <org-name> <repo-name>
# ex: ./download-latest-tarball.sh pwncorp webapp-helm-chart
# download the latest tarball and untar it
VERSION="$(curl --silent -H "Authorization: token <github_pat_token>" \
"https://api.github.com/repos/$1/$2/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/')"
echo "Downloading $1/$2:$VERSION..."
curl -LO -H "Authorization: token <github_pat_token>" https://api.github.com/repos/"$1"/"$2"/tarball/"$VERSION"
mv "$VERSION" "$2".tar.gz
echo "opening up the tarball..."
tar -xzvf "$2".tar.gz
#!/bin/bash
# Smoke test for load-testing healthz endpoint
# pre-req: Siege must be installed [macOS: brew install siege]
# * Remember to use 'http' or 'https', and not 'http(s)'
# * Replace <ip-or-domain.tld> with the actual server IP address or the API domain
# Options
# -c : number of concurrent users
# -d : delay in seconds between each requests
# -r : number of requests to be sent to API endpoint
# -f : file containing the API endpoints to be stress-tested
touch smoke-links.txt
echo "http(s)://<ip-or-domain.tld>/healthz" >> smoke-links.txt
siege -c10 -d0.1 -r5000 -f smoke-links.txt
rm -rf smoke-links.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment