Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for file creation from git repositories. #1419

Open
hjoliver opened this issue Sep 21, 2014 · 9 comments
Open

Support for file creation from git repositories. #1419

hjoliver opened this issue Sep 21, 2014 · 9 comments
Milestone

Comments

@hjoliver
Copy link
Contributor

At NIWA we still use an in-house deployment system (now in special deployment tasks) to install suite components at the start of a suite run. The main reason for this is that our operational system runs a lot of code stored in various small git repositories (none of these are "UM-related", and some even pre-date our use of FCM - they were initially darcs repositories). This works well enough, but our suites would be a bit cleaner if we could just install these files via rose app configs. Potentially I could have a crack at this, following lib/python/rose/loc_handlers/svn.py? In which case, any pointers or issues to be aware of?

@matthewrmshin matthewrmshin added this to the soon milestone Sep 22, 2014
@matthewrmshin
Copy link
Member

Yes, it is possible to implement support by following rose.loc_handlers.svn or rose.loc_handlers.rsync. All you need is to create a class with a similar interface.

The main issue is how to write down the location of a Git clone + a revision + a path as a source.

@matthewrmshin
Copy link
Member

See also metomi/fcm#48.

@matthewrmshin
Copy link
Member

@benfitzpatrick you expressed an interest in this issue this morning.

@benfitzpatrick
Copy link
Contributor

I did! My new team is allergic to Subversion, having had experience of Git. Our main scripts are in internal Git repositories.

@matthewrmshin
Copy link
Member

I hope this allergy is contagious...

@dpmatthews
Copy link
Member

@wxtim
Copy link
Contributor

wxtim commented Mar 3, 2021

I hope this allergy is contagious...

Yes...

@oliver-sanders
Copy link
Member

Easy to do, however, we will probably want to implement multiple methods and let the user choose which to use:

Method Overview GitHub Refs Branches Tags Selected Files
Shallow Clone git clone -b <branch|tag> --depth=1 <repo> 🆗 ⛔ (1) 🆗 🆗
Archive mkdir <path>; git -C <repo> archive <branch|tag|ref> <path> | tar -x -C <path> 🆗 🆗 🆗 🆗

[1] Allowed if uploadArchive.allowUnreachable=true

@oliver-sanders oliver-sanders modified the milestones: 2.0.0, 2.x Apr 16, 2021
@edmundhenley-mo
Copy link

edmundhenley-mo commented Jul 22, 2021

@oliver-sanders, re selected files, might an additional method here be the raw.githubusercontent.com links?

At least for public repos - looks like tokens on private repo links have an expiry date (default 7 days, extendable to only-if-unused-in-1-year...); not sure whether rules for private-repo-under-organisation tokens differ.

E.g. I now use this public-raw-link based hack ~often for getting a handy ".svnignore" file for Python-based svn repos:

# Get the Python-based .gitignore from raw GH url
wget https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore --output-document=.svnignore --quiet

# Remove trailing slashes on patterns for dirs, which svn can't handle
sed --expression="s|/$||" --in-place .svnignore

# Generate a usage message
usage=$(cat<<"EOF"
# Adapted .gitignore for svn (no trailing \ for dirs)
# Source .gitignore: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
# Usage to mimic .gitignore: svn propset svn:global-ignores -F .svnignore .
EOF
)

# Prepend usage message onto .svnignore
printf "%s\n\n%s\n" "$usage" "$(cat .svnignore)" > .svnignore

# Apply it!
svn propset svn:global-ignores -F .svnignore .

# Commit this reference ignore file; any updates will need reapplying
svn add .svnignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants