Documentation ¶
Index ¶
- Constants
- Variables
- func CheckFileExists(filename string) (bool, error)
- func CleanupAfterFetchingHttpsSubmodules() error
- func CreateGitCredentialFileAndWriteData(data string) error
- func CreateSshPrivateKeyOnDisk(fileId int, sshPrivateKeyContent string) error
- func DeleteFile(path string) error
- func Generate(size int) string
- func GetBlobStorageBaseAzureConfig(b *blob_storage.AzureBlobConfig, blobStorageObjectType string) *blob_storage.AzureBlobBaseConfig
- func GetBlobStorageBaseGcpConfig(b *blob_storage.GcpBlobConfig, blobStorageObjectType string) *blob_storage.GcpBlobBaseConfig
- func GetBlobStorageBaseS3Config(b *blob_storage.BlobStorageS3Config, blobStorageObjectType string) *blob_storage.AwsS3BaseConfig
- func GetProjectName(url string) string
- func LogStage(name string)
- func ParseUrl(rawURL string) (parsedURL *url.URL, err error)
- func RunCommand(cmd *exec.Cmd) error
- func SpawnProcessWithLogging()
- type BlobStorageConfig
- type CloudHelperBaseConfig
Constants ¶
View Source
const ( BlobStorageObjectTypeCache = "cache" BlobStorageObjectTypeArtifact = "artifact" BlobStorageObjectTypeLog = "log" )
View Source
const ( DEVTRON = "DEVTRON" DEFAULT_KEY = "default" INSECURE = "insecure" SECUREWITHCERT = "secure-with-cert" DOCKER_PS_START_WAIT_SECONDS = 150 HOMEDIR = "/" WORKINGDIR = "/devtroncd" LOCAL_BUILDX_LOCATION = "/var/lib/devtron/buildx" LOCAL_BUILDX_CACHE_LOCATION = LOCAL_BUILDX_LOCATION + "/cache" CIEVENT = "CI" JOBEVENT = "JOB" CDSTAGE = "CD" DRY_RUN = "DryRun" ENV_VARIABLE_BUILD_SUCCESS = "BUILD_SUCCESS" CiCdEventEnvKey = "CI_CD_EVENT" Source_Signal = "Source_Signal" Source_Defer = "Source_Defer" DefaultErrorCode = 1 AbortErrorCode = 143 CiStageFailErrorCode = 2 InAppLogging = "IN_APP_LOGGING" CiRunnerCommand = "./cirunner" TeeCommand = "tee" LogFileName = "main.log" NewLineChar = "\n" )
View Source
const ( ResultsDirInCIRunnerPath = "/polling-plugin/results.json" PathInPollingPlugin = "/tmp/results.json" )
View Source
const ( SSH_PRIVATE_KEY_DIR = ".ssh" SSH_PRIVATE_KEY_FILE_NAME = "id_rsa" GIT_CREDENTIAL_FILE_NAME = ".git-credentials" CLONING_MODE_SHALLOW = "SHALLOW" CLONING_MODE_FULL = "FULL" )
Variables ¶
View Source
var ( TmpArtifactLocation = "./job-artifact" TmpLogLocation = "/main.log" Output_path = filepath.Join(WORKINGDIR, "./process") Bash_script = filepath.Join("_script.sh") )
Functions ¶
func CheckFileExists ¶
CheckFileExists returns boolean value of file existence else error (ignoring file does not exist error)
func CleanupAfterFetchingHttpsSubmodules ¶
func CleanupAfterFetchingHttpsSubmodules() error
func DeleteFile ¶
func GetBlobStorageBaseAzureConfig ¶
func GetBlobStorageBaseAzureConfig(b *blob_storage.AzureBlobConfig, blobStorageObjectType string) *blob_storage.AzureBlobBaseConfig
func GetBlobStorageBaseGcpConfig ¶
func GetBlobStorageBaseGcpConfig(b *blob_storage.GcpBlobConfig, blobStorageObjectType string) *blob_storage.GcpBlobBaseConfig
func GetBlobStorageBaseS3Config ¶
func GetBlobStorageBaseS3Config(b *blob_storage.BlobStorageS3Config, blobStorageObjectType string) *blob_storage.AwsS3BaseConfig
func GetProjectName ¶
GetProjectName this function has been designed for returning project name of git-lab and git-hub providers only do not remove this function
func RunCommand ¶
func SpawnProcessWithLogging ¶
func SpawnProcessWithLogging()
SpawnProcessWithLogging This method handles the logic for maintaining a local log file for log archival and handles SIGTERM propagation. The subprocess spawned will bypass this function and execute the main logic
Types ¶
type BlobStorageConfig ¶
type BlobStorageConfig struct { //AWS credentials CloudProvider blob_storage.BlobStorageType `env:"BLOB_STORAGE_PROVIDER"` S3AccessKey string `env:"BLOB_STORAGE_S3_ACCESS_KEY"` S3SecretKey string `env:"BLOB_STORAGE_S3_SECRET_KEY"` S3Endpoint string `env:"BLOB_STORAGE_S3_ENDPOINT"` S3EndpointInsecure bool `env:"BLOB_STORAGE_S3_ENDPOINT_INSECURE" envDefault:"false"` S3BucketVersioned bool `env:"BLOB_STORAGE_S3_BUCKET_VERSIONED" envDefault:"true"` //artifact and logs bucket name in s3 will get their values from DEFAULT_BUILD_LOGS_BUCKET CdDefaultBuildLogsBucket string `env:"DEFAULT_BUILD_LOGS_BUCKET" ` //logs and artifact region in s3 will get their values from DEFAULT_CD_LOGS_BUCKET_REGION CdDefaultCdLogsBucketRegion string `env:"DEFAULT_CD_LOGS_BUCKET_REGION" ` //cache bucket name in s3 will get its value from DEFAULT_CACHE_BUCKET DefaultCacheBucket string `env:"DEFAULT_CACHE_BUCKET"` //cache region in s3 will get its value from DEFAULT_CACHE_BUCKET_REGION DefaultCacheBucketRegion string `env:"DEFAULT_CACHE_BUCKET_REGION"` //GCP credentials GcpBlobStorageCredentialJson string `env:"BLOB_STORAGE_GCP_CREDENTIALS_JSON"` //Azure credentials AzureAccountName string `env:"AZURE_ACCOUNT_NAME"` AzureGatewayUrl string `env:"AZURE_GATEWAY_URL"` AzureGatewayConnectionInsecure bool `env:"AZURE_GATEWAY_CONNECTION_INSECURE" envDefault:"true"` AzureAccountKey string `env:"AZURE_ACCOUNT_KEY"` //log and artifact container name in azure will get their values from AZURE_BLOB_CONTAINER_CI_LOG AzureBlobContainerCiLog string `env:"AZURE_BLOB_CONTAINER_CI_LOG"` //cache container name in azure will get their values from AZURE_BLOB_CONTAINER_CI_CACHE AzureBlobContainerCiCache string `env:"AZURE_BLOB_CONTAINER_CI_CACHE"` }
BlobStorageConfig is the blob storage config for external cluster added via cm/secret code will be expecting these env variables acc to cloud provider if UseExternalClusterBlob is true.
func GetBlobStorageConfig ¶
func GetBlobStorageConfig() (*BlobStorageConfig, error)
type CloudHelperBaseConfig ¶
type CloudHelperBaseConfig struct { StorageModuleConfigured bool BlobStorageLogKey string CloudProvider blob_storage.BlobStorageType UseExternalClusterBlob bool BlobStorageS3Config *blob_storage.BlobStorageS3Config AzureBlobConfig *blob_storage.AzureBlobConfig GcpBlobConfig *blob_storage.GcpBlobConfig BlobStorageObjectType string }
func (*CloudHelperBaseConfig) SetAwsBlobStorageS3Config ¶
func (c *CloudHelperBaseConfig) SetAwsBlobStorageS3Config(blobStorageConfig *BlobStorageConfig)
func (*CloudHelperBaseConfig) SetAzureBlobStorageConfig ¶
func (c *CloudHelperBaseConfig) SetAzureBlobStorageConfig(blobStorageConfig *BlobStorageConfig)
func (*CloudHelperBaseConfig) SetGcpBlobStorageConfig ¶
func (c *CloudHelperBaseConfig) SetGcpBlobStorageConfig(blobStorageConfig *BlobStorageConfig)
Click to show internal directories.
Click to hide internal directories.