Skip to content

A tool to archive to S3 an entire org/users repositories into S3 bucket with the help of ghorg and generate an excel report to have an overview of each repo (last commit, top/last developer, conf file exist,...)

License

Notifications You must be signed in to change notification settings

s3pweb/gitArchiveS3Report

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backup Cobra

Backup Cobra is a powerful tool designed to clone repositories, generate detailed reports in Excel format, zip repositories and upload zip files to Amazon S3. It helps you keep track of your repositories, developers' activities, and various project metrics.

Description

Backup Cobra automates the process of cloning repositories, generate detailed reports in Excel format, zip repositories and upload zip files to Amazon S3. It supports Bitbucket repositories and provides insights into developer activities, commit histories, and project configurations.

Features

  • Clone Repositories: Clone all repositories from a Bitbucket workspace using ghorg.
  • Generate Excel Reports: Create Excel reports with detailed branch information, including last commit dates, top developers, and various project metrics.
  • Zip Repositories: Generate zip files for each repositories of a workspace.
  • Upload to AmazonS3: Upload a zip files, repositories of a project into amazon S3.

Installation

  1. Clone the repository :

    git clone https://github.com/yourusername/backup-cobra.git
    cd backup-cobra
    
  2. Install Go : Make sure Go is installed. You can dowload it from the official Go website https://go.dev/doc/install

  3. Install dependencies :

  • ghorg (for cloning repositories) go install github.com/gabrie30/ghorg@latest
  • Excelize (for generating Excel reports) go get -u github.com/xuri/excelize/v2
  • cobra go get -u github.com/spf13/cobra@latest
  1. Install project dependencies : From the project root, run : go mod tidy

  2. Configure AWS and Bitbucket credentials : To store sensitive information like API keys or credentials, you can use a .secrets file. An example file named example.secrets is provided in the project to help you get started.

  • Copy the example.secrets file and rename it to .secrets:

    cp example.secrets .secrets
    
  • Fill it with the secrets required

  • For help to get the keys for aws amazon S3 you can use this documentation : https://docs.aws.amazon.com/fr_fr/IAM/latest/UserGuide/id_credentials_access-keys.html

  1. Configure your .config file : The .config file allows you to customize certain behaviors of the project. An exemple file name example.config is provided in the project to help you get started.
  • Copy the example.config file and rename it to .config:
    cp example.config .config
    

In this .config file you have some variables you can configurate :

  • CPU : you can choose the number of processors you want to use (by default 1).

  • DEVELOPERS_MAP : For developpers it will group some username, exemple : "DEVELOPERS_MAP=Jean D=Jean Dupont;"

  • DEFAULT_COLUMN : The list of the default column that the program do

  • TERMS_TO_SEARCH : List of terms you want to search for in the files of the repository (handle regex)

  • FILES_TO_SEARCH : List of file you want to search for in a repository (handle regex)

Usage

Clone Repositories

./backupcobra clone --dir-path <path where to clone the repositories>

Generate an Excel Report

./backupcobra report --dir-path <path where the repositories were cloned>

Compress Directories

./backupcobra zip --dir-path <path where the repositories were cloned>

Upload to Amazon S3

./backupcobra upload --dir-path <path where the repositories were cloned>

Features

  1. Repositories Cloning : Clones repositories form a specified workspace.

  1. Excel Report Generation : Creates an Excel file with detailed information about repositories, branches, commit, etc.

  1. Directory Compression : Creates zip files for specified directories.

  1. Amazon S3 upload : Uploads directories or zip files to a secure S3 bucket.

Project Structure

  • cmd/ : Contains the project's CLI commands.

  • processrepos/ : Main application logic.

  • utils/ : some useful functions

Authors

Main author : Louise Calvez

About

A tool to archive to S3 an entire org/users repositories into S3 bucket with the help of ghorg and generate an excel report to have an overview of each repo (last commit, top/last developer, conf file exist,...)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages