Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/feromond/devops_repository_sync

A simple tool to build an executable capable of syncing a local and remote repo.
https://github.com/feromond/devops_repository_sync

api async azure-devops repository-management rust

Last synced: about 5 hours ago
JSON representation

A simple tool to build an executable capable of syncing a local and remote repo.

Awesome Lists containing this project

README

        

# Azure DevOps Repository Sync

This simple script is focused on syncing a local repo to a remote main branch in azure devops automatically. It can be added as a task or added to the startup tasks as a shortcut in windows.

The executable should sit in the same directory as the config.toml file to run things correctly.

Future updates will include ~~the ability to modify the refresh time in the config~~ (DONE), and will also allow config selection of whether to create a visible terminal window or to allow a background task to run on the machine.

> Note this script works currently on MacOS but is only designed and tested for Windows.

## Script Process

- Reads the config file to identify the local and remote repo, as well as the personal access token.
- Checks if the commit hash/id for the remote repo matches the local git repo
- If not matching, it will go and pull the latest changes and update the local repo
- If they do match, it will continue to log the time since the last mis-match (defaulting first to when the script first ran) and check for any changes every 20 seconds (current default refresh)

## Running the Script on Windows Startup

1. Task Scheduler:

Use Windows Task Scheduler to run your Rust script at startup.

Steps:

1. Open Task Scheduler from the Start Menu.
2. Select “Create Basic Task” from the right panel.
3. Name the task (e.g., “DevOps Sync Script”).
4. Choose “When the computer starts” as the trigger.
5. Select “Start a Program” as the action.
6. Browse to the compiled Rust executable (.exe) and select it.
7. Make sure set the "Start In (Optional)" field to wherever the exe will sit with the config
8. Configure the task to run with highest privileges if needed.
9. The system account may require additional access to the local git repo and pull changes. Use the following:

`git config --global --add safe.directory `

`git config --system --add safe.directory `

2. Startup Folder (only works after logging in):

Place a shortcut to the Rust executable in the Windows Startup folder.

Steps:

1. Press Win + R and type shell:startup to open the Startup folder.
2. Create a shortcut to your Rust script’s executable in this folder.

For all of the above, make sure to have the config.toml file with the filled in values in the same directory as the executible file that runs.