-
Notifications
You must be signed in to change notification settings - Fork 928
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
Output Git - how its working? #3275
Comments
I'm not directly associated with Oxidized, but I can help clarify based on what I understand:
Oxidized uses the rugged/libgit2 interface for interacting with Git repositories, which differs from the standard Git CLI behavior. It's important to note that normal Git hooks are not executed when using this interface. If you're expecting automatic pushes to a remote repository, you'll need to set up specific hooks within Oxidized's configuration. Here’s an example configuration that uses a hook to push changes to a remote repository:
In this setup, the post_store event triggers after a device configuration is stored, pushing the changes to the specified remote repository. Make sure to add your SSH keys (oxidized-key) to your remote Git repository to allow for authentication.
By default, Oxidized uses the master or main branch, depending on the repository setup. However, this can be configured in your Git settings if needed. You can manually specify the branch you want Oxidized to use by setting up your repository and remote accordingly.
The rugged/libgit2 interface is a library-based approach to Git, used for handling commits, branches, and pushes in Oxidized. It works at a lower level compared to the standard Git command-line interface, which is why the behavior is a bit different. For example: File changes are automatically committed locally in the .git/objects directory. If you're seeing device configurations stored in the objects directory but not pushed automatically, this is due to the lack of Git hooks in the rugged/libgit2 setup, which needs to be configured manually as described above. If anything i wrote is wrong feel free to correct me |
git is specified for output, but the bare repository that is created is the master branch. configoutput: |
As far as i know it is not supported to do this in config. This might be helpful also if you are planing to use remote repo there's a wip feature here. Also i think you can edit your .git/config
and change it to
|
Thank you for your cooperation. In my project, the git push part is executed from a shell script, so I don't have any knowledge of Ruby, but for Oxidized processing, if you specify git in the output item in the config settings, In other words, By the way, I use Oxidized with Docker Compose. |
Ok from my test this should work, test it and tell me did it work for you. Please make sure to backup your repo
|
Thank you for your cooperation. The remote repository on GitHub is the main branch, so before running Docker Compose, Regarding the need to prepare a local Git repository in advance, ▼Below are the parts that may be related to this time.
■/opt/app/oxidized/.config/oxidized/config
■Prepare a bare repository in advance
■Start Oxidized with Docker Compose
|
After that, there seems to be a problem where the contents of the remote repository are overwritten during Oxidized processing. Do you know how to avoid this? |
There's no need to create local git repo in advance further more it's discouraged.
if you plan on using remote repo with oxidized use
as you basically try to implement an existing feature with your script.
if you want to use standard git repo as your backup tool and do it with a script just use output: file and save the files in a repo that you cloned or let the oxidized handle it with the hook |
Thank you for your cooperation. It is necessary to use "proxy" to "git push", and unfortunately "git push" using "hooks" does not support "proxy". The focus is on setting output:git in Oxidized's config, We understand that there is no clear solution to this issue. |
Rugged does support the use of a :proxy_url in fetch and push. Oxidized doesn't. If this feature is needed, someone need to implement it. I've read the thread. Do NOT fiddle with oxidized internal repository. Do not create it, do not modify it. You will break things. The only acceptable changes are the one documented (git gc and rename the git branch) and only while oxidized is not running. |
Thank you for your cooperation. You updated the document on October 15, 2024. https://github.com/ytti/oxidized/blob/master/docs/Hooks.md
In Oxidized's Dockerfile, For example, if you want it to work on the main branch, use Oxidized's Dockerfile.
I would appreciate it if you could tell me the specific settings of the config file to achieve this. |
Setting init.defaultBranch only works if your ~/.gitconfig ist persistend, which I doubt in the docker container. You'll probably have to rename de branch manually as described at https://github.com/ytti/oxidized/blob/master/docs/Hooks.md#custom-branch-name. You should also use the latest oxidized docker image, as 0.30.1 did not fully support custom branch names. Regarding the proxy thing. You are doing something very specific which is not supported by oxidized. You have already become a lot of help from @skiera6 (Thanks a lot by the way @skiera6) within this issue . You've got everything you need to solve your problem. Read the docs, reread the issue, try it out and find a solution for your problem yourself. |
Thank you for your cooperation. In my case, Oxidized is being used in a way that is not expected. |
Hi community.
Please help me understand how the Output Git method works. I've read the manual, but couldn't find information about git push, commits, and other related operations.
It doesn't work automatically.
git remote add origin [email protected]:tech/oxidized-dc.git
Why doesn't Oxi automatically push files with the normal names of devices?
What branch Oxi use for automatically push configs ?
How does the rugged/libgit2 interface from the output section work?
The text was updated successfully, but these errors were encountered: