Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#20126 closed task (fixed)

Migrate GitHub mirroring script to josm.openstreetmap.de server

Reported by: simon04 Owned by: team
Priority: blocker Milestone: 21.02
Component: Git mirror Version:
Keywords: git, github, mirror Cc:

Description (last modified by simon04)

The script has been running on my PC at since 2015-04-07. I wouldn't have expected it to be still relevant and in production 5.5 years later.

The mirroring process is mission critical now, #19937.

I don't want to run and maintain this mirroring script any more. It does not belong to a private PC of a contributor. I'm happy to share a tarball of everything I have.

Attachments (0)

Change History (32)

comment:1 by simon04, 4 years ago

Description: modified (diff)

comment:2 by Don-vip, 4 years ago

Milestone: 20.12

comment:3 by Don-vip, 4 years ago

@Simon can you please share the tarball with Dirk and I? I have no idea what the mirroring script consists of.

comment:4 by simon04, 4 years ago

I've sent you both an email.

comment:5 by Stereo, 4 years ago

I could also have a look at running it as a github action if you want?

comment:6 by stoecker, 4 years ago

Milestone: 20.1221.01

comment:7 by Don-vip, 4 years ago

Milestone: 21.0121.02

comment:8 by stoecker, 4 years ago

Milestone: 21.0221.03

Milestone renamed

comment:9 by Stereo, 4 years ago

Milestone: 21.0321.02
Priority: normalblocker

The scripts haven't been running for a week.

Having the code on github is necessary to create macOS releases.

comment:10 by stoecker, 4 years ago

Ah, he wont let me off the hook... Tsss.

comment:11 by Stereo, 4 years ago

Cc: git github mirror removed
Keywords: git github mirror added

comment:12 by Stereo, 4 years ago

@stoecker is it only you who can get this to run on the josm server?

in reply to:  12 comment:13 by stoecker, 4 years ago

Replying to Stereo:

@stoecker is it only you who can get this to run on the josm server?

Also Vincent :-)

comment:14 by stoecker, 4 years ago

I'll see what I can do this week.

comment:16 by Stereo, 4 years ago

@stoecker can I help?

comment:17 by stoecker, 4 years ago

Nah, I had a look yesterday. It's easy. It's only my typical problem: Little motivation after a long day in the office at the computer :-) But I see release is coming... I will get it done (at least I believe so :-).

Last edited 4 years ago by stoecker (previous) (diff)

comment:18 by Stereo, 4 years ago

That's what I'm offering to help with :).

comment:19 by stoecker, 4 years ago

Whah, it only LOOKED easy, it's not. From what I got from Simon I extracted following stuff as a perl script (was bash before, but as it only calls commands it makes no difference), but it does not work. Also it's missing the initial setup.

I'd like to have a working commandchain

  • for the case the local git is established (i.e. the directory exists)
  • for the case nothing is there (i.e. the directory does not exist)

Maybe you can help here? Actually I don't want to fiddle with git details until I know what's wrong here. My issue with git is that the syntax and commands really gets unintuitive as soon as you go a bit deeper in what git really differentiates from SVN. The commands look very similar to what I tried 2 years ago and failed with :-)

#!/usr/bin/perl -w

use strict;

my $home = "/home/josm/auto";

sub mirror
{
  for my $name ("josm", "josm-plugins")
  {
    chdir "$home/josm-mirrors/$name";

    # Commit externals changes, if any
    system("git","config","user.name","JOSM GitHub mirror");
    system("git","config","user.email","mirror\@josm.openstreetmap.de");
    system("git","config","user.password","...");
    #system("git","config","credential.helpe","store");

    # Pull changes from Subversion
    system("git","checkout","master");
    system("git","svn","fetch");
    system("git","svn","rebase");

    # Push the mirror to GitHub
    system("git","remote","add","mirror","git\@github.com-josm:openstreetmap/$name.git");

    # Push to our mirrors
    system("git","push","mirror","master");
  }
}

mirror();
Last edited 4 years ago by Don-vip (previous) (diff)

comment:20 by Stereo, 4 years ago

Where is it failing? And... why are you rewriting it in perl? :)

I'm bootstrapping a svn copy and perl etc. but it might take me a while. Would it please be possible to get access to the server?

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN8OQNxjZtd5aamPItqlEqAjbw7dOfSyXi2eMI5BFFfr stereo@StrangerHereMyself

comment:21 by Stereo, 4 years ago

Ah I see, it's failing because it's not a git repository? It needs to be both a git and a svn repository?

in reply to:  20 comment:22 by stoecker, 4 years ago

Replying to Stereo:

Where is it failing?

Sent you something by mail

And... why are you rewriting it in perl? :)

So that I have only one common infrastructure and not a different method for each task.

comment:23 by Stereo, 4 years ago

Ok, I give up on trying to make git-svn work on macOS. It's a nightmare to get to compile, and then it crashes with messages Google has never seen:

dyld: lazy symbol binding failed: Symbol not found: _svn_ra_make_callbacks
  Referenced from: /usr/local/Cellar/perl/5.32.1_1/lib/perl5/site_perl/5.32.1/darwin-thread-multi-2level/auto/SVN/_Ra/_Ra.bundle
  Expected in: flat namespace

Let's hope debian works better.

Last edited 4 years ago by Stereo (previous) (diff)

comment:25 by Stereo, 4 years ago

Even after re-initialising a repo that way, it doesn't want to push to master:

stereo@debian:~/josm/josm$ git push mirror master
To github.com:grischard/josm.git
 ! [rejected]              master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:grischard/josm.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I'm not sure I understand why, and I'm not sure how to fix it. Running git pull complains about "fatal: refusing to merge unrelated histories".

Indeed, it looks like the commit hash my own mirror has come up with aren't the same hashes github currently has. There must be some kind of state file somewhere.

Last edited 4 years ago by Stereo (previous) (diff)

comment:26 by Stereo, 4 years ago

https://github.com/grischard/josm progress!

The .git/svn/refs/remotes/trunk from simon04 seems to contain the whole state that maps svn commits to git commits.

There's index which is a binary file, and unhandled.log which contains I'm not sure what. I'm also not sure that this is the only state information that's required.

I'd suggest cutting our losses, keeping the thing running as it is for now, and preciously keeping a backup.

comment:27 by stoecker, 4 years ago

Seems to work now.

Still I'd like a method to work without a necessary backup. What if the server fails after a push, then the backup will not have the current state.

Can't the SVN-git files be added to the git repo in the process?

comment:28 by Stereo, 4 years ago

Cool, thank you! And the pre-releases are building at https://github.com/openstreetmap/josm/releases again.

Adding commits on top of a repo is a recipe for a mess - I should know, that's how I maintained the macOS patches for a while :). I could maybe try to come up with a solution to push the metadata to a different repo?

Can you maybe paste your latest version of your script here so I can build from that? Different ticket so we can close this and do a release?

comment:29 by stoecker, 4 years ago

I switched the mirror URL in the repo to the one below and added SSH key to the account, then it worked (password based access didn't work).

sub mirror
{
  for my $name ("josm")
  {
    my $logfile = "/home/josm/trac/log/git_$name.log";
    chdir "/home/josm/josm-mirrors/$name";

    # Commit externals changes, if any
    system("git config user.name \"JOSM GitHub mirror\" >$logfile 2>&1");
    system("git config user.email mirror\@josm.openstreetmap.de >>$logfile 2>&1");

    # Pull changes from Subversion
    system("git checkout master >>$logfile 2>&1");
    system("git svn fetch >>$logfile 2>&1");
    system("git svn rebase >>$logfile 2>&1");

    # Push the mirror to GitHub
    #system("git remote add mirror git\@github.com:openstreetmap/$name.git >>$logfile 2>&1");

    # Push to our mirrors
    system("git push mirror master >>$logfile 2>&1");
  }
  chdir $home;
}
Last edited 4 years ago by Stereo (previous) (diff)

comment:30 by Don-vip, 4 years ago

Resolution: fixed
Status: assignedclosed

I guess this is fixed?

comment:31 by Stereo, 4 years ago

Yeah. I'll open a followup ticket for the backup script.

comment:32 by simon04, 4 years ago

Component: TracGit mirror

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.