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

Debug CI #1273

wants to merge 41 commits into from

Conversation

chadwhitacre
Copy link
Member

@chadwhitacre chadwhitacre commented Jan 24, 2022

CI is failing on master. Why?

#1272

@chadwhitacre
Copy link
Member Author

curl: (22) The requested URL returned error: 502 Bad Gateway

https://github.com/getsentry/self-hosted/runs/4929127714?check_suite_focus=true#step:4:1402

@chadwhitacre
Copy link
Member Author

Restarting debug ...

@chadwhitacre
Copy link
Member Author

Actually, does it fail locally? 🤔

@chadwhitacre
Copy link
Member Author

Passes locally.

@chadwhitacre
Copy link
Member Author

curl: (22) The requested URL returned error: 502 Bad Gateway

https://github.com/getsentry/self-hosted/runs/5023770344?check_suite_focus=true#step:4:1378

That sounds like nginx is up but the app server is down. Why does it fail so late though? That's not the first time we hit the server, is it?

@BYK
Copy link
Member

BYK commented Feb 1, 2022

@chadwhitacre here is your error: https://github.com/getsentry/self-hosted/runs/5023770344?check_suite_focus=true#step:5:81

@aminvakil
Copy link
Collaborator

@chadwhitacre here is your error: https://github.com/getsentry/self-hosted/runs/5023770344?check_suite_focus=true#step:5:81

So maybe giving #1267 a little love helps here too?
And why it has started to fail now? What has been changed?

@chadwhitacre
Copy link
Member Author

Hm, maybe something changed in Relay? 🧐

@chadwhitacre
Copy link
Member Author

Trying to repro locally ...

@chadwhitacre
Copy link
Member Author

Based on #1251 (comment) I made an attempt to get our relay invocation to not spit out credentials.json properly, but it did. 🤔

$ curl -L https://github.com/docker/compose/releases/download/1.28.0/run.sh -o docker-compose-1.28.0
$
$
$
$ ./test-relay 
docker-compose version 1.28.0, build d02a7b1
docker-py version: 4.4.1
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1i  8 Dec 2020
Creating sentry-self-hosted_relay_run ... done
{"secret_key":"foo","public_key":"bar","id":"baz"}
$
$
$
$ cat test-relay
#!/usr/bin/env zsh

dc="./docker-compose-1.28.0"
$dc version
$dc run \
    --no-deps \
    --volume "$(pwd)/relay/config.yml:/tmp/config.yml" \
    relay --config /tmp credentials generate --stdout

@BYK
Copy link
Member

BYK commented Feb 1, 2022

@chadwhitacre let's add a cat credentials.json and an ls before that in inspect failure step to see what we generate on CI?

@chadwhitacre
Copy link
Member Author

Ooooh, GitHub sez I won. 😜

Screen Shot 2022-02-01 at 11 54 48 AM

@chadwhitacre
Copy link
Member Author

error: could not parse json config file (file /work/.relay/credentials.json)

My hunch is that the file is malformed rather than missing. We shall see ...

@chadwhitacre
Copy link
Member Author

Hmm ... not seeing the cat? Guess we need that ls after all. :P

https://github.com/getsentry/self-hosted/runs/5024828441?check_suite_focus=true#step:4:520

@BYK
Copy link
Member

BYK commented Feb 1, 2022

You know what, I bet it's because we mount things to /tmp. What if it was something else, like /opt or something?

@@ -20,6 +21,10 @@ if [[ ! -f "$RELAY_CREDENTIALS_JSON" ]]; then
> "$RELAY_CREDENTIALS_JSON"
Copy link
Member

@BYK BYK Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add that -T here right after $dcr? Since the file is there but it is empty, makes me think this is a stdout redirection related issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason 07c025c won't work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because, read the giant comment I left there? 😁

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read it but I couldn't make sense of it.

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.

So no shell redirect means no credentials file created before relay runs means no error parsing JSON?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard for me to recollect the whole memory but let me try:

  1. We do have a config for Relay in place, either one the end-user created or the one we copied from the example file
  2. When you run relay generate credentials even with --overwrite it tries to read both the config and the credentials (this happens only when you have the config in place)
  3. Relay yells at us if it cannot read/parse credentials file and stops
  4. Even when we say "ignore that, overwrite or write the output to stdout" Relay still acts like a fussy toddler

@chadwhitacre
Copy link
Member Author

Hrmm ... the file exists but is seemingly empty. 🤔

https://github.com/getsentry/self-hosted/runs/5024926314?check_suite_focus=true#step:4:617

@BYK
Copy link
Member

BYK commented Feb 1, 2022

Okay so that only works with docker compose not docker-compose

@BYK
Copy link
Member

BYK commented Feb 1, 2022

Okay, I think the only reasonable fix here is to run docker compose pull upfront.

@chadwhitacre
Copy link
Member Author

@BYK
Copy link
Member

BYK commented Feb 1, 2022

Btw, relay generate credentials fails, right?

@chadwhitacre
Copy link
Member Author

Does it? Link?

@BYK
Copy link
Member

BYK commented Feb 1, 2022

Does it? Link?

Dunno, thought you tried that too :D

Btw setting COMPOSE_INTERACTIVE_NO_CLI=1 may help with that output.

@chadwhitacre
Copy link
Member Author

Dunno, thought you tried that too :D

Ah, you mean without --stdout? Yes, I tried that somewhere back there and yes it failed you were right. ;)

@chadwhitacre
Copy link
Member Author

Oh! Locally I already have the image cached.

@chadwhitacre
Copy link
Member Author

Boom! 💥

I removed the relay nightly image and I can repro locally:

relay/credentials.json ------------------
nightly: Pulling from getsentry/relay
Digest: sha256:c126666fd4f9a99388e276686eb5c81dd71a58c114c719b18a2f1d78653fd900
Status: Downloaded newer image for getsentry/relay:nightly
{"secret_key":"f66RDFJ-K-C6jHpsO7mGjuKXc_zXypdynQedNYzNmlU","public_key":"gyuqZ-p-TxVMj6xt0_aNDd8k8LBWsOmnR1RfISUH93I","id":"05775dda-6d9a-42ef-8ac8-c914ea9a3f33"}
=========================================
Creating sentry-self-hosted_relay_run ... done
error: could not parse json config file (file /work/.relay/credentials.json)
  caused by: expected ident at line 1 column 2
ERROR: 1
$

💃

@chadwhitacre
Copy link
Member Author

yes it failed you were right

But! We can work around the "redirect creates the empty file which confuses relay" issue by redirecting to a tmp file and moving that into place. So we're good there. 👍

Last thing I want to check is Docker Compose 2 behavior ...

@chadwhitacre
Copy link
Member Author

Alright I'm outta time. I think with some fresh eyes tomorrow it shouldn't take too long to get a PR together.

Thanks for your help @BYK! 😁 💃 🌮 👏

@chadwhitacre
Copy link
Member Author

Oh wow do the different CI runs use the same docker cache? 🤔

@chadwhitacre
Copy link
Member Author

Because I'm surprised that 1.28.0 is passing 🤔

@chadwhitacre
Copy link
Member Author

Looks like we need the -T for 1 and 2.2.3+. Okay! Gonna scrap this for parts. 💃

@chadwhitacre chadwhitacre deleted the cwlw/debug-ci branch February 1, 2022 23:15
@aminvakil
Copy link
Collaborator

Wow! Glad it was sorted out at last!

@github-actions github-actions bot locked and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants