Skip to content
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

Debug CI #1273

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bc03d78
Constrain tests to failing
chadwhitacre Jan 24, 2022
351dfd9
Log output of failing command
chadwhitacre Feb 1, 2022
42d436f
Blerp, cat here?
chadwhitacre Feb 1, 2022
8617354
What does credentials.json contain?
chadwhitacre Feb 1, 2022
b290637
ls too
chadwhitacre Feb 1, 2022
07c025c
Why can't we do this? 🤔
chadwhitacre Feb 1, 2022
59fc64c
Blah
chadwhitacre Feb 1, 2022
2ead232
Wrong path
chadwhitacre Feb 1, 2022
0221e3e
Whittle down test case
chadwhitacre Feb 1, 2022
dcd1e25
More parity with local
chadwhitacre Feb 1, 2022
f5530e6
Oops, bash
chadwhitacre Feb 1, 2022
32b4119
Moar compat
chadwhitacre Feb 1, 2022
c2db537
This should result in ro volume
chadwhitacre Feb 1, 2022
9c3da83
Bring this back
chadwhitacre Feb 1, 2022
5ba5b5b
Blerp
chadwhitacre Feb 1, 2022
ca64965
Back to hack test file
chadwhitacre Feb 1, 2022
167082f
Where am I?
chadwhitacre Feb 1, 2022
d14d00e
Make reset more useful
chadwhitacre Feb 1, 2022
efcbdf3
Mock ensure file config yml
chadwhitacre Feb 1, 2022
cf08799
Can we use a tmp file?
chadwhitacre Feb 1, 2022
6c2c1a9
Log helper
chadwhitacre Feb 1, 2022
9ff6efb
More logging inside container
chadwhitacre Feb 1, 2022
a65fdb4
moar info in the container
chadwhitacre Feb 1, 2022
fc05c29
more info
chadwhitacre Feb 1, 2022
87f9c6c
no ps i guess
chadwhitacre Feb 1, 2022
4f9c86d
Update test-relay
chadwhitacre Feb 1, 2022
33ce378
Update test-relay
chadwhitacre Feb 1, 2022
1ab391b
newline?
chadwhitacre Feb 1, 2022
5f67f7b
too much stdout?
chadwhitacre Feb 1, 2022
e8283d2
More cleanup
chadwhitacre Feb 1, 2022
dac40f5
Alt fix
chadwhitacre Feb 1, 2022
9adc223
Messed something up?
chadwhitacre Feb 1, 2022
b78d45a
Test a stderr hypothesis
chadwhitacre Feb 1, 2022
d50ba99
Test a couple other versions
chadwhitacre Feb 1, 2022
f6235fc
Hack this tho
chadwhitacre Feb 1, 2022
75a6475
Smash, bash
chadwhitacre Feb 1, 2022
3c1e3f3
Whaaa
chadwhitacre Feb 1, 2022
da25f15
explicit stderr
chadwhitacre Feb 1, 2022
0c6c396
Test image cache across matrix
chadwhitacre Feb 1, 2022
6e8d37d
What was I seeing?
chadwhitacre Feb 1, 2022
24b81bd
Experiment with -T
chadwhitacre Feb 1, 2022
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
27 changes: 7 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ defaults:
run:
shell: bash
jobs:
unit-test:
runs-on: ubuntu-20.04
name: "unit tests"
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Unit Tests
working-directory: install
run: find ./ -type f -name "*-test.sh" -exec "./{}" \;

integration-test:
runs-on: ubuntu-20.04
name: "integration test"
Expand All @@ -34,6 +23,8 @@ jobs:
compose_path: '/usr/local/bin'
- compose_version: 'v2.0.1'
compose_path: '/usr/local/lib/docker/cli-plugins'
- compose_version: 'v2.2.3'
compose_path: '/usr/local/lib/docker/cli-plugins'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -48,16 +39,12 @@ jobs:
sudo curl -L https://github.com/docker/compose/releases/download/${{ matrix.compose_version }}/docker-compose-`uname -s`-`uname -m` -o "${{ matrix.compose_path }}/docker-compose"
sudo chmod +x "${{ matrix.compose_path }}/docker-compose"

- name: Integration Test
- name: Hack Test
run: |
echo "Testing initial install"
./install.sh
./_integration-test/run.sh
echo "Testing in-place upgrade"
# Also test plugin installation here
echo "sentry-auth-oidc" >> sentry/requirements.txt
./install.sh --minimize-downtime
./_integration-test/run.sh
pwd
ls -FGl
ls -FGl relay
./test-relay

- name: Inspect failure
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion _integration-test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ PROJECT_ID=${DSN_PIECES[1]}
TEST_EVENT_ID=$(export LC_ALL=C; head /dev/urandom | tr -dc "a-f0-9" | head -c 32)
# Thanks @untitaker - https://forum.sentry.io/t/how-can-i-post-with-curl-a-sentry-event-which-authentication-credentials/4759/2?u=byk
echo "Creating test event..."
curl -sf --data '{"event_id": "'"$TEST_EVENT_ID"'","level":"error","message":"a failure","extra":{"object":"42"}}' -H 'Content-Type: application/json' -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=$SENTRY_KEY, sentry_client=test-bash/0.1" "$SENTRY_TEST_HOST/api/$PROJECT_ID/store/" -o /dev/null
curl -f --data '{"event_id": "'"$TEST_EVENT_ID"'","level":"error","message":"a failure","extra":{"object":"42"}}' -H 'Content-Type: application/json' -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=$SENTRY_KEY, sentry_client=test-bash/0.1" "$SENTRY_TEST_HOST/api/$PROJECT_ID/store/" -o out && cat out || cat out

EVENT_PATH="projects/sentry/internal/events/$TEST_EVENT_ID/"
export -f sentry_api_request get_csrf_token
Expand Down
5 changes: 5 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ source check-minimum-requirements.sh
# Let's go! Start impacting things.
source turn-things-off.sh
source create-docker-volumes.sh

# Test thing
source relay-credentials.sh
exit

source ensure-files-from-examples.sh
source generate-secret-key.sh
source replace-tsdb.sh
Expand Down
29 changes: 15 additions & 14 deletions install/relay-credentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@ echo "${_group}Generating Relay credentials ..."

RELAY_CONFIG_YML="../relay/config.yml"
RELAY_CREDENTIALS_JSON="../relay/credentials.json"
RELAY_CREDENTIALS_JSON_TMP="/tmp/credentials.json"

ensure_file_from_example $RELAY_CONFIG_YML

if [[ ! -f "$RELAY_CREDENTIALS_JSON" ]]; then
if [[ -f "$RELAY_CREDENTIALS_JSON" ]]; then
echo "$RELAY_CREDENTIALS_JSON already exists, skipped creation."
else

# We need the ugly hack below as `relay generate credentials` tries to read
# the config and the credentials even with the `--stdout` and `--overwrite`
# flags and then errors out when the credentials file exists but not valid
# JSON. We hit this case as we redirect output to the same config folder,
# creating an empty credentials file before relay runs.

$dcr \
--no-deps \
--volume "$(pwd)/$RELAY_CONFIG_YML:/tmp/config.yml" \
relay --config /tmp credentials generate --stdout \
> "$RELAY_CREDENTIALS_JSON"

echo "Relay credentials written to $RELAY_CREDENTIALS_JSON"
ls -FGl ../relay
$dcr --no-deps relay credentials generate
ls -FGl ../relay
cat ../relay/credentials.json
$dcr relay credentials show
if [[ -f "$RELAY_CREDENTIALS_JSON" ]]; then
echo "Relay credentials written to $RELAY_CREDENTIALS_JSON."
else
echo "Failed to write relay credentials to $RELAY_CREDENTIALS_JSON."
exit 2
fi
fi

echo "${_endgroup}"
4 changes: 3 additions & 1 deletion reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ fi

cd "$(dirname $0)"

_group=""
_endgroup=""
source install/dc-detect-version.sh

function confirm () {
Expand Down Expand Up @@ -60,4 +62,4 @@ if [ -n "$version" ]; then
fi

# Install.
./install.sh
#./install.sh
47 changes: 47 additions & 0 deletions test-relay
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

dc_base="$(docker compose version &> /dev/null && echo 'docker compose' || echo 'docker-compose')"
if [[ "$(basename $0)" = "install.sh" ]]; then
dc="$dc_base --ansi never --env-file ${_ENV}"
else
dc="$dc_base --ansi never"
fi
dcr="$dc run --rm"

$dc version

$dc down --rmi local --remove-orphans
docker volume create --name=sentry-clickhouse
docker volume create --name=sentry-data
docker volume create --name=sentry-kafka
docker volume create --name=sentry-postgres
docker volume create --name=sentry-redis
docker volume create --name=sentry-symbolicator
docker volume create --name=sentry-zookeeper

cd relay
cp config.example.yml config.yml
rm credentials.json
cd ..

echo 'list images -----------------------------'
docker image list --all | grep relay
echo 'generate --------------------------------'
creds="$dcr --no-deps relay credentials"
ls -FGl relay
$creds generate --stdout 2> stderr > credentials.json.tmp
echo 'list images again -----------------------'
docker image list --all | grep relay
echo 'stderr ----------------------------------'
cat stderr
echo 'ls relay --------------------------------'
ls -FGl relay
echo 'creds show ------------------------------'
$creds show
echo 'moving ----------------------------------'
mv credentials.json.tmp relay/credentials.json
ls -FGl relay
echo 'relay/credentials.json ------------------'
cat relay/credentials.json
echo '========================================='
$creds show