Skip to content

Conversation

@gireesh-naidu
Copy link
Contributor

@gireesh-naidu gireesh-naidu commented Sep 13, 2023

Description

This feature is to retrigger ci,pre-cd and post-cd workflows incase they get deleted before reaching terminal state.

Fixes #4061

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


}

if retryCnt >= impl.cdConfig.MaxCdWorkflowRunnerRetries {
impl.Logger.Debugw("maximum retries for this workflow are exhausted, not re-triggering again", "retries", retryCnt, "wfrId", runner.Id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert this to Info level msg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 1577 to 1588
clusterConfig, err := cluster.GetClusterBean(*env.Cluster).GetClusterConfig()
if err != nil {
impl.Logger.Warnw("error in getting cluster Config", "err", err, "clusterId", env.Cluster.Id)
continue
}

client, err = impl.K8sUtil.GetCoreV1Client(clusterConfig)
if err != nil {
impl.Logger.Warnw("error in getting core v1 client using clusterConfig", "err", err, "clusterId", env.Cluster.Id)
continue
}
ns = env.Namespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create separate func for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if ciWorkflow.Status != WorkflowCancel {
retryCount, refCiWorkflow, err := impl.getRefWorkflowAndCiRetryCount(ciWorkflow)
if err != nil {
impl.Logger.Errorw("error in getRefWorkflowAndCiRetryCount", "ciWorkflowId", ciWorkflow.Id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error not logged here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


func (impl *CdWorkflowRepositoryImpl) FindRetriedWorkflowCountByReferenceId(wfrId int) (int, error) {
retryCount := 0
query := fmt.Sprintf("select count(*) "+
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use id instead of * here

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: auto retrigger ci/pre-cd/post-cd pods if deleted during running state.

4 participants