Changes at TravisCI- affecting open source

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Changes at TravisCI- affecting open source

Post by bernd »

@Przemo:

I saw you posted some link how to synchronise a gitlab repo with a github earlier this month. I can not fine it. All what I found uses shell script wich runs in background and pulls from github and pushes to gitlab. Have you found something different?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Changes at TravisCI- affecting open source

Post by bernd »

https://docs.gitlab.com/ee/user/project ... oring.html this looks better than bash scripts for me ... If it runs on the machine the docker is on we would have a automatic CI again.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Changes at TravisCI- affecting open source

Post by bernd »

I hopefully get it to work on the fork as well ...
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Changes at TravisCI- affecting open source

Post by PrzemoF »

Yes, that's the link. The option isn't available without FreeCAD core devs applying for a premium licence or going self-hosting. I think that a bash script on cron on a server is good enough for now. You already have the script - can you post it? I'll try to set it up on my server when I'm back.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Changes at TravisCI- affecting open source

Post by bernd »

by the use of gitpython ... but I do not know how to push without typing username and password ...

Code: Select all

"""
cd /home/hugo/Documents/dev/freecad/freecadprzemo_ci/freecad
git fetch freecad
git status
git checkout bernd
git rebase freecad/master
git push -f

"""

import os
from git import Repo


# get the repo, raise exception if directory not exist or no git repo exists
the_git_repo_dir = "/home/hugo/Documents/dev/freecad/freecadprzemo_ci/freecad"
if not os.path.isdir(the_git_repo_dir):
    raise Exception("\nERROR, Given directory does not exist: {}\n".format())

try:
    repo = Repo(the_git_repo_dir)
except Exception:
    raise Exception("\nERROR, a git repo does not exist in {}.\n".format(the_git_repo_dir))


# fetch remote "freecad"
for remote in repo.remotes:
    if remote.name == "freecad":
        remote.fetch()


# check if status is clean?!
print(repo.git.status())
if "nothing to commit, working tree clean" not in repo.git.status():
    raise Exception("\nERROR, working dir is not clean.\n")


#all_branches = repo.git.branch("--all").split()
#if "bernd" not in all_branches:
#     raise Exception("\nERROR, branch 'bernd' not found.\n")
   

repo.git.checkout("bernd")
repo.git.rebase("freecad/master")
origin = repo.remote("origin")
origin.push(force=True)


# repo.git.log("-1", "--oneline")


User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Changes at TravisCI- affecting open source

Post by PrzemoF »

Thanks! Ssh key maybe? I never used gitpython
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Changes at TravisCI- affecting open source

Post by bernd »

PrzemoF wrote: Mon Sep 20, 2021 9:01 pm Thanks! Ssh key maybe? I never used gitpython
maybe ... gitpython is great stuff ... I am very bad at shell scripting, thus I use python everywhere.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Changes at TravisCI- affecting open source

Post by bernd »

it runs on my repo as well ...

Screenshot_20210920_231048.png
Screenshot_20210920_231048.png (52.08 KiB) Viewed 2282 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Changes at TravisCI- affecting open source

Post by bernd »

- the basics where merged into main FreeCAD main repo git commit 26dfd72143ed7d

Next Try. mirrowing FreeCAD from github on gitlab:
- on gitlab create a new project
- choose "Run CI/CD for external repository" ("connect your external repository to Gitlab CI/CD")
- use https://github.com/FreeCAD/FreeCAD/ as repository to mirror. Means the repo on github will be sycronised automaticly
- the master branch of the gitlab repo needs to be unprotected
- https://gitlab.com/berndhahnebach/FreeCAD (see last sycronised action right on the top of the page)


screen.png
screen.png (82.09 KiB) Viewed 2159 times


set up CI on the mirrow:
- set the path to CI config file in gitlab CI settings
- deactivate the shared runners
- register the runner from my local machine
- start the runner from my local machine
- commit in CI editor on gitlab
- watch what happens on ... https://gitlab.com/berndhahnebach/FreeCAD/-/jobs

.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Changes at TravisCI- affecting open source

Post by PrzemoF »

Thanks for merging! If we can convince Yourik to complete the setup we could have the CI running on the main repo :)
Post Reply