Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upload and download logs/artifact from blob storage configured in external cluster #4138

Merged
merged 30 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
72d3c3e
blob storage cm secret inducing internally and removed AWS creds set …
prakash100198 Oct 18, 2023
7db0738
some refactoring and UseExternalClusterBlob flag introduced in cicdco…
prakash100198 Oct 18, 2023
a23d3e8
added support fr fetching logs and artifacts from external cluster bl…
prakash100198 Oct 20, 2023
70cf43a
wire
prakash100198 Oct 20, 2023
45a614f
main sync
prakash100198 Oct 20, 2023
06ccbd1
minor fix
prakash100198 Oct 20, 2023
0915bd2
import fix
prakash100198 Oct 20, 2023
92557ad
code refactoring
prakash100198 Oct 20, 2023
bc249fd
info comment
prakash100198 Oct 24, 2023
cb174cb
fix
prakash100198 Oct 24, 2023
1da47a8
comments added
prakash100198 Oct 24, 2023
74165a8
comments fix
prakash100198 Oct 24, 2023
8ef0a28
decodeSecretKey
prakash100198 Oct 24, 2023
24152a1
code review oncorporation l1
prakash100198 Oct 25, 2023
c4dc66e
code review incorporation l2
prakash100198 Oct 25, 2023
d8ccf8b
Merge branch 'main' into ext-cluster-blob-issue
prakash100198 Oct 26, 2023
430c93f
code review incorporation l3
prakash100198 Oct 26, 2023
5f68d00
code review incorporation l4
prakash100198 Oct 26, 2023
23f2bbb
code review incorporation l5
prakash100198 Oct 26, 2023
734cc55
code review incorporation l6
prakash100198 Oct 26, 2023
e89a556
main branch sync
prakash100198 Oct 26, 2023
bd3e83d
minor fix for job tyoe
prakash100198 Oct 27, 2023
c616e88
minor fix
prakash100198 Oct 27, 2023
e25d2fc
code review incorporation
prakash100198 Oct 27, 2023
67cdff2
code review incorporation
prakash100198 Oct 27, 2023
7f82b16
code review incorporation
prakash100198 Oct 27, 2023
9ea6b38
Merge branch 'main' into ext-cluster-blob-issue
prakash100198 Oct 30, 2023
2bf4838
minor fix after debugging error
prakash100198 Oct 30, 2023
69f550e
main code sync
prakash100198 Oct 31, 2023
b5c05e4
common lib version upgrade from 0.0.3 to 0.0.4
prakash100198 Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 148 additions & 4 deletions pkg/pipeline/CdHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package pipeline
import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
application2 "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
Expand Down Expand Up @@ -52,6 +53,8 @@ import (
"github.com/go-pg/pg"
"go.opentelemetry.io/otel"
"go.uber.org/zap"
errors2 "k8s.io/apimachinery/pkg/api/errors"
v12 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/rest"
"os"
"path/filepath"
Expand Down Expand Up @@ -119,9 +122,10 @@ type CdHandlerImpl struct {
k8sUtil *k8s.K8sUtil
workflowService WorkflowService
config *CdConfig
clusterRepository repository2.ClusterRepository
}

func NewCdHandlerImpl(Logger *zap.SugaredLogger, userService user.UserService, cdWorkflowRepository pipelineConfig.CdWorkflowRepository, ciLogService CiLogService, ciArtifactRepository repository.CiArtifactRepository, ciPipelineMaterialRepository pipelineConfig.CiPipelineMaterialRepository, pipelineRepository pipelineConfig.PipelineRepository, envRepository repository2.EnvironmentRepository, ciWorkflowRepository pipelineConfig.CiWorkflowRepository, helmAppService client.HelmAppService, pipelineOverrideRepository chartConfig.PipelineOverrideRepository, workflowDagExecutor WorkflowDagExecutor, appListingService app.AppListingService, appListingRepository repository.AppListingRepository, pipelineStatusTimelineRepository pipelineConfig.PipelineStatusTimelineRepository, application application.ServiceClient, argoUserService argo.ArgoUserService, deploymentEventHandler app.DeploymentEventHandler, eventClient client2.EventClient, pipelineStatusTimelineResourcesService status.PipelineStatusTimelineResourcesService, pipelineStatusSyncDetailService status.PipelineStatusSyncDetailService, pipelineStatusTimelineService status.PipelineStatusTimelineService, appService app.AppService, appStatusService app_status.AppStatusService, enforcerUtil rbac.EnforcerUtil, installedAppRepository repository3.InstalledAppRepository, installedAppVersionHistoryRepository repository3.InstalledAppVersionHistoryRepository, appRepository app2.AppRepository, resourceGroupService resourceGroup2.ResourceGroupService, imageTaggingService ImageTaggingService, k8sUtil *k8s.K8sUtil, workflowService WorkflowService) *CdHandlerImpl {
func NewCdHandlerImpl(Logger *zap.SugaredLogger, userService user.UserService, cdWorkflowRepository pipelineConfig.CdWorkflowRepository, ciLogService CiLogService, ciArtifactRepository repository.CiArtifactRepository, ciPipelineMaterialRepository pipelineConfig.CiPipelineMaterialRepository, pipelineRepository pipelineConfig.PipelineRepository, envRepository repository2.EnvironmentRepository, ciWorkflowRepository pipelineConfig.CiWorkflowRepository, helmAppService client.HelmAppService, pipelineOverrideRepository chartConfig.PipelineOverrideRepository, workflowDagExecutor WorkflowDagExecutor, appListingService app.AppListingService, appListingRepository repository.AppListingRepository, pipelineStatusTimelineRepository pipelineConfig.PipelineStatusTimelineRepository, application application.ServiceClient, argoUserService argo.ArgoUserService, deploymentEventHandler app.DeploymentEventHandler, eventClient client2.EventClient, pipelineStatusTimelineResourcesService status.PipelineStatusTimelineResourcesService, pipelineStatusSyncDetailService status.PipelineStatusSyncDetailService, pipelineStatusTimelineService status.PipelineStatusTimelineService, appService app.AppService, appStatusService app_status.AppStatusService, enforcerUtil rbac.EnforcerUtil, installedAppRepository repository3.InstalledAppRepository, installedAppVersionHistoryRepository repository3.InstalledAppVersionHistoryRepository, appRepository app2.AppRepository, resourceGroupService resourceGroup2.ResourceGroupService, imageTaggingService ImageTaggingService, k8sUtil *k8s.K8sUtil, workflowService WorkflowService, clusterRepository repository2.ClusterRepository) *CdHandlerImpl {
cdh := &CdHandlerImpl{
Logger: Logger,
userService: userService,
Expand Down Expand Up @@ -155,6 +159,7 @@ func NewCdHandlerImpl(Logger *zap.SugaredLogger, userService user.UserService, c
imageTaggingService: imageTaggingService,
k8sUtil: k8sUtil,
workflowService: workflowService,
clusterRepository: clusterRepository,
}
config, err := GetCdConfig()
if err != nil {
Expand All @@ -170,6 +175,29 @@ type ArgoPipelineStatusSyncEvent struct {
IsAppStoreApplication bool `json:"isAppStoreApplication"`
}

type CmBlobStorageConfig struct {
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
//AWS credentials
CloudProvider blob_storage.BlobStorageType `json:"BLOB_STORAGE_PROVIDER"`
S3AccessKey string `json:"BLOB_STORAGE_S3_ACCESS_KEY"`
S3Endpoint string `json:"BLOB_STORAGE_S3_ENDPOINT"`
S3EndpointInsecure bool `json:"BLOB_STORAGE_S3_ENDPOINT_INSECURE"`
S3BucketVersioned bool `json:"BLOB_STORAGE_S3_BUCKET_VERSIONED"`

//Azure credentials
AzureAccountName string `json:"AZURE_ACCOUNT_NAME"`
AzureGatewayUrl string `json:"AZURE_GATEWAY_URL"`
AzureGatewayConnectionInsecure bool `json:"AZURE_GATEWAY_CONNECTION_INSECURE"`
}

type SecretBlobStorageConfig struct {
//aws
S3SecretKey string `json:"BLOB_STORAGE_S3_SECRET_KEY"`
//gcp
GcpBlobStorageCredentialJson string `json:"BLOB_STORAGE_GCP_CREDENTIALS_JSON"`
//azure
AzureAccountKey string `json:"AZURE_ACCOUNT_KEY"`
}

const NotTriggered string = "Not Triggered"
const NotDeployed = "Not Deployed"
const WorklowTypeDeploy = "DEPLOY"
Expand Down Expand Up @@ -913,7 +941,7 @@ func (impl *CdHandlerImpl) getWorkflowLogs(pipelineId int, cdWorkflow *pipelineC
return nil, nil, errors.New("logs-not-stored-in-repository")
} else if string(v1alpha1.NodeSucceeded) == cdWorkflow.Status || string(v1alpha1.NodeError) == cdWorkflow.Status || string(v1alpha1.NodeFailed) == cdWorkflow.Status || cdWorkflow.Status == WorkflowCancel {
impl.Logger.Debugw("pod is not live ", "err", err)
return impl.getLogsFromRepository(pipelineId, cdWorkflow)
return impl.getLogsFromRepository(pipelineId, cdWorkflow, clusterConfig, runStageInEnv)
}
impl.Logger.Errorw("err on fetch workflow logs", "err", err)
return nil, nil, err
Expand All @@ -922,7 +950,7 @@ func (impl *CdHandlerImpl) getWorkflowLogs(pipelineId int, cdWorkflow *pipelineC
return logReader, cleanUp, err
}

func (impl *CdHandlerImpl) getLogsFromRepository(pipelineId int, cdWorkflow *pipelineConfig.CdWorkflowRunner) (*bufio.Reader, func() error, error) {
func (impl *CdHandlerImpl) getLogsFromRepository(pipelineId int, cdWorkflow *pipelineConfig.CdWorkflowRunner, clusterConfig *k8s.ClusterConfig, isExt bool) (*bufio.Reader, func() error, error) {
impl.Logger.Debug("getting historic logs")

cdConfig, err := impl.cdWorkflowRepository.FindConfigByPipelineId(pipelineId)
Expand Down Expand Up @@ -964,6 +992,29 @@ func (impl *CdHandlerImpl) getLogsFromRepository(pipelineId int, cdWorkflow *pip
CredentialFileJsonData: impl.config.BlobStorageGcpCredentialJson,
},
}

useExternalBlobStorage := isExt && !impl.config.UseBlobStorageConfigInCdWorkflow
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
if useExternalBlobStorage {
//fetch extClusterBlob cm and cs from k8s client, if they are present then read creds
//from them else return.
cmConfig, secretConfig, err := impl.FetchCmAndSecretBlobConfigFromExternalCluster(clusterConfig, cdWorkflow.Namespace)
if err != nil {
impl.Logger.Errorw("error in fetching config map and secret from external cluster", "err", err, "clusterConfig", clusterConfig)
return nil, nil, err
}
cdLogRequest.CloudProvider = cmConfig.CloudProvider
cdLogRequest.AzureBlobConfig.AccountName = cmConfig.AzureAccountName
cdLogRequest.AzureBlobConfig.AccountKey = secretConfig.AzureAccountKey

cdLogRequest.GcpBlobBaseConfig.CredentialFileJsonData = secretConfig.GcpBlobStorageCredentialJson

cdLogRequest.AwsS3BaseConfig.AccessKey = cmConfig.S3AccessKey
cdLogRequest.AwsS3BaseConfig.EndpointUrl = cmConfig.S3Endpoint
cdLogRequest.AwsS3BaseConfig.IsInSecure = cmConfig.S3EndpointInsecure
cdLogRequest.AwsS3BaseConfig.Passkey = secretConfig.S3SecretKey
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved

}

impl.Logger.Infow("s3 log req ", "req", cdLogRequest)
oldLogsStream, cleanUp, err := impl.ciLogService.FetchLogs(impl.config.BaseLogLocationPath, cdLogRequest)
if err != nil {
Expand All @@ -974,6 +1025,59 @@ func (impl *CdHandlerImpl) getLogsFromRepository(pipelineId int, cdWorkflow *pip
return logReader, cleanUp, err
}

func (impl *CdHandlerImpl) FetchCmAndSecretBlobConfigFromExternalCluster(clusterConfig *k8s.ClusterConfig, namespace string) (CmBlobStorageConfig, SecretBlobStorageConfig, error) {
var cmConfig CmBlobStorageConfig
var secretConfig SecretBlobStorageConfig
_, _, kubeClient, err := impl.k8sUtil.GetK8sConfigAndClients(clusterConfig)
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
impl.Logger.Errorw("FetchCmAndSecretBlobConfigFromExternalCluster, error in getting kubeClient by cluster config", "err", err)
return cmConfig, secretConfig, err
}
cm, err := kubeClient.CoreV1().ConfigMaps(namespace).Get(context.Background(), impl.config.ExtBlobStorageCmName, v12.GetOptions{})
if err != nil && !errors2.IsNotFound(err) {
impl.Logger.Errorw("error in getting config map in external cluster", "err", err, "blobStorageCmName", impl.config.ExtBlobStorageCmName, "clusterName", clusterConfig.ClusterName)
return cmConfig, secretConfig, err
}
if errors2.IsNotFound(err) {
cmNotFoundErr := fmt.Sprintf("config map: %s not found in namespace: %s", impl.config.ExtBlobStorageCmName, namespace)
return cmConfig, secretConfig, errors.New(cmNotFoundErr)
}
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
secret, err := kubeClient.CoreV1().Secrets(namespace).Get(context.Background(), impl.config.ExtBlobStorageSecretName, v12.GetOptions{})
if err != nil && !errors2.IsNotFound(err) {
impl.Logger.Errorw("error in getting secret in external cluster", "err", err, "blobStorageSecretName", impl.config.ExtBlobStorageSecretName, "clusterName", clusterConfig.ClusterName)
return cmConfig, secretConfig, err
}
if errors2.IsNotFound(err) {
secretNotFoundErr := fmt.Sprintf("secret: %s not found in namespace: %s", impl.config.ExtBlobStorageSecretName, namespace)
return cmConfig, secretConfig, errors.New(secretNotFoundErr)
}
if cm.Data != nil && secret != nil {
cmDataJson, err := json.Marshal(cm.Data)
if err != nil {
fmt.Println("error marshalling external blob storage cm data to json:", err)
return cmConfig, secretConfig, err
}
err = json.Unmarshal(cmDataJson, &cmConfig)
if err != nil {
fmt.Println("error unmarshalling external blob storage cm json to struct:", err)
return cmConfig, secretConfig, err
}

secretDataJson, err := json.Marshal(secret.Data)
if err != nil {
fmt.Println("error marshalling external blob storage secret data to json:", err)
return cmConfig, secretConfig, err
}

err = json.Unmarshal(secretDataJson, &secretConfig)
if err != nil {
fmt.Println("error unmarshalling external blob storage secret json to struct:", err)
return cmConfig, secretConfig, err
}
}
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
return cmConfig, secretConfig, nil
}

func (impl *CdHandlerImpl) FetchCdWorkflowDetails(appId int, environmentId int, pipelineId int, buildId int) (WorkflowResponse, error) {
workflowR, err := impl.cdWorkflowRepository.FindWorkflowRunnerById(buildId)
if err != nil && err != pg.ErrNoRows {
Expand Down Expand Up @@ -1065,7 +1169,27 @@ func (impl *CdHandlerImpl) DownloadCdWorkflowArtifacts(pipelineId int, buildId i
impl.Logger.Errorw("unable to fetch ciWorkflow", "err", err)
return nil, err
}

var clusterBean cluster.ClusterBean
if wfr.CdWorkflow.Pipeline.Environment.Id != 0 {
clusterFromDb, err := impl.clusterRepository.FindById(wfr.CdWorkflow.Pipeline.Environment.ClusterId)
if err != nil {
impl.Logger.Errorw("unable to fetch cluster by cluster Id", "clusterId", wfr.CdWorkflow.Pipeline.Environment.ClusterId, "err", err)
return nil, err
}
clusterBean = cluster.GetClusterBean(*clusterFromDb)
}
clusterConfig, err := clusterBean.GetClusterConfig()
if err != nil {
impl.Logger.Errorw("error in getting cluster config", "err", err, "clusterId", clusterBean.Id)
return nil, err
}
var isExtCluster bool
if wfr.WorkflowType == PRE {
isExtCluster = wfr.CdWorkflow.Pipeline.RunPreStageInEnv
} else if wfr.WorkflowType == POST {
isExtCluster = wfr.CdWorkflow.Pipeline.RunPostStageInEnv
}
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
useExternalBlobStorage := isExtCluster && !impl.config.UseBlobStorageConfigInCdWorkflow
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
if !wfr.BlobStorageEnabled {
return nil, errors.New("logs-not-stored-in-repository")
}
Expand Down Expand Up @@ -1115,6 +1239,26 @@ func (impl *CdHandlerImpl) DownloadCdWorkflowArtifacts(pipelineId int, buildId i
AwsS3BaseConfig: awsS3BaseConfig,
GcpBlobBaseConfig: gcpBlobBaseConfig,
}
if useExternalBlobStorage {
//fetch extClusterBlob cm and cs from k8s client, if they are present then read creds
//from them else return.
cmConfig, secretConfig, err := impl.FetchCmAndSecretBlobConfigFromExternalCluster(clusterConfig, wfr.Namespace)
if err != nil {
impl.Logger.Errorw("error in fetching config map and secret from external cluster", "err", err, "clusterConfig", clusterConfig)
return nil, err
}
request.StorageType = cmConfig.CloudProvider

request.AwsS3BaseConfig.AccessKey = cmConfig.S3AccessKey
request.AwsS3BaseConfig.EndpointUrl = cmConfig.S3Endpoint
request.AwsS3BaseConfig.IsInSecure = cmConfig.S3EndpointInsecure
request.AwsS3BaseConfig.Passkey = secretConfig.S3SecretKey

request.AzureBlobBaseConfig.AccountName = cmConfig.AzureAccountName
request.AzureBlobBaseConfig.AccountKey = secretConfig.AzureAccountKey

request.GcpBlobBaseConfig.CredentialFileJsonData = secretConfig.GcpBlobStorageCredentialJson
}
_, numBytes, err := blobStorageService.Get(request)
if err != nil {
impl.Logger.Errorw("error occurred while downloading file", "request", request, "error", err)
Expand Down
2 changes: 2 additions & 0 deletions pkg/pipeline/CiCdConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ type CiCdConfig struct {
BaseLogLocationPath string `env:"BASE_LOG_LOCATION_PATH" envDefault:"/home/devtron/"`
InAppLoggingEnabled bool `env:"IN_APP_LOGGING_ENABLED" envDefault:"false"`
BuildxProvenanceMode string `env:"BUILDX_PROVENANCE_MODE" envDefault:""` //provenance is set to false if this flag is not set
ExtBlobStorageCmName string `env:"EXTERNAL_BLOB_STORAGE_CM_NAME" envDefault:"blob-storage-cm"`
ExtBlobStorageSecretName string `env:"EXTERNAL_BLOB_STORAGE_SECRET_NAME" envDefault:"blob-storage-secret"`
}

type CiConfig struct {
Expand Down
3 changes: 3 additions & 0 deletions pkg/pipeline/CiService.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,12 @@ func (impl *CiServiceImpl) buildWfRequestForCiPipeline(pipeline *pipelineConfig.
ImageRetryCount: impl.config.ImageRetryCount,
ImageRetryInterval: impl.config.ImageRetryInterval,
WorkflowExecutor: impl.config.GetWorkflowExecutorType(),
ExtBlobStorageSecretName: impl.config.ExtBlobStorageSecretName,
ExtBlobStorageCmName: impl.config.ExtBlobStorageCmName,
Type: bean2.CI_WORKFLOW_PIPELINE_TYPE,
CiArtifactLastFetch: trigger.CiArtifactLastFetch,
}

if dockerRegistry != nil {

workflowRequest.DockerRegistryId = dockerRegistry.Id
Expand Down
12 changes: 7 additions & 5 deletions pkg/pipeline/WorkflowDagExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -995,11 +995,13 @@ func (impl *WorkflowDagExecutorImpl) buildWFRequest(runner *pipelineConfig.CdWor
DataSource: artifact.DataSource,
WorkflowId: artifact.WorkflowId,
},
OrchestratorHost: impl.config.OrchestratorHost,
OrchestratorToken: impl.config.OrchestratorToken,
CloudProvider: impl.config.CloudProvider,
WorkflowExecutor: workflowExecutor,
RefPlugins: refPluginsData,
OrchestratorHost: impl.config.OrchestratorHost,
OrchestratorToken: impl.config.OrchestratorToken,
CloudProvider: impl.config.CloudProvider,
WorkflowExecutor: workflowExecutor,
RefPlugins: refPluginsData,
ExtBlobStorageSecretName: impl.config.ExtBlobStorageSecretName,
ExtBlobStorageCmName: impl.config.ExtBlobStorageCmName,
}

extraEnvVariables := make(map[string]string)
Expand Down
19 changes: 19 additions & 0 deletions pkg/pipeline/WorkflowService.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ func (impl *WorkflowServiceImpl) SubmitWorkflow(workflowRequest *WorkflowRequest
}

func (impl *WorkflowServiceImpl) createWorkflowTemplate(workflowRequest *WorkflowRequest) (bean3.WorkflowTemplate, error) {
workflowRequest.UseExternalClusterBlob = !workflowRequest.CheckBlobStorageConfig(impl.ciCdConfig) && workflowRequest.IsExtRun
workflowJson, err := workflowRequest.GetWorkflowJson(impl.ciCdConfig)
if err != nil {
impl.Logger.Errorw("error occurred while getting workflow json", "err", err)
Expand Down Expand Up @@ -243,6 +244,24 @@ func (impl *WorkflowServiceImpl) addExistingCmCsInWorkflow(workflowRequest *Work
workflowSecrets = append(workflowSecrets, *secret)
}
}
//internally inducing BlobStorageCmName and BlobStorageSecretName for getting logs, caches and artifacts from
//in-cluster configured blob storage, if USE_BLOB_STORAGE_CONFIG_IN_CD_WORKFLOW = false and isExt = true
if workflowRequest.UseExternalClusterBlob {
blobDetailsConfigMap := bean.ConfigSecretMap{
Name: impl.ciCdConfig.ExtBlobStorageCmName,
Type: "environment",
External: true,
}
workflowConfigMaps = append(workflowConfigMaps, blobDetailsConfigMap)

blobDetailsSecret := bean.ConfigSecretMap{
Name: impl.ciCdConfig.ExtBlobStorageSecretName,
Type: "environment",
External: true,
}
workflowSecrets = append(workflowSecrets, blobDetailsSecret)
}

prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
return workflowConfigMaps, workflowSecrets, nil
}

Expand Down
7 changes: 3 additions & 4 deletions pkg/pipeline/WorkflowUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ type WorkflowRequest struct {
WorkflowExecutor pipelineConfig.WorkflowExecutorType `json:"workflowExecutor"`
PrePostDeploySteps []*bean.StepObject `json:"prePostDeploySteps"`
CiArtifactLastFetch time.Time `json:"ciArtifactLastFetch"`
ExtBlobStorageCmName string `json:"extBlobStorageCmName"`
ExtBlobStorageSecretName string `json:"extBlobStorageSecretName"`
UseExternalClusterBlob bool `json:"useExternalClusterBlob"`
Type bean.WorkflowPipelineType
Pipeline *pipelineConfig.Pipeline
Env *repository2.Environment
Expand Down Expand Up @@ -471,10 +474,6 @@ func (workflowRequest *WorkflowRequest) getContainerEnvVariables(config *CiCdCon
workflowRequest.Type == bean.JOB_WORKFLOW_PIPELINE_TYPE {
containerEnvVariables = []v12.EnvVar{{Name: "IMAGE_SCANNER_ENDPOINT", Value: config.ImageScannerEndpoint}}
}
if config.CloudProvider == BLOB_STORAGE_S3 && config.BlobStorageS3AccessKey != "" {
miniCred := []v12.EnvVar{{Name: "AWS_ACCESS_KEY_ID", Value: config.BlobStorageS3AccessKey}, {Name: "AWS_SECRET_ACCESS_KEY", Value: config.BlobStorageS3SecretKey}}
containerEnvVariables = append(containerEnvVariables, miniCred...)
}
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
eventEnv := v12.EnvVar{Name: "CI_CD_EVENT", Value: string(workflowJson)}
inAppLoggingEnv := v12.EnvVar{Name: "IN_APP_LOGGING", Value: strconv.FormatBool(workflowRequest.InAppLoggingEnabled)}
containerEnvVariables = append(containerEnvVariables, eventEnv, inAppLoggingEnv)
Expand Down
Loading
Loading