-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:ls1admin/bitbucket-archiver
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,61 @@ | ||
# bitbucket-archiver | ||
|
||
This is a tool to automatically backup git repos hosted on Bitbucket locally. | ||
The primary use case for this tool is to reduce clutter on Bitbucket. | ||
|
||
## Modes of Operation | ||
|
||
The archiver has two options to specify the repos to archive. | ||
|
||
1. Archive all repos that are marked as archived on Bitbucket | ||
2. Provide a list of bitbucket projects to archive (All repos in the projects will be archived) | ||
|
||
## Usage | ||
|
||
### Only create a backup | ||
|
||
1. Copy the `.env.example` file to `.env` and fill in the values | ||
2. Choose the mode of operation | ||
- Default: Archive all repos that are marked as archived on Bitbucket | ||
|
||
```bash | ||
docker run --env-file .env ghcr.io/ls1admin/bitbucket-archiver:latest | ||
``` | ||
|
||
- Project based archival: | ||
- Create a file with the name `projects.txt` in the root of the project | ||
- Add the project names to the file, one per line | ||
|
||
```bash | ||
docker run --env-file .env -v $(pwd)/projects.txt:/app/projects.txt ghcr.io/ls1admin/bitbucket-archiver:latest --project-file projects.txt | ||
``` | ||
|
||
> Explanation | ||
> We need to explicitly provide the env file to the docker container. | ||
> We also need to mount the `projects.txt` file to the container so that it can be read by the script. | ||
|
||
### Backup and Delete Repositories | ||
|
||
1. Copy the `.env.example` file to `.env` and fill in the values | ||
2. Choose the mode of operation | ||
- Default: Archive all repos that are marked as archived on Bitbucket | ||
|
||
```bash | ||
docker run --env-file .env ghcr.io/ls1admin/bitbucket-archiver:latest --execute-delete | ||
``` | ||
|
||
- Project based archival: | ||
- Create a file with the name `projects.txt` in the root of the project | ||
- Add the project names to the file, one per line | ||
|
||
```bash | ||
docker run --env-file .env -v $(pwd)/projects.txt:/app/projects.txt ghcr.io/ls1admin/bitbucket-archiver:latest --project-file projects.txt --execute-delete | ||
``` | ||
|
||
## Development | ||
|
||
Run app locally: | ||
|
||
```bash | ||
go run . | ||
``` |