woodpecker-ci / woodpecker

Woodpecker is a simple yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
3.95k stars 351 forks source link

gitea remote url disappears - fatal: no path specified #1169

Closed sb-child closed 1 year ago

sb-child commented 1 year ago

Component

agent

Describe the bug

i am using woodpecker:next docker image and configured for my gitea instance:

# docker-compose.yml 
version: '3'
networks:
  put_net:
    driver: bridge
    ipam:
      driver: default
      config:
        - 
          subnet: 172.18.0.0/24
          gateway: 172.18.0.1

services:
  woodpecker-server:
    image: woodpeckerci/woodpecker-server:next
    networks:
      put_net:
        ipv4_address: 172.18.0.2
    extra_hosts:
      - "n3s1.sbc-io.xyz:10.7.1.4"
    ports:
      - 8999:8000
    expose:
      - "9000"
    volumes:
      - woodpecker-server-data:/mnt/m1/wpdata
    environment:
      - WOODPECKER_OPEN=true
      - WOODPECKER_HOST=https://woodpecker.example:3944
      - WOODPECKER_GITEA=true
      - WOODPECKER_GITEA_URL=https://gitea.example:3943/
      - WOODPECKER_GITEA_CLIENT=0c7d543a-b70a-461c-bb06-ef32c912789c
      - WOODPECKER_GITEA_SECRET=gto_secret
      - WOODPECKER_AGENT_SECRET=secretexample
      - WOODPECKER_DATABASE_DRIVER=postgres
      - WOODPECKER_DATABASE_DATASOURCE=postgres://woodpecker_u:passwd@172.17.0.1:5432/woodpecker_db?sslmode=disable
      - WOODPECKER_AUTHENTICATE_PUBLIC_REPOS=true
      - WOODPECKER_DEFAULT_CLONE_IMAGE=woodpeckerci/plugin-git:next
      - WOODPECKER_ADMIN=WoodpeckerBot

  woodpecker-agent:
    image: woodpeckerci/woodpecker-agent:next
    networks:
      put_net:
        ipv4_address: 172.18.0.3
    extra_hosts:
      - "gitea.example:10.7.1.4"
    command: agent
    restart: always
    depends_on:
      - woodpecker-server
    links:
      - woodpecker-server
    tmpfs:
      - /tmp
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WOODPECKER_SERVER=woodpecker-server:9000
      - WOODPECKER_AGENT_SECRET=secretexample

volumes:
  woodpecker-server-data:

now there is a private repo in the list: 图片

but Pipelines are failing:

+ git init -b main
Initialized empty Git repository in /woodpecker/src/gitea.example/main-mirrors-private/proj/.git/
+ git remote add origin 
+ git fetch --no-tags origin +refs/heads/main:
fatal: no path specified; see 'git help pull' for valid url syntax
exit status 128

i found that remote url is gone: + git remote add origin *[remote url]* on line 3 above

after execute Repair repository on settings, I can restart this pipeline without issues:

+ git init -b main
Initialized empty Git repository in /woodpecker/src/gitea.example/main-mirrors-private/proj/.git/
+ git remote add origin https://gitea.example:3943/main-mirrors-private/proj.git
+ git fetch --no-tags origin +refs/heads/main:
From https://gitea.example:3943/main-mirrors-private/proj
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
+ git reset --hard -q 7905a6e4214a2969b5106a19806e6c56442675e9
+ git submodule update --init --recursive

but after I push a new commit to trigger CI, the new pipeline failed:

+ git init -b main
Initialized empty Git repository in /woodpecker/src/gitea.example/main-mirrors-private/proj/.git/
+ git remote add origin 
+ git fetch --no-tags origin +refs/heads/main:
fatal: no path specified; see 'git help pull' for valid url syntax
exit status 128

logs:

wp-conf-woodpecker-agent-1   | {"level":"error","error":"io: read/write on closed pipe","time":"2022-09-07T02:47:06Z","message":"copy limited logStream part"}
wp-conf-woodpecker-agent-1   | {"level":"error","error":"rpc error: code = Unknown desc = Proc finished with exitcode 128, ","time":"2022-09-07T02:47:07Z","message":"grpc error: wait(): code: Unknown: rpc error: code = Unknown desc = Proc finished with exitcode 128, "}
wp-conf-woodpecker-agent-1   | {"level":"warn","repo":"main-mirrors-private/repo","build":"21","id":"61","error":"rpc error: code = Unknown desc = Proc finished with exitcode 128, ","time":"2022-09-07T02:47:07Z","message":"cancel signal received"}

System Info

https://woodpecker.example:3944/version
{
  "source":"https://github.com/woodpecker-ci/woodpecker",
  "version":"next-05d660f2"
}

Docker Compose version v2.6.0

Additional context

logs:

wp-conf-woodpecker-agent-1   | {"level":"error","error":"io: read/write on closed pipe","time":"2022-09-07T02:47:06Z","message":"copy limited logStream part"}
wp-conf-woodpecker-agent-1   | {"level":"error","error":"rpc error: code = Unknown desc = Proc finished with exitcode 128, ","time":"2022-09-07T02:47:07Z","message":"grpc error: wait(): code: Unknown: rpc error: code = Unknown desc = Proc finished with exitcode 128, "}
wp-conf-woodpecker-agent-1   | {"level":"warn","repo":"main-mirrors-private/repo","build":"21","id":"61","error":"rpc error: code = Unknown desc = Proc finished with exitcode 128, ","time":"2022-09-07T02:47:07Z","message":"cancel signal received"}

Validations

qwerty287 commented 1 year ago

So that looks like an issue of #1078 😬

qwerty287 commented 1 year ago

@sb-child

Could you try something: does it still work if you use the "reload repos" button on the repos overview?

And, if you have another repo which doesn't work but you didn't click on "repair" yet (means it still fails), can you look up what's in the DB? Especially the clone URL column would be interesting. Thanks!

sb-child commented 1 year ago

after reloading, I restarted a failed pipeline and passed:

+ git init -b main
Initialized empty Git repository in /woodpecker/src/gitea.example/main-mirrors-private/proj/.git/
+ git remote add origin https://gitea.example:3943/main-mirrors-private/proj.git
+ git fetch --no-tags origin +refs/heads/main:
From https://gitea.example:3943/main-mirrors-private/proj
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
+ git reset --hard -q 826e4925c8122356dcf0a3481d98034a83d80db8
+ git submodule update --init --recursive

but CI seems not running after pushing a new commit. I am trying triggering CI manually by execute the webhook, but also failed with the same reason. 图片 then I used the Repair repository then CI trigger is worked now. but... failed again:

+ git init -b main
Initialized empty Git repository in /woodpecker/src/gitea.example/main-mirrors-private/proj/.git/
+ git remote add origin 
+ git fetch --no-tags origin +refs/heads/main:
fatal: no path specified; see 'git help pull' for valid url syntax
exit status 128

I will try finding something in DB, thanks!

sb-child commented 1 year ago

I found these rows in DB:

select * from public.builds where build_id=28;
build_id build_repo_id build_number build_author build_config_id build_parent build_event build_status build_error build_enqueued build_created updated build_started build_finished build_deploy build_commit build_branch build_ref build_refspec build_remote build_title build_message build_timestamp build_sender build_avatar build_email build_link build_signed build_verified build_reviewer build_reviewed changed_files
28 26 1 sbchild 0 0 push failure 1662533812 1662533812 1662533814 1662533812 1662533814 0427dfdeddcae3f7ab56f3f0a96a3640b989807e main refs/heads/main 更新 '.woodpecker.yml' 1662533812 sbchild https://gitea.example:3943/avatars/cb6cf0988fec32b918503a55e817c687 sbchild@noreply.gitea.example https://gitea.example:3943/sbchild/ci_test/commit/0427dfdeddcae3f7ab56f3f0a96a3640b989807e f t 0 [".woodpecker.yml"]

(1 row)

select * from public.repos where repo_id=26;
repo_id repo_user_id repo_owner repo_name repo_full_name repo_avatar repo_link repo_clone repo_branch repo_scm repo_timeout repo_visibility repo_private repo_trusted repo_gated repo_active repo_allow_pr repo_config_path repo_hash remote_id cancel_previous_pipeline_events
26 2 sbchild ci_test sbchild/ci_test https://gitea.example:3943/sbchild/ci_test 60 public f f f t f F43TAE2NQXDLSJ2J3GVVVQA7GHM4JKOJ23D7HKAM5NJHRLP3GBUA==== 39 ["","","push","pull_request"]

(1 row)

that is a fresh repo with a simple .woodpecker.yml file, but it fails:

+ git init -b main
Initialized empty Git repository in /woodpecker/src/gitea.example/sbchild/ci_test/.git/
+ git remote add origin 
+ git fetch --no-tags origin +refs/heads/main:
fatal: no path specified; see 'git help pull' for valid url syntax
exit status 128

should I provide more information? Please let me know, thanks!

qwerty287 commented 1 year ago

Thanks. The issue is that repo_clone is empty while it should contain the clone URL. When I get the time to fix it I'll look into it.

sb-child commented 1 year ago

@qwerty287 I think I am found out how to resolve this issue can you review #1170 ? Thanks!

Phoenix02-20 commented 3 months ago

hi were you able to find any solution I am still stuck and this and it is not getting solved in any way