[GH-ISSUE #1206] Use Git repo for custom scripts #2686

Open
opened 2026-03-14 05:06:12 +03:00 by kerem · 15 comments
Owner

Originally created by @captainpteracloud on GitHub (Jul 11, 2022).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1206

Under Script Manager, add the option to add Git Repos as a source for custom scripts.

Have the ability to add multiple repos as sources.

Add a "Source" column to table where they scripts reside (Local, TRMM Community, Git)

Add filtering on the table view

Originally created by @captainpteracloud on GitHub (Jul 11, 2022). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1206 Under Script Manager, add the option to add Git Repos as a source for custom scripts. Have the ability to add multiple repos as sources. Add a "Source" column to table where they scripts reside (Local, TRMM Community, Git) Add filtering on the table view
Author
Owner

@silversword411 commented on GitHub (Jul 11, 2022):

I like it.

Could probably replicate the existing scripts and processes...though right now it's a one-way sync. Probably a lot of work to do the reverse direction, and how to control sync and might impose some restrictions

<!-- gh-comment-id:1181026181 --> @silversword411 commented on GitHub (Jul 11, 2022): I like it. Could probably replicate the existing scripts and processes...though right now it's a one-way sync. Probably a lot of work to do the reverse direction, and how to control sync and might impose some restrictions
Author
Owner

@dinger1986 commented on GitHub (Jul 11, 2022):

This could be done with a script as currently they are updated with the trmm update script.

<!-- gh-comment-id:1181037704 --> @dinger1986 commented on GitHub (Jul 11, 2022): This could be done with a script as currently they are updated with the trmm update script.
Author
Owner

@captainpteracloud commented on GitHub (Jul 11, 2022):

I suppose I could set a cron job to clone a git repo and have that copied to the Tactical RMM scripts folder. However, I think this is something that should be implemented in the GUI.

<!-- gh-comment-id:1181047052 --> @captainpteracloud commented on GitHub (Jul 11, 2022): I suppose I could set a cron job to clone a git repo and have that copied to the Tactical RMM scripts folder. However, I think this is something that should be implemented in the GUI.
Author
Owner

@dinger1986 commented on GitHub (Jul 11, 2022):

Maybe I'm missing something but if they are public on GitHub why wouldn't they be in the scripts repo?

<!-- gh-comment-id:1181058591 --> @dinger1986 commented on GitHub (Jul 11, 2022): Maybe I'm missing something but if they are public on GitHub why wouldn't they be in the scripts repo?
Author
Owner

@silversword411 commented on GitHub (Jul 12, 2022):

Maybe I'm missing something but if they are public on GitHub why wouldn't they be in the scripts repo?

You could have scripts customized to your environment and private repo with API key...I could see reasons for it.

Of course if there were scripts that would be useful for all, giving back and integrating with community library would be preferred.

<!-- gh-comment-id:1181323477 --> @silversword411 commented on GitHub (Jul 12, 2022): > Maybe I'm missing something but if they are public on GitHub why wouldn't they be in the scripts repo? You could have scripts customized to your environment and private repo with API key...I could see reasons for it. Of course if there were scripts that would be useful for all, giving back and integrating with community library would be preferred.
Author
Owner

@ninjamonkey198206 commented on GitHub (Jul 18, 2022):

@silversword411 the only issue with that would be that you need to include a login method of some sort to use a private repo, as keeping potentially sensitive info in a public repo would be a bad idea.

<!-- gh-comment-id:1188420757 --> @ninjamonkey198206 commented on GitHub (Jul 18, 2022): @silversword411 the only issue with that would be that you need to include a login method of some sort to use a private repo, as keeping potentially sensitive info in a public repo would be a bad idea.
Author
Owner

@captainpteracloud commented on GitHub (Jul 18, 2022):

It would be a private repo, ideally utilizing API tokens to download. It makes sense to keep all my scripts in a git repo and track commits and changes.
Could be done something like https://stackoverflow.com/questions/9504791/is-there-anyway-to-programmatically-fetch-a-zipball-of-private-github-repo
Then its a matter of extracting the zip of the scripts to a folder matching the Repo name in the scripts directory.

I think the actual grab of the repo would be the easiest part.

<!-- gh-comment-id:1188445526 --> @captainpteracloud commented on GitHub (Jul 18, 2022): It would be a private repo, ideally utilizing API tokens to download. It makes sense to keep all my scripts in a git repo and track commits and changes. Could be done something like https://stackoverflow.com/questions/9504791/is-there-anyway-to-programmatically-fetch-a-zipball-of-private-github-repo Then its a matter of extracting the zip of the scripts to a folder matching the Repo name in the scripts directory. I think the actual grab of the repo would be the easiest part.
Author
Owner

@dinger1986 commented on GitHub (Jul 19, 2022):

I really struggle to see the merit in this, if its used only in one Tactical (max 2 as one is maybe prod and other dev you would really want uploading from there to the repo as well) RMM Server then its not advantageous to download from GitHub, your backups include your scripts etc so would copy to another server in the event of DR.

<!-- gh-comment-id:1189012362 --> @dinger1986 commented on GitHub (Jul 19, 2022): I really struggle to see the merit in this, if its used only in one Tactical (max 2 as one is maybe prod and other dev you would really want uploading from there to the repo as well) RMM Server then its not advantageous to download from GitHub, your backups include your scripts etc so would copy to another server in the event of DR.
Author
Owner

@ninjamonkey198206 commented on GitHub (Jul 19, 2022):

Look at it from a hosting perspective:

If Amidaware is hosting a lot of these and managing them, them it actually would make sense for clients to have a way to easily upload their custom scripts from the UI.

It's a pretty good idea to have as an option, though I don't know if I'd put it at the top of the to-do list.

<!-- gh-comment-id:1189028823 --> @ninjamonkey198206 commented on GitHub (Jul 19, 2022): Look at it from a hosting perspective: If Amidaware is hosting a lot of these and managing them, them it actually would make sense for clients to have a way to easily upload their custom scripts from the UI. It's a pretty good idea to have as an option, though I don't know if I'd put it at the top of the to-do list.
Author
Owner

@NiceGuyIT commented on GitHub (Jul 19, 2022):

This is needed from a SDLC standpoint because it adds 1) versioning and 2) management by pinning a script to a particular version. For me, most development happens outside TRMM in a full IDE where I can iterate over the script faster. It's not until the end that I copy it into TRMM. The original is kept in a self-hosted Gitea repo. Keeping the git repo in sync with Tactical is a manual process.

The current implementation has several drawbacks.

  1. The community scripts repo does not use git tags indicating a version.
  2. The scripts cannot be pinned to a specific version. If someone updates a script, it could break a script you use in production.
  3. The gatekeeper to the community scripts is whoever reviews the PRs. As a user, there's not an easy way to view the changes to scripts that you are using in production. git log --patch is the closest but it doesn't show changes for PRs.
  4. Custom scripts are not versioned.

Using a custom git repo (public or private) for scripts in production makes sense until all above items are addressed.

<!-- gh-comment-id:1189075770 --> @NiceGuyIT commented on GitHub (Jul 19, 2022): This is needed from a SDLC standpoint because it adds 1) versioning and 2) management by pinning a script to a particular version. For me, most development happens outside TRMM in a full IDE where I can iterate over the script faster. It's not until the end that I copy it into TRMM. The original is kept in a self-hosted Gitea repo. Keeping the git repo in sync with Tactical is a manual process. The current implementation has several drawbacks. 1. The community scripts repo does not use git tags indicating a version. 2. The scripts cannot be pinned to a specific version. If someone updates a script, it could break a script you use in production. 3. The gatekeeper to the community scripts is whoever reviews the PRs. As a user, there's not an easy way to view the changes to scripts that you are using in production. `git log --patch` is the closest but it doesn't show changes for PRs. 4. Custom scripts are not versioned. Using a custom git repo (public or private) for scripts in production makes sense until all above items are addressed.
Author
Owner

@captainpteracloud commented on GitHub (Jul 20, 2022):

I don't see a drawback of implementing git. Its maturation of the software and will make it more attractive to enterprise use.

  • Git is the industry standard code/script storage and versioning.
  • Versioning is a big reason to use git.
  • Forking the community repo and freezing or changing scripts to our unique environment. We can then pull in changes made from the community and merge them with ours or create merge requests to the community repo.
  • Tactical RMM isn't an IDE. Nor does it integrate with any IDE.
  • Tactical RMM doesn't track changes made by different users

There is no reason to try and make Tactical RMM into a version control system or IDE. So it makes sense to integrate in a system that is.

<!-- gh-comment-id:1190552714 --> @captainpteracloud commented on GitHub (Jul 20, 2022): I don't see a drawback of implementing git. Its maturation of the software and will make it more attractive to enterprise use. - Git is the industry standard code/script storage and versioning. - Versioning is a big reason to use git. - Forking the community repo and freezing or changing scripts to our unique environment. We can then pull in changes made from the community and merge them with ours or create merge requests to the community repo. - Tactical RMM isn't an IDE. Nor does it integrate with any IDE. - Tactical RMM doesn't track changes made by different users There is no reason to try and make Tactical RMM into a version control system or IDE. So it makes sense to integrate in a system that is.
Author
Owner

@bbrendon commented on GitHub (Jul 21, 2022):

Interesting idea. Looks like you could do this now by merging your own scripts into /opt/trmm-community-scripts and running python manage.py load_community_scripts

<!-- gh-comment-id:1191014967 --> @bbrendon commented on GitHub (Jul 21, 2022): Interesting idea. Looks like you could do this now by merging your own scripts into /opt/trmm-community-scripts and running `python manage.py load_community_scripts`
Author
Owner

@NiceGuyIT commented on GitHub (May 15, 2023):

Here's my solution: https://github.com/NiceGuyIT/taskfiles/tree/main/trmm

<!-- gh-comment-id:1548004648 --> @NiceGuyIT commented on GitHub (May 15, 2023): Here's my solution: https://github.com/NiceGuyIT/taskfiles/tree/main/trmm
Author
Owner

@nativeit commented on GitHub (Dec 21, 2023):

I think there were a few slightly diverging takes on this idea, judging from the context clues in some of the comments.

I could see having both the ability to link one's own private git repository with their own custom scripts, as well as changing the community scripts such they are hosted/managed/synced directly with the Github repo. The community scripts being moved to git has all the crucial advantages mentioned by @NiceGuyIT, and it could also resolve many of the significant issues that were raised and discussed in #1486 as well (specifically the behavior of modified and/or deprecated scripts that are removed from automation routines).

If someone worked to further flesh out the git interface within TRMM, so SSH/GPG keys and access tokens could be utilized, it might also facilitate some additional features and options that could be used within scripts. Things like:

  • Secrets management
  • Better/more options for how results are displayed and handled
  • Provisioning supplemental files/data
  • Automation via GitHub Actions/CI pipelines
<!-- gh-comment-id:1865480684 --> @nativeit commented on GitHub (Dec 21, 2023): I think there were a few slightly diverging takes on this idea, judging from the context clues in some of the comments. I could see having both the ability to link one's own private git repository with their own custom scripts, as well as changing the community scripts such they are hosted/managed/synced directly with the Github repo. The community scripts being moved to git has all the crucial advantages mentioned by @NiceGuyIT, and it could also resolve many of the significant issues that were raised and discussed in #1486 as well (specifically the behavior of modified and/or deprecated scripts that are removed from automation routines). If someone worked to further flesh out the git interface within TRMM, so SSH/GPG keys and access tokens could be utilized, it might also facilitate some additional features and options that could be used within scripts. Things like: - Secrets management - Better/more options for how results are displayed and handled - Provisioning supplemental files/data - Automation via GitHub Actions/CI pipelines
Author
Owner

@clambert-daileycomputer commented on GitHub (Mar 8, 2024):

here's a hacky implementation of github webhooks + tactical rmm:
https://github.com/daileycomputerconsulting/tactical-rmm-webhooks

<!-- gh-comment-id:1984840678 --> @clambert-daileycomputer commented on GitHub (Mar 8, 2024): here's a hacky implementation of github webhooks + tactical rmm: https://github.com/daileycomputerconsulting/tactical-rmm-webhooks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#2686
No description provided.