Git Error when rebuilding app - couldn’t find remote ref refs/heads/tests-passed

Hi guys,

I´m getting this error when I rebuild the app

Pups::ExecError: cd /var/www/discourse && sudo -H -E -u discourse bash -c ’
set -o errexit
if [ $(git rev-parse --is-shallow-repository) == “true” ]; then
git remote set-branches --add origin main
git remote set-branches origin tests-passed
git fetch --depth 1 origin tests-passed
else
git fetch --tags --prune-tags --prune --force origin
fi
’ failed with return #<Process::Status: pid 145 exit 128>

When I execute this:

git fetch --tags --prune-tags --prune --force origin

I get the error

fatal: couldn’t find remote ref refs/heads/tests-passed

Do I make something wrong ?

Thanks and Cheers!

P.S Forgot to mention. First checkout worked, only the rebuild app task fails with that. So no Git problem on my side, I think (hope :slight_smile: )

just noticed more problems above in the logs :frowning:

Updates successful. Rebuilding in 5 seconds.
Building app
x86_64 arch detected.
Ensuring launcher is up to date
fatal: couldn’t find remote ref refs/heads/tests-passed
fatal: upstream branch ‘refs/heads/main’ not stored as a remote-tracking branch
fatal: upstream branch ‘refs/heads/main’ not stored as a remote-tracking branch
./launcher: line 794: [: 69d7558c98a3775f62b720a8393e76f2b42bd916: unary operator expected
./launcher: line 797: [: 69d7558c98a3775f62b720a8393e76f2b42bd916: unary operator expected

When I run a container with docker run -it --entrypoint /bin/bash …
and try to use git, I get this

git clone https://github.com/discourse/discourse.git/
Cloning into 'discourse'...
fatal: unable to access 'https://github.com/discourse/discourse.git/': server certificate verification failed. CAfile: none CRLfile: none

Can you please post the full log output and use a pre-formatted text code block? that would help.

I suspect you’re doing this on a corporate network that uses a MITM-inspecting proxy for outbound web traffic?

If so, you’ll need to configure your server (and the docker image) to trust your Enterprise CA Root.

That´s exactly the case.
Is there a standard functionality available in discourse docker to accomplish that (I mean the docker image, not the server), or do I have to do it manually ?

Many thanks in advance and Greetings,

WS

Update: No, I was wrong. I´m actually doing this in a company context, but the instance is on an ec2 instance (Standard Amazon Linux 2 AMI), which can go out over a proxy …
And, as I said, the first checkout was successful, only the rebuild breaks.

Checked again, it works on host, but not in container :frowning:

Hey @Lilly , sorry took awhile, but here is the log (the relevant part I guess)

I, [2024-11-20T05:57:07.498456 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git reset --hard
Updating files: 100% (34680/34680), done.
I, [2024-11-20T05:57:11.943323 #1]  INFO -- : HEAD is now at 274e18622 FIX: Video uploads sometimes hang indefinitely (#28523)

I, [2024-11-20T05:57:11.943867 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git clean -f
I, [2024-11-20T05:57:12.079705 #1]  INFO -- : 
I, [2024-11-20T05:57:12.080107 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse bash -c '
  set -o errexit
  if [ $(git rev-parse --is-shallow-repository) == "true" ]; then
      git remote set-branches --add origin main
      git remote set-branches origin tests-passed
      git fetch --depth 1 origin tests-passed
  else
      git fetch --tags --prune-tags --prune --force origin
  fi
'
fatal: unable to access 'https://github.com/discourse/discourse.git/': server certificate verification failed. CAfile: none CRLfile: none
I, [2024-11-20T05:57:12.186392 #1]  INFO -- : 
I, [2024-11-20T05:57:12.187130 #1]  INFO -- : Terminating async processes
I, [2024-11-20T05:57:12.187180 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 39
2024-11-20 05:57:12.187 UTC [39] LOG:  received fast shutdown request
I, [2024-11-20T05:57:12.187839 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 107
107:signal-handler (1732082232) Received SIGTERM scheduling shutdown...
2024-11-20 05:57:12.189 UTC [39] LOG:  aborting any active transactions
107:M 20 Nov 2024 05:57:12.193 # User requested shutdown...
107:M 20 Nov 2024 05:57:12.193 * Saving the final RDB snapshot before exiting.
2024-11-20 05:57:12.194 UTC [39] LOG:  background worker "logical replication launcher" (PID 54) exited with exit code 1
2024-11-20 05:57:12.194 UTC [49] LOG:  shutting down
107:M 20 Nov 2024 05:57:12.197 * DB saved on disk
107:M 20 Nov 2024 05:57:12.197 # Redis is now ready to exit, bye bye...
2024-11-20 05:57:12.227 UTC [39] LOG:  database system is shut down


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && sudo -H -E -u discourse bash -c '
  set -o errexit
  if [ $(git rev-parse --is-shallow-repository) == "true" ]; then
      git remote set-branches --add origin main
      git remote set-branches origin tests-passed
      git fetch --depth 1 origin tests-passed
  else
      git fetch --tags --prune-tags --prune --force origin
  fi
' failed with return #<Process::Status: pid 144 exit 128>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"code", "cmd"=>["sudo -H -E -u discourse git reset --hard", "sudo -H -E -u discourse git clean -f", "sudo -H -E -u discourse bash -c '\n  set -o errexit\n  if [ $(git rev-parse --is-shallow-repository) == \"true\" ]; then\n      git remote set-branches --add origin main\n      git remote set-branches origin $version\n      git fetch --depth 1 origin $version\n  else\n      git fetch --tags --prune-tags --prune --force origin\n  fi\n'", "sudo -H -E -u discourse bash -c '\n  set -o errexit\n  if [[ $(git symbolic-ref --short HEAD) == $version ]] ; then\n      git pull\n  else\n      git -c advice.detachedHead=false checkout $version\n  fi\n'", "sudo -H -E -u discourse git config user.discourse-version $version", "mkdir -p tmp", "chown discourse:www-data tmp", "mkdir -p tmp/pids", "mkdir -p tmp/sockets", "touch tmp/.gitkeep", "mkdir -p                    /shared/log/rails", "bash -c \"touch -a           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log\"", "bash -c \"ln    -s           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log $home/log\"", "bash -c \"mkdir -p           /shared/{uploads,backups}\"", "bash -c \"ln    -s           /shared/{uploads,backups} $home/public\"", "bash -c \"mkdir -p           /shared/tmp/{backups,restores}\"", "bash -c \"ln    -s           /shared/tmp/{backups,restores} $home/tmp\"", "chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups /shared/tmp", "[ ! -d public/plugins ] || find public/plugins/ -maxdepth 1 -xtype l -delete"]}
bootstrap failed with exit code 128
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

Sorry guys, it was an proxy issue. Had to configure the proxies in ~/.docker/config.json so they get injected in the container, and it worked …

god, how much lifetime did I waste with proxy issues ?? :stuck_out_tongue:

3 Likes