#1432  Repositories sync build problem
Closed
Artur opened 10 months ago

I created a mirror in 1dev of a public repository on github. My intention was to keep this mirror in sync on daily basis to always have the most recent version of the repository.

For this, I used predefined step: Reposiotry Sync / Pull from Remote. The github repository is public and I tried to pull from it using my github token or without a token since it is public. However, the sync always fails with the error:

Step "pullrfomgithub" is failed: (0 seconds) Failed to run command: git fetch https://github.com/iv-org/invidious.git refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*, return code: 1
From https://github.com/iv-org/invidious
 ! [rejected]          master     -> master  (non-fast-forward)

My build code:

version: 21
jobs:
- name: Pull from GitHub
  steps:
  - !PullRepository
    name: pullrfomgithub
    remoteUrl: https://github.com/iv-org/invidious.git
    syncToChildProject: false
    refs: refs/heads/* refs/tags/*
    withLfs: false
    force: false
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  triggers:
  - !ScheduleTrigger
    cronExpression: 0 15 10 ? * *
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  timeout: 3600
Robin Shen commented 10 months ago

This happens as you've made changes in master branch of your local repo, and it diverges with master branch at GitHub. There are two approaches solving this issue:

  1. Push your master branch to GitHub with OneDev build spec
  2. Write mirror logic in a separate project to sync child projects, and move your current project as a child project as that project
Artur commented 10 months ago

En, you are right, I totally forgot that adding a build is modifying the repo. I cannot change the repo in github because it is not mine. I just want to mirror an open source repo. The second option seems like the right solution. I will try that and will report back with results.

Artur commented 10 months ago

It working! Thank you.

Artur changed state to 'Closed' 10 months ago
Previous Value Current Value
Open
Closed
Artur changed state to 'Open' 9 months ago
Previous Value Current Value
Closed
Open
Artur commented 9 months ago

This worked for a while until it stopped working. All repo sync builds fail now. Here is the output.

Could you please suggest a solution?

15:57:59 No job executor defined, auto-discovering...
15:57:59 Discovered job executor type: Server Docker Executor
15:57:59 Pending resource allocation...
15:57:59 Executing job (executor: auto-discovered, server: 127.0.0.1:5710, network: auto-discovered-39-32-0)...
15:57:59 Setting up job cache...
15:58:01 Copying job dependencies...
15:58:01 Running step "sync invidious"...
15:58:02 Step "sync invidious" is failed: (0 seconds) Failed to run command: git fetch https://*****@github.com/iv-org/invidious.git refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*, return code: 1
From https://github.com/iv-org/invidious
 ! [rejected]          limit-feeds-materialized-views -> limit-feeds-materialized-views  (non-fast-forward)
Robin Shen commented 9 months ago

This happens as the repository you are syncing has been modified locally. In this case, you will need to merge and push the change to remote first, and then next sync will be fine.

Artur commented 9 months ago

The thing is that it has not been modified locally. It was only being modified by the repo sync job/build.

I even cloned the repo to my computer and tried to manually sync with the repo on github and git said, there is nothing to sync, all files are up to date.

Or maybe I was checking this wrong and missed something?

Robin Shen commented 9 months ago

According to error message, branch limit-feeds-materialized-views on local repo can not be fast forwarded to remote side. Please check if this is the case.

Artur commented 9 months ago

Hm, indeed. I do not know how this happened. I do not work or edit this repo, just mirror it from the github.

Anyway, I deleted the branch from my copy of the repo on 1dev and the builds now runs correctly.

Artur changed state to 'Closed' 9 months ago
Previous Value Current Value
Open
Closed
Artur commented 9 months ago

Thank you for your help.

issue 1 of 1
Type
Question
Priority
Normal
Assignee
Not assigned
Issue Votes (0)
Watchers (4)
Reference
onedev/server#1432
Please wait...
Page is in error, reload to recover