앱 재빌드 시 Git 오류 발생 - 원격 ref refs/heads/tests-passed를 찾을 수 없음

여러분 안녕하세요,

앱을 다시 빌드할 때 이 오류가 발생하고 있습니다.

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>

아래 명령어를 직접 실행하면:

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

다음과 같은 오류가 나요.

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

제가 무언가를 잘못하고 있는 건가요?

감사합니다!

P.S. 빠뜨리고 말았네요. 첫 번째 체크아웃은 잘 되었고, 앱 재빌드 작업만 그 오류로 실패합니다. 제 쪽에 Git 문제는 없는 것 같아요 (그렇게 바라면서요 :slight_smile: ).

로그에서 위에서 더 많은 문제를 발견했습니다 :frowning:

업데이트 성공. 5초 후 재빌드 중.
앱 빌드 중
x86_64 아키텍처 감지됨.
런처가 최신 상태인지 확인 중
fatal: 원격 ref refs/heads/tests-passed를 찾을 수 없음
fatal: 업스트림 브랜치 'refs/heads/main’이 원격 추적 브랜치로 저장되지 않음
fatal: 업스트림 브랜치 'refs/heads/main’이 원격 추적 브랜치로 저장되지 않음
./launcher: line 794: [: 69d7558c98a3775f62b720a8393e76f2b42bd916: unary operator expected
./launcher: line 797: [: 69d7558c98a3775f62b720a8393e76f2b42bd916: unary operator expected

docker run -it --entrypoint /bin/bash … 명령으로 컨테이너를 실행한 후
git을 사용하려고 하면 다음 오류가 발생합니다.

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

로그 전체 출력을 게시하고, 미리 형식이 지정된 텍스트 코드 블록을 사용해 줄 수 있나요? 그러면 도움이 될 것입니다.

기업 네트워크에서 아웃바운드 웹 트래픽에 MITM 검사 프록시를 사용하고 계신 것 같습니다.

그렇다면 서버(및 도커 이미지)를 설정하여 엔터프라이즈 CA 루트를 신뢰하도록 해야 합니다.

정말 그런 경우입니다.
discourse docker에서(서버가 아니라 docker 이미지를 의미합니다) 이를 수행하기 위한 표준 기능이 제공되는지, 아니면 수동으로 처리해야 하는지 궁금합니다.

미리 감사드리며, 인사드립니다.

WS

업데이트: 아니요, 제가 잘못 알고 있었습니다. 실제로 회사 환경에서 이를 수행하고 있으며, 인스턴스는 ec2 인스턴스(Standard Amazon Linux 2 AMI)에 있습니다. 이 인스턴스는 프록시를 통해 외부로 나갈 수 있습니다 …
그리고 말씀드렸듯이, 첫 번째 체크아웃은 성공했고, 재빌드만 실패합니다.

다시 확인해 보니 호스트에서는 동작하지만 컨테이너에서는 작동하지 않습니다 :frowning:

Lilly님, 시간이 좀 걸렸네요. 죄송합니다. 여기 로그(아마도 관련 있는 부분)를 올립니다.

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.

미안해요, 프록시 문제였어요. 컨테이너에 주입되도록 ~/.docker/config.json에서 프록시를 설정해야 했는데, 그렇게 하니까 작동했어요……

아, 프록시 문제로 인생의 얼마나 많은 시간을 낭비했지?? :stuck_out_tongue: