Skip to content

Commit

Permalink
misc: Main sync develop (#5737)
Browse files Browse the repository at this point in the history
* migration number changes (#5692)

* refrain from checkin autoscalingCheckBeforeTrigger for virt clus (#5696)

* fix: Decode secret fix on add update oss (#5695)

* ValidateEncodedDataByDecoding in case add or update secret

* wire fix from main

* minor refactor

* comment

* saving pco concurrency case handled (#5688)

* fix: script for pipelineStageStepVariable, making input value and default_value text from varchar255 (#5701)

* script for pipelineStageStepVariable, making input value and default_value text from varchar255

* erro log fix

* fix: ea fixes for helm app (#5708)

* added the ea apps entry app table

* resolved the ea mode multiple rows error during configuration of app

* modified the ea dockerfile in ca-certificates cmd

* uncommented the code and left the ea helm app making way untouched

* remodified the dockerfile as previous state

* modified the docker file ea mode

* dockerfile exit code 100 due to ap install alternative in ea mode dockerfile

* execute make after main merge

* modified changes in dockerfile ea mode

* resolved comments after first level review

* Revert "fix: ea fixes for helm app (#5708)" (#5713)

This reverts commit 3e31f49.

* fix: SkipCiBuildCachePushPull code incorporated with minor refac in handle runtime params validation (#5712)

* SkipCiBuildCachePushPull code incorporated with minor refac in handle runtime params validation

* minor refactor

* minor refactor

* migration syn with ent (#5718)

---------

Co-authored-by: Prakash <[email protected]>
Co-authored-by: Rajeev Ranjan <[email protected]>
Co-authored-by: prakhar katiyar <[email protected]>
  • Loading branch information
4 people authored Aug 23, 2024
1 parent 7048c68 commit 0c56885
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions env_gen.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
| SCOPED_VARIABLE_HANDLE_PRIMITIVES | false | |
| SCOPED_VARIABLE_NAME_REGEX | ^[a-zA-Z][a-zA-Z0-9_-]{0,62}[a-zA-Z0-9]$ | |
| SHOW_DOCKER_BUILD_ARGS | true | |
| SKIP_CI_JOB_BUILD_CACHE_PUSH_PULL | false | |
| SKIP_CREATING_ECR_REPO | false | |
| SOCKET_DISCONNECT_DELAY_SECONDS | 5 | |
| SOCKET_HEARTBEAT_SECONDS | 25 | |
Expand Down
30 changes: 20 additions & 10 deletions pkg/pipeline/CiService.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,33 @@ func (impl *CiServiceImpl) GetCiMaterials(pipelineId int, ciMaterials []*pipelin
}
}

func (impl *CiServiceImpl) TriggerCiPipeline(trigger types.Trigger) (int, error) {
impl.Logger.Debug("ci pipeline manual trigger")
ciMaterials, err := impl.GetCiMaterials(trigger.PipelineId, trigger.CiMaterials)
if err != nil {
return 0, err
}

func (impl *CiServiceImpl) handleRuntimeParamsValidations(trigger types.Trigger, ciMaterials []*pipelineConfig.CiPipelineMaterial) error {
// checking if user has given run time parameters for externalCiArtifact, if given then sending git material to Ci-Runner
externalCiArtifact, exists := trigger.ExtraEnvironmentVariables["externalCiArtifact"]
externalCiArtifact, exists := trigger.ExtraEnvironmentVariables[CiPipeline.ExtraEnvVarExternalCiArtifactKey]
// validate externalCiArtifact as docker image
if exists {
if !strings.Contains(externalCiArtifact, ":") {
impl.Logger.Errorw("validation error", "externalCiArtifact", externalCiArtifact)
return 0, fmt.Errorf("invalid image name given in externalCiArtifact")
return fmt.Errorf("invalid image name given in externalCiArtifact")
}
}
if trigger.PipelineType == string(CiPipeline.CI_JOB) && len(ciMaterials) != 0 && !exists && externalCiArtifact == "" {
ciMaterials = []*pipelineConfig.CiPipelineMaterial{ciMaterials[0]}
ciMaterials[0].GitMaterial = nil
ciMaterials[0].GitMaterialId = 0
}
return nil
}

func (impl *CiServiceImpl) TriggerCiPipeline(trigger types.Trigger) (int, error) {
impl.Logger.Debug("ci pipeline manual trigger")
ciMaterials, err := impl.GetCiMaterials(trigger.PipelineId, trigger.CiMaterials)
if err != nil {
return 0, err
}
err = impl.handleRuntimeParamsValidations(trigger, ciMaterials)
if err != nil {
return 0, err
}
ciPipelineScripts, err := impl.ciPipelineRepository.FindCiScriptsByCiPipelineId(trigger.PipelineId)
if err != nil && !util.IsErrNoRows(err) {
return 0, err
Expand Down Expand Up @@ -741,6 +747,10 @@ func (impl *CiServiceImpl) buildWfRequestForCiPipeline(pipeline *pipelineConfig.
if pipeline.App.AppType == helper.Job {
workflowRequest.AppName = pipeline.App.DisplayName
}
if trigger.PipelineType == string(CiPipeline.CI_JOB) {
workflowRequest.IgnoreDockerCachePush = impl.config.SkipCiJobBuildCachePushPull
workflowRequest.IgnoreDockerCachePull = impl.config.SkipCiJobBuildCachePushPull
}
if dockerRegistry != nil {

workflowRequest.DockerRegistryId = dockerRegistry.Id
Expand Down
5 changes: 5 additions & 0 deletions pkg/pipeline/bean/CiPipeline/CiBuildConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ func (pType PipelineType) IsValidPipelineType() bool {
return false
}
}

const (
ExtraEnvVarExternalCiArtifactKey = "externalCiArtifact"
ExtraEnvVarImageDigestKey = "imageDigest"
)
1 change: 1 addition & 0 deletions pkg/pipeline/types/CiCdConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type CiCdConfig struct {
ImageScanRetryDelay int `env:"IMAGE_SCAN_RETRY_DELAY" envDefault:"5"`
ShowDockerBuildCmdInLogs bool `env:"SHOW_DOCKER_BUILD_ARGS" envDefault:"true"`
IgnoreCmCsInCiJob bool `env:"IGNORE_CM_CS_IN_CI_JOB" envDefault:"false"`
SkipCiJobBuildCachePushPull bool `env:"SKIP_CI_JOB_BUILD_CACHE_PUSH_PULL" envDefault:"false"`
// from CdConfig
CdLimitCpu string `env:"CD_LIMIT_CI_CPU" envDefault:"0.5"`
CdLimitMem string `env:"CD_LIMIT_CI_MEM" envDefault:"3G"`
Expand Down

0 comments on commit 0c56885

Please sign in to comment.