Skip to content

Support disabling polling of pluggable SCM materials created via config repositories #11635

@peterrosell

Description

@peterrosell
Issue Type

Bug report/Feature enhancement

Summary

I want to disable polling of materials of pipelines that are configured via a SCM Plugin and instead rely on web-hooks.

It works for manually created pipelines it's possible to set Repository polling behavior to Fetch updates to this repository only on webhook or manual trigger, but not when creating pipelines via a SCM plugin like gocd-yaml-config-plugin or gocd-json-config-plugin. When setting the auto_update flag in the config file it's silently ignored and always set to true in the internal data model.

Environment

GoCD Version: 23.2.0
YAML Configuration Plugin: 0.14.1
JSON Configuration Plugin: 0.6.0

Steps to Reproduce
  1. Create a Pipeline in a repo and add it as a config repo.
format_version: 9
pipelines:
  pipe-test-1:
    group: TestGroup
    lock_behaviour: none

    materials:
      pipe-test-pr:
        plugin_configuration:
          id: github.pr
          version: 1
        options:
          url: git@github.com:peterrosell/test-repo.git
        auto_update: false
    stages:
      - test-pipe2:
          clean_workspace: true
          jobs:
            release:
              tasks:
                - exec:
                    command: /bin/bash
                    arguments:
                      - -c
                      - ls
  1. Fetch the SCM config with curl and see that auto_update is set to true.
curl -s 'http://localhost:8153/go/api/admin/scms' -H 'Accept:application/vnd.go.cd.v4+json' | jq '.'
Expected Results

The auto_update flag should be set to false.

Actual Results

The auto_update flag is set to true.

Possible Fix

I've been digging around in the code and the flag doesn't exists in CRPluggableScmMaterial like it does in CRScmMaterial.
So by adding this property to CRPluggableScmMaterial and then make sure the flag propagates from PluggableSCMMaterialConfig to the CRPluggableScmMaterial.

Affected code in ConfigConverter.java here and here.

I have done some tests locally and got it to work so will create a PR to fix this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions