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: add rule to disable auto sync crd #254

Merged
merged 8 commits into from
Dec 3, 2024
Merged

Conversation

FabrizioCafolla
Copy link
Member

@FabrizioCafolla FabrizioCafolla commented Dec 2, 2024

PR Type

Enhancement


Description

  • Added new feature to control automatic CRD synchronization through environment variable
  • When DISABLE_AUTOMATIC_SYNC_CRD is set to "true", the CRD sync job will be skipped
  • Provides more flexibility in managing ArgoCD CRD synchronization workflow

Changes walkthrough 📝

Relevant files
Enhancement
gitlab-ci-template-gitops-argo.yml
Add conditional rule for CRD sync job execution                   

templates/argocd/gitlab-ci-template-gitops-argo.yml

  • Added conditional rule to skip CRD sync job when
    DISABLE_AUTOMATIC_SYNC_CRD is set to "true"
  • +2/-0     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @sparkfabrik-ai-bot
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Validation Missing
    The environment variable DISABLE_AUTOMATIC_SYNC_CRD is used without validation of its format or default value. Consider adding validation to ensure proper boolean parsing.

    @sparkfabrik-ai-bot
    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Add explicit job control flow to improve clarity and predictability of pipeline execution

    Add an explicit 'when' condition to handle the case when DISABLE_AUTOMATIC_SYNC_CRD
    is "true", making the job behavior more explicit and predictable.

    templates/argocd/gitlab-ci-template-gitops-argo.yml [209-210]

     rules:
       - if: '${DISABLE_AUTOMATIC_SYNC_CRD} != "true"'
    +    when: on_success
    +  - when: never
    Suggestion importance[1-10]: 7

    Why: The suggestion improves the GitLab CI pipeline's clarity by explicitly defining the job behavior for all conditions, making it more maintainable and preventing potential confusion about when the job will or won't run.

    7

    @andypanix andypanix merged commit 14c60f8 into master Dec 3, 2024
    2 checks passed
    @andypanix andypanix deleted the feat/3049_disable_crd branch December 3, 2024 12:48
    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.

    2 participants