util

package
v0.0.0-...-92ebfc9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	GIT_WORKING_DIR       = "/tmp/gitops/"
	GetRepoUrlStage       = "Get Repo Url"
	CreateRepoStage       = "Create Repo"
	CloneHttpStage        = "Clone Http"
	CreateReadmeStage     = "Create Readme"
	CloneSshStage         = "Clone Ssh"
	GITLAB_PROVIDER       = "GITLAB"
	GITHUB_PROVIDER       = "GITHUB"
	AZURE_DEVOPS_PROVIDER = "AZURE_DEVOPS"
	BITBUCKET_PROVIDER    = "BITBUCKET_CLOUD"
	GITHUB_API_V3         = "api/v3"
	GITHUB_HOST           = "github.com"
)

Variables

This section is empty.

Functions

func MarshalServiceAccountJSON

func MarshalServiceAccountJSON(serviceAccountKey map[string]interface{}) (string, error)

MarshalServiceAccountJSON is a helper to convert service account key to JSON string

Types

type BlobConfigVariables

type BlobConfigVariables struct {
	CloudConfigured           bool                         `env:"CLOUD_CONFIGURED" envDefault:"false"`
	BlobStorageType           blob_storage.BlobStorageType `env:"BLOB_STORAGE_TYPE"`
	S3AccessKey               string                       `env:"S3_ACCESS_KEY"`
	S3Passkey                 string                       `env:"S3_PASS_KEY"`
	S3EndpointUrl             string                       `env:"S3_END_POINT_URL"`
	S3IsInSecure              bool                         `env:"S3_IS_INSECURE"`
	S3BucketName              string                       `env:"S3_BUCKET_NAME"`
	S3Region                  string                       `env:"S3_REGION"`
	S3VersioningEnabled       bool                         `env:"S3_VERSIONING_ENABLED"`
	AzureEnabled              bool                         `env:"AZURE_ENABLED"`
	AzureAccountName          string                       `env:"AZURE_ACCOUNT_NAME"`
	AzureAccountKey           string                       `env:"AZURE_ACCOUNT_KEY"`
	AzureBlobContainerName    string                       `env:"AZURE_BLOB_CONTAINER_NAME"`
	GcpBucketName             string                       `env:"GCP_BUCKET_NAME"`
	GcpCredentialFileJsonData string                       `env:"GCP_CREDENTIAL_FILE_JSON_DATA"`

	// Feedback Storage Configuration
	FeedbackStorageType               blob_storage.BlobStorageType `env:"FEEDBACK_STORAGE_TYPE" envDefault:"S3"` // S3, GCP, AZURE
	FeedbackS3AccessKey               string                       `env:"FEEDBACK_S3_ACCESS_KEY"`
	FeedbackS3Passkey                 string                       `env:"FEEDBACK_S3_PASS_KEY"`
	FeedbackS3BucketName              string                       `env:"FEEDBACK_S3_BUCKET_NAME"`
	FeedbackS3Region                  string                       `env:"FEEDBACK_S3_REGION" envDefault:"us-east-1"`
	FeedbackGcpBucketName             string                       `env:"FEEDBACK_GCP_BUCKET_NAME"`
	FeedbackGcpCredentialFileJsonData string                       `env:"FEEDBACK_GCP_CREDENTIAL_FILE_JSON_DATA"` // Can use same as Google Sheets service account
	FeedbackAzureEnabled              bool                         `env:"FEEDBACK_AZURE_ENABLED" envDefault:"false"`
	FeedbackAzureAccountName          string                       `env:"FEEDBACK_AZURE_ACCOUNT_NAME"`
	FeedbackAzureAccountKey           string                       `env:"FEEDBACK_AZURE_ACCOUNT_KEY"`
	FeedbackAzureBlobContainerName    string                       `env:"FEEDBACK_AZURE_BLOB_CONTAINER_NAME"`
}

func NewBlobConfig

func NewBlobConfig(logger *zap.SugaredLogger) (*BlobConfigVariables, error)

type GitConfig

type GitConfig struct {
	GitlabGroupId        string //local
	GitlabGroupPath      string //local
	GitToken             string //not null  // public
	GitUserName          string //not null  // public
	GitWorkingDir        string //working directory for git. might use pvc
	GithubOrganization   string
	GitProvider          string // SUPPORTED VALUES  GITHUB, GITLAB
	GitHost              string
	AzureToken           string
	AzureProject         string
	BitbucketWorkspaceId string
	BitbucketProjectKey  string
}

type GitHubClient

type GitHubClient struct {
	GitHubClient *github.Client
	GitHubConfig *GitHubConfig
}

func NewGitHubClient

func NewGitHubClient(logger *zap.SugaredLogger) (*GitHubClient, error)

#nosec

type GitHubConfig

type GitHubConfig struct {
	GitHubHost  string   `env:"GITHUB_HOST" envDefault:"https://github.com"`
	GitHubOrg   string   `env:"GITHUB_ORG" envDefault:""`
	GitHubToken string   `env:"GITHUB_TOKEN" envDefault:""`
	GitHubRepo  []string `env:"GITHUB_REPO" envDefault:"devtron" envSeparator:","`

	GitHubWebhookSecret   string `env:"GITHUB_WEBHOOK_SECRET" envDefault:""`
	GitHubEventTypeHeader string `env:"GITHUB_EVENT_TYPE_HEADER" envDefault:"X-GitHub-Event"`
	GitHubSecretHeader    string `env:"GITHUB_SECRET_HEADER" envDefault:"X-Hub-Signature"`
	GitHubSecretValidator string `env:"GITHUB_SECRET_VALIDATOR" envDefault:"SHA-1"`
}

type GoogleCloudConfig

type GoogleCloudConfig struct {
	ServiceAccountJSON string `env:"FEEDBACK_GCP_CREDENTIAL_FILE_JSON_DATA" envDefault:""`
	SpreadsheetID      string `env:"GOOGLE_SPREADSHEET_ID" envDefault:""`
}

GoogleCloudConfig holds configuration for Google Cloud services (Sheets, Storage, etc.)

type GoogleSheetsClient

type GoogleSheetsClient struct {
	SheetsService *sheets.Service
	Config        *GoogleCloudConfig
}

GoogleSheetsClient provides access to Google Sheets API and service account credentials The same service account can be used for Google Cloud Storage

func NewGoogleSheetsClient

func NewGoogleSheetsClient(logger *zap.SugaredLogger, blobConfig *BlobConfigVariables) (*GoogleSheetsClient, error)

#nosec

func (*GoogleSheetsClient) GetServiceAccountJSON

func (c *GoogleSheetsClient) GetServiceAccountJSON() string

GetServiceAccountJSON returns the service account JSON for use with other Google Cloud services

func (*GoogleSheetsClient) GetSpreadsheetID

func (c *GoogleSheetsClient) GetSpreadsheetID() string

GetSpreadsheetID returns the configured spreadsheet ID

func (*GoogleSheetsClient) IsConfigured

func (c *GoogleSheetsClient) IsConfigured() bool

IsConfigured returns true if the Google Sheets client is properly configured

type ModuleConfig

type ModuleConfig struct {
	ModuleConfig *ModuleConfigVariables
}

func NewModuleConfig

func NewModuleConfig(logger *zap.SugaredLogger) (*ModuleConfig, error)

type ModuleConfigVariables

type ModuleConfigVariables struct {
	Name                    string   `env:"MODULE_NAME" envDefault:"cicd"`
	BaseMinVersionSupported string   `env:"MODULE_BASE_MIN_VERSION_SUPPORTED" envDefault:"v0.0.1"`
	Assets                  []string `env:"MODULE_ASSETS" envDefault:"" envSeparator:","`
	Description             string   `` /* 1179-byte string literal not displayed */
	Title                   string   `env:"MODULE_TITLE" envDefault:"Build and Deploy (CI/CD)"`
	Icon                    string   `` /* 11373-byte string literal not displayed */
	Info                    string   `env:"MODULE_INFO" envDefault:"Enables continuous code integration and deployment."`
	Integrations            string   `env:"INTEGRATIONS"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL